expo-notifications 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/android/build.gradle +7 -3
  3. package/android/src/main/AndroidManifest.xml +9 -0
  4. package/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/CategoryAwareNotificationBuilder.java +4 -0
  5. package/android/src/main/java/expo/modules/notifications/service/NotificationForwarderActivity.kt +33 -0
  6. package/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt +52 -8
  7. package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoHandlingDelegate.kt +59 -25
  8. package/android/src/main/java/expo/modules/notifications/tokens/PushTokenModule.java +18 -0
  9. package/build/PushTokenManager.types.d.ts +1 -0
  10. package/build/PushTokenManager.types.d.ts.map +1 -1
  11. package/build/PushTokenManager.types.js.map +1 -1
  12. package/build/index.d.ts +1 -0
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js +1 -0
  15. package/build/index.js.map +1 -1
  16. package/build/unregisterForNotificationsAsync.d.ts +2 -0
  17. package/build/unregisterForNotificationsAsync.d.ts.map +1 -0
  18. package/build/unregisterForNotificationsAsync.js +9 -0
  19. package/build/unregisterForNotificationsAsync.js.map +1 -0
  20. package/ios/EXNotifications/PushToken/EXPushTokenModule.m +7 -0
  21. package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/EXNotifications +0 -0
  22. package/ios/EXNotifications.xcframework/ios-arm64/EXNotifications.framework/Info.plist +0 -0
  23. package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/EXNotifications +0 -0
  24. package/ios/EXNotifications.xcframework/ios-arm64_x86_64-simulator/EXNotifications.framework/Info.plist +0 -0
  25. package/package.json +5 -5
  26. package/plugin/build/withNotifications.d.ts +6 -3
  27. package/plugin/src/withNotifications.ts +6 -3
  28. package/src/PushTokenManager.types.ts +1 -0
  29. package/src/index.ts +1 -0
  30. package/src/unregisterForNotificationsAsync.ts +10 -0
  31. package/tsconfig.json +1 -1
package/CHANGELOG.md CHANGED
@@ -10,11 +10,20 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.15.2 — 2022-05-05
13
+ ## 0.16.0 — 2022-07-07
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - [android] Set the "notification number" (sometimes used to increment badge count on some launchers) from the notification payload `badge` field. ([#17171](https://github.com/expo/expo/pull/17171) by [@danstepanov](https://github.com/danstepanov))
14
18
 
15
19
  ### 🐛 Bug fixes
16
20
 
17
21
  - Fixed Android 12+ runtime crash caused by `PendingIntent` misconfiguration. ([#17333](https://github.com/expo/expo/pull/17333) by [@kudo](https://github.com/kudo))
22
+ - Fix app not bringing to foreground when clicking notification on Android 12+. ([#17686](https://github.com/expo/expo/pull/17686) by [@kudo](https://github.com/kudo))
23
+ - Fixed Android data-only FCM notifications (i.e. notifications without a title and message) appearing in the notification drawer ([#17707](https://github.com/expo/expo/pull/17707) by [@sausti](https://github.com/sausti))
24
+ - Add support for unregistering from push notifications on Android and iOS ([#17812](https://github.com/expo/expo/pull/17812) by [@sausti](https://github.com/sausti))
25
+ - Fix another Android 12+ trampoline issue from push notifications. ([#17871](https://github.com/expo/expo/pull/17871) by [@kudo](https://github.com/kudo))
26
+ - Fixed `useLastNotificationResponse` returns latest received notification but not the clicked notification on Android. ([#17974](https://github.com/expo/expo/pull/17974) by [@kudo](https://github.com/kudo))
18
27
 
19
28
  ### ⚠️ Notices
20
29
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.15.2'
6
+ version = '0.16.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 21
77
- versionName '0.15.2'
77
+ versionName '0.16.0'
78
78
  }
79
79
 
80
80
  lintOptions {
@@ -92,7 +92,11 @@ dependencies {
92
92
 
93
93
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
94
94
 
95
- api 'com.google.firebase:firebase-messaging:21.1.0'
95
+ api 'com.google.firebase:firebase-messaging:22.0.0'
96
96
 
97
97
  api 'me.leolin:ShortcutBadger:1.1.22@aar'
98
+
99
+ if (project.findProject(':expo-modules-test-core')) {
100
+ testImplementation project(':expo-modules-test-core')
101
+ }
98
102
  }
@@ -27,5 +27,14 @@
27
27
  <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
28
28
  </intent-filter>
29
29
  </receiver>
30
+
31
+ <activity android:name=".service.NotificationForwarderActivity"
32
+ android:theme="@android:style/Theme.Translucent.NoTitleBar"
33
+ android:exported="false"
34
+ android:excludeFromRecents="true"
35
+ android:noHistory="true"
36
+ android:launchMode="standard"
37
+ android:taskAffinity=""
38
+ />
30
39
  </application>
31
40
  </manifest>
@@ -36,6 +36,10 @@ public class CategoryAwareNotificationBuilder extends ExpoNotificationBuilder {
36
36
  if (categoryIdentifier != null) {
37
37
  addActionsToBuilder(builder, categoryIdentifier);
38
38
  }
39
+
40
+ if (content.getBadgeCount() != null) {
41
+ builder.setNumber(content.getBadgeCount().intValue());
42
+ }
39
43
 
40
44
  return builder;
41
45
  }
@@ -0,0 +1,33 @@
1
+ package expo.modules.notifications.service
2
+
3
+ import android.app.Activity
4
+ import android.content.Intent
5
+ import android.os.Bundle
6
+ import expo.modules.notifications.BuildConfig
7
+ import expo.modules.notifications.service.delegates.ExpoHandlingDelegate
8
+
9
+ /**
10
+ * An internal Activity that passes given Intent extras from
11
+ * [NotificationsService.createNotificationResponseIntent]
12
+ * and send broadcasts to [NotificationsService].
13
+ */
14
+ class NotificationForwarderActivity : Activity() {
15
+ override fun onCreate(savedInstanceState: Bundle?) {
16
+ super.onCreate(savedInstanceState)
17
+ val broadcastIntent =
18
+ NotificationsService.createNotificationResponseBroadcastIntent(applicationContext, intent.extras)
19
+ val notificationResponse = NotificationsService.getNotificationResponseFromBroadcastIntent(broadcastIntent)
20
+ ExpoHandlingDelegate.openAppToForeground(this, notificationResponse)
21
+ sendBroadcast(broadcastIntent)
22
+ finish()
23
+ }
24
+
25
+ override fun onNewIntent(intent: Intent?) {
26
+ super.onNewIntent(intent)
27
+ // This Activity is expected to launch with new task, supposedly
28
+ // there's no way for `onNewIntent` to be called.
29
+ if (BuildConfig.DEBUG) {
30
+ throw AssertionError()
31
+ }
32
+ }
33
+ }
@@ -450,6 +450,15 @@ open class NotificationsService : BroadcastReceiver() {
450
450
  intent.putExtra(NOTIFICATION_ACTION_KEY, action as Parcelable)
451
451
  }
452
452
 
453
+ // Starting from Android 12,
454
+ // [notification trampolines](https://developer.android.com/about/versions/12/behavior-changes-12#identify-notification-trampolines)
455
+ // are not allowed. If the notification wants to open foreground app,
456
+ // we should use the dedicated Activity pendingIntent.
457
+ if (action.opensAppToForeground()) {
458
+ val notificationResponse = getNotificationResponseFromBroadcastIntent(intent)
459
+ return ExpoHandlingDelegate.createPendingIntentForOpeningApp(context, intent, notificationResponse)
460
+ }
461
+
453
462
  // We're defaulting to the behaviour prior API 31 (mutable) even though Android recommends immutability
454
463
  val mutableFlag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
455
464
  return PendingIntent.getBroadcast(
@@ -460,7 +469,48 @@ open class NotificationsService : BroadcastReceiver() {
460
469
  )
461
470
  }
462
471
 
463
- fun getNotificationResponseFromIntent(intent: Intent): NotificationResponse? {
472
+ /**
473
+ * Recreate an Intent from [createNotificationResponseIntent] extras
474
+ * for [NotificationForwarderActivity] to send broadcasts
475
+ */
476
+ fun createNotificationResponseBroadcastIntent(context: Context, extras: Bundle?): Intent {
477
+ val notification = extras?.getParcelable<Notification>(NOTIFICATION_KEY)
478
+ val action = extras?.getParcelable<NotificationAction>(NOTIFICATION_ACTION_KEY)
479
+ if (notification == null || action == null) {
480
+ throw IllegalArgumentException("notification and action should not be null")
481
+ }
482
+ val backgroundAction = NotificationAction(action.identifier, action.title, false)
483
+ val intent = Intent(
484
+ NOTIFICATION_EVENT_ACTION,
485
+ getUriBuilder()
486
+ .appendPath(notification.notificationRequest.identifier)
487
+ .appendPath("actions")
488
+ .appendPath(backgroundAction.identifier)
489
+ .build()
490
+ ).also { intent ->
491
+ findDesignatedBroadcastReceiver(context, intent)?.let {
492
+ intent.component = ComponentName(it.packageName, it.name)
493
+ }
494
+ intent.putExtra(EVENT_TYPE_KEY, RECEIVE_RESPONSE_TYPE)
495
+ intent.putExtra(NOTIFICATION_KEY, notification)
496
+ intent.putExtra(NOTIFICATION_ACTION_KEY, backgroundAction as Parcelable)
497
+ }
498
+ return intent
499
+ }
500
+
501
+ fun getNotificationResponseFromBroadcastIntent(intent: Intent): NotificationResponse {
502
+ val notification = intent.getParcelableExtra<Notification>(NOTIFICATION_KEY) ?: throw IllegalArgumentException("$NOTIFICATION_KEY not found in the intent extras.")
503
+ val action = intent.getParcelableExtra<NotificationAction>(NOTIFICATION_ACTION_KEY) ?: throw IllegalArgumentException("$NOTIFICATION_ACTION_KEY not found in the intent extras.")
504
+ val response = if (action is TextInputNotificationAction) {
505
+ val userText = action.placeholder ?: RemoteInput.getResultsFromIntent(intent).getString(USER_TEXT_RESPONSE_KEY)
506
+ TextInputNotificationResponse(action, notification, userText)
507
+ } else {
508
+ NotificationResponse(action, notification)
509
+ }
510
+ return response
511
+ }
512
+
513
+ fun getNotificationResponseFromOpenIntent(intent: Intent): NotificationResponse? {
464
514
  intent.getByteArrayExtra(NOTIFICATION_RESPONSE_KEY)?.let { return unmarshalObject(NotificationResponse.CREATOR, it) }
465
515
  intent.getByteArrayExtra(TEXT_INPUT_NOTIFICATION_RESPONSE_KEY)?.let { return unmarshalObject(TextInputNotificationResponse.CREATOR, it) }
466
516
  return null
@@ -640,13 +690,7 @@ open class NotificationsService : BroadcastReceiver() {
640
690
  )
641
691
 
642
692
  open fun onReceiveNotificationResponse(context: Context, intent: Intent) {
643
- val notification = intent.getParcelableExtra<Notification>(NOTIFICATION_KEY)!!
644
- val action = intent.getParcelableExtra<NotificationAction>(NOTIFICATION_ACTION_KEY)!!
645
- val response = if (action is TextInputNotificationAction) {
646
- TextInputNotificationResponse(action, notification, RemoteInput.getResultsFromIntent(intent).getString(USER_TEXT_RESPONSE_KEY))
647
- } else {
648
- NotificationResponse(action, notification)
649
- }
693
+ val response = getNotificationResponseFromBroadcastIntent(intent)
650
694
  getHandlingDelegate(context).handleNotificationResponse(response)
651
695
  }
652
696
 
@@ -1,13 +1,16 @@
1
1
  package expo.modules.notifications.service.delegates
2
2
 
3
+ import android.app.PendingIntent
3
4
  import android.content.Context
4
5
  import android.content.Intent
6
+ import android.os.Build
5
7
  import android.util.Log
6
8
  import androidx.lifecycle.Lifecycle
7
9
  import androidx.lifecycle.ProcessLifecycleOwner
8
10
  import expo.modules.notifications.notifications.NotificationManager
9
11
  import expo.modules.notifications.notifications.model.Notification
10
12
  import expo.modules.notifications.notifications.model.NotificationResponse
13
+ import expo.modules.notifications.service.NotificationForwarderActivity
11
14
  import expo.modules.notifications.service.NotificationsService
12
15
  import expo.modules.notifications.service.interfaces.HandlingDelegate
13
16
  import java.lang.ref.WeakReference
@@ -50,6 +53,52 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
50
53
  }
51
54
  }
52
55
  }
56
+
57
+ /**
58
+ * Create a PendingIntent to open app in foreground.
59
+ * We actually start two Activities
60
+ * - the foreground main Activity
61
+ * - the background [NotificationForwarderActivity] Activity that send notification clicked events through broadcast
62
+ */
63
+ fun createPendingIntentForOpeningApp(context: Context, broadcastIntent: Intent, notificationResponse: NotificationResponse): PendingIntent {
64
+ var intentFlags = PendingIntent.FLAG_UPDATE_CURRENT
65
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
66
+ // The intent may include `RemoteInput` from `TextInputNotificationAction`.
67
+ // For intent with RemoteInput, it should be mutable.
68
+ intentFlags = intentFlags or PendingIntent.FLAG_MUTABLE
69
+ }
70
+
71
+ val backgroundActivityIntent = Intent(context, NotificationForwarderActivity::class.java)
72
+ backgroundActivityIntent.data = broadcastIntent.data
73
+ backgroundActivityIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
74
+ backgroundActivityIntent.putExtras(broadcastIntent)
75
+ val requestCode = broadcastIntent.component?.className?.hashCode() ?: NotificationsService::class.java.hashCode()
76
+ return PendingIntent.getActivity(context, requestCode, backgroundActivityIntent, intentFlags)
77
+ }
78
+
79
+ fun openAppToForeground(context: Context, notificationResponse: NotificationResponse) {
80
+ (getNotificationActionLauncher(context) ?: getMainActivityLauncher(context))?.let { intent ->
81
+ NotificationsService.setNotificationResponseToIntent(intent, notificationResponse)
82
+ context.startActivity(intent)
83
+ return
84
+ }
85
+
86
+ Log.w("expo-notifications", "No launch intent found for application. Interacting with the notification won't open the app. The implementation uses `getLaunchIntentForPackage` to find appropriate activity.")
87
+ }
88
+
89
+ private fun getNotificationActionLauncher(context: Context): Intent? {
90
+ Intent(OPEN_APP_INTENT_ACTION).also { intent ->
91
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
92
+ intent.setPackage(context.applicationContext.packageName)
93
+ context.packageManager.resolveActivity(intent, 0)?.let {
94
+ return intent
95
+ }
96
+ }
97
+ return null
98
+ }
99
+
100
+ private fun getMainActivityLauncher(context: Context) =
101
+ context.packageManager.getLaunchIntentForPackage(context.packageName)
53
102
  }
54
103
 
55
104
  fun isAppInForeground() = ProcessLifecycleOwner.get().lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)
@@ -61,11 +110,20 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
61
110
  getListeners().forEach {
62
111
  it.onNotificationReceived(notification)
63
112
  }
64
- } else {
113
+ } else if (notification.shouldPresent()) {
65
114
  NotificationsService.present(context, notification)
66
115
  }
67
116
  }
68
117
 
118
+ /**
119
+ * If the app is backgrounded, a notification is only presented if
120
+ * the title and or text is present. If both are null or empty, this is a "data-only" or "silent"
121
+ * notification that should not be presented to the user.
122
+ */
123
+ private fun Notification.shouldPresent(): Boolean {
124
+ return !(notificationRequest.content.title.isNullOrEmpty() && notificationRequest.content.text.isNullOrEmpty())
125
+ }
126
+
69
127
  override fun handleNotificationResponse(notificationResponse: NotificationResponse) {
70
128
  if (notificationResponse.action.opensAppToForeground()) {
71
129
  openAppToForeground(context, notificationResponse)
@@ -80,30 +138,6 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
80
138
  }
81
139
  }
82
140
 
83
- protected fun openAppToForeground(context: Context, notificationResponse: NotificationResponse) {
84
- (getNotificationActionLauncher(context) ?: getMainActivityLauncher(context))?.let { intent ->
85
- NotificationsService.setNotificationResponseToIntent(intent, notificationResponse)
86
- context.startActivity(intent)
87
- return
88
- }
89
-
90
- Log.w("expo-notifications", "No launch intent found for application. Interacting with the notification won't open the app. The implementation uses `getLaunchIntentForPackage` to find appropriate activity.")
91
- }
92
-
93
- private fun getNotificationActionLauncher(context: Context): Intent? {
94
- Intent(OPEN_APP_INTENT_ACTION).also { intent ->
95
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
96
- intent.setPackage(context.applicationContext.packageName)
97
- context.packageManager.resolveActivity(intent, 0)?.let {
98
- return intent
99
- }
100
- }
101
- return null
102
- }
103
-
104
- private fun getMainActivityLauncher(context: Context) =
105
- context.packageManager.getLaunchIntentForPackage(context.packageName)
106
-
107
141
  override fun handleNotificationsDropped() {
108
142
  getListeners().forEach {
109
143
  it.onNotificationsDropped()
@@ -24,6 +24,7 @@ public class PushTokenModule extends ExportedModule implements PushTokenListener
24
24
  private final static String NEW_TOKEN_EVENT_TOKEN_KEY = "devicePushToken";
25
25
 
26
26
  private final static String REGISTRATION_FAIL_CODE = "E_REGISTRATION_FAILED";
27
+ private final static String UNREGISTER_FOR_NOTIFICATIONS_FAIL_CODE = "E_UNREGISTER_FOR_NOTIFICATIONS_FAILED";
27
28
 
28
29
  private PushTokenManager mPushTokenManager;
29
30
  private EventEmitter mEventEmitter;
@@ -81,6 +82,23 @@ public class PushTokenModule extends ExportedModule implements PushTokenListener
81
82
  });
82
83
  }
83
84
 
85
+ @ExpoMethod
86
+ public void unregisterForNotificationsAsync(final Promise promise) {
87
+ FirebaseMessaging.getInstance().deleteToken()
88
+ .addOnCompleteListener(task -> {
89
+ if (!task.isSuccessful()) {
90
+ if (task.getException() == null) {
91
+ promise.reject(UNREGISTER_FOR_NOTIFICATIONS_FAIL_CODE, "Unregistering for notifications failed.");
92
+ } else {
93
+ promise.reject(UNREGISTER_FOR_NOTIFICATIONS_FAIL_CODE, "Unregistering for notifications failed: " + task.getException().getMessage(), task.getException());
94
+ }
95
+ return;
96
+ }
97
+
98
+ promise.resolve(null);
99
+ });
100
+ }
101
+
84
102
  /**
85
103
  * Callback called when {@link PushTokenManager} gets notified of a new token.
86
104
  * Emits a {@link PushTokenModule#NEW_TOKEN_EVENT_NAME} event.
@@ -1,5 +1,6 @@
1
1
  import { ProxyNativeModule } from 'expo-modules-core';
2
2
  export interface PushTokenManagerModule extends ProxyNativeModule {
3
3
  getDevicePushTokenAsync?: () => Promise<string>;
4
+ unregisterForNotificationsAsync?: () => Promise<void>;
4
5
  }
5
6
  //# sourceMappingURL=PushTokenManager.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PushTokenManager.types.d.ts","sourceRoot":"","sources":["../src/PushTokenManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACjD"}
1
+ {"version":3,"file":"PushTokenManager.types.d.ts","sourceRoot":"","sources":["../src/PushTokenManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,+BAA+B,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"PushTokenManager.types.js","sourceRoot":"","sources":["../src/PushTokenManager.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nexport interface PushTokenManagerModule extends ProxyNativeModule {\n getDevicePushTokenAsync?: () => Promise<string>;\n}\n"]}
1
+ {"version":3,"file":"PushTokenManager.types.js","sourceRoot":"","sources":["../src/PushTokenManager.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nexport interface PushTokenManagerModule extends ProxyNativeModule {\n getDevicePushTokenAsync?: () => Promise<string>;\n unregisterForNotificationsAsync?: () => Promise<void>;\n}\n"]}
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';
2
+ export { default as unregisterForNotificationsAsync } from './unregisterForNotificationsAsync';
2
3
  export { default as getExpoPushTokenAsync } from './getExpoPushTokenAsync';
3
4
  export { default as getPresentedNotificationsAsync } from './getPresentedNotificationsAsync';
4
5
  export { default as presentNotificationAsync } from './presentNotificationAsync';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE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AqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
package/build/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';
2
+ export { default as unregisterForNotificationsAsync } from './unregisterForNotificationsAsync';
2
3
  export { default as getExpoPushTokenAsync } from './getExpoPushTokenAsync';
3
4
  export { default as getPresentedNotificationsAsync } from './getPresentedNotificationsAsync';
4
5
  export { default as presentNotificationAsync } from './presentNotificationAsync';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,2BA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,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC","sourcesContent":["export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';\nexport { default as getExpoPushTokenAsync } from './getExpoPushTokenAsync';\nexport { default as getPresentedNotificationsAsync } from './getPresentedNotificationsAsync';\nexport { default as presentNotificationAsync } from './presentNotificationAsync';\nexport { default as dismissNotificationAsync } from './dismissNotificationAsync';\nexport { default as dismissAllNotificationsAsync } from './dismissAllNotificationsAsync';\nexport { default as getNotificationChannelsAsync } from './getNotificationChannelsAsync';\nexport { default as getNotificationChannelAsync } from './getNotificationChannelAsync';\nexport { default as setNotificationChannelAsync } from './setNotificationChannelAsync';\nexport { default as deleteNotificationChannelAsync } from './deleteNotificationChannelAsync';\nexport { default as getNotificationChannelGroupsAsync } from './getNotificationChannelGroupsAsync';\nexport { default as getNotificationChannelGroupAsync } from './getNotificationChannelGroupAsync';\nexport { default as setNotificationChannelGroupAsync } from './setNotificationChannelGroupAsync';\nexport { default as deleteNotificationChannelGroupAsync } from './deleteNotificationChannelGroupAsync';\nexport { default as getBadgeCountAsync } from './getBadgeCountAsync';\nexport { default as setBadgeCountAsync } from './setBadgeCountAsync';\nexport { default as getAllScheduledNotificationsAsync } from './getAllScheduledNotificationsAsync';\nexport { default as scheduleNotificationAsync } from './scheduleNotificationAsync';\nexport { default as cancelScheduledNotificationAsync } from './cancelScheduledNotificationAsync';\nexport { default as cancelAllScheduledNotificationsAsync } from './cancelAllScheduledNotificationsAsync';\nexport { default as getNotificationCategoriesAsync } from './getNotificationCategoriesAsync';\nexport { default as setNotificationCategoryAsync } from './setNotificationCategoryAsync';\nexport { default as deleteNotificationCategoryAsync } from './deleteNotificationCategoryAsync';\nexport { default as getNextTriggerDateAsync } from './getNextTriggerDateAsync';\nexport { default as useLastNotificationResponse } from './useLastNotificationResponse';\nexport { setAutoServerRegistrationEnabledAsync } from './DevicePushTokenAutoRegistration.fx';\nexport { default as registerTaskAsync } from './registerTaskAsync';\nexport { default as unregisterTaskAsync } from './unregisterTaskAsync';\nexport * from './TokenEmitter';\nexport * from './NotificationsEmitter';\nexport * from './NotificationsHandler';\nexport * from './NotificationPermissions';\nexport * from './NotificationChannelGroupManager.types';\nexport * from './NotificationChannelManager.types';\nexport * from './NotificationPermissions.types';\nexport * from './Notifications.types';\nexport * from './Tokens.types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,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AgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC","sourcesContent":["export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';\nexport { default as unregisterForNotificationsAsync } from './unregisterForNotificationsAsync';\nexport { default as getExpoPushTokenAsync } from './getExpoPushTokenAsync';\nexport { default as getPresentedNotificationsAsync } from './getPresentedNotificationsAsync';\nexport { default as presentNotificationAsync } from './presentNotificationAsync';\nexport { default as dismissNotificationAsync } from './dismissNotificationAsync';\nexport { default as dismissAllNotificationsAsync } from './dismissAllNotificationsAsync';\nexport { default as getNotificationChannelsAsync } from './getNotificationChannelsAsync';\nexport { default as getNotificationChannelAsync } from './getNotificationChannelAsync';\nexport { default as setNotificationChannelAsync } from './setNotificationChannelAsync';\nexport { default as deleteNotificationChannelAsync } from './deleteNotificationChannelAsync';\nexport { default as getNotificationChannelGroupsAsync } from './getNotificationChannelGroupsAsync';\nexport { default as getNotificationChannelGroupAsync } from './getNotificationChannelGroupAsync';\nexport { default as setNotificationChannelGroupAsync } from './setNotificationChannelGroupAsync';\nexport { default as deleteNotificationChannelGroupAsync } from './deleteNotificationChannelGroupAsync';\nexport { default as getBadgeCountAsync } from './getBadgeCountAsync';\nexport { default as setBadgeCountAsync } from './setBadgeCountAsync';\nexport { default as getAllScheduledNotificationsAsync } from './getAllScheduledNotificationsAsync';\nexport { default as scheduleNotificationAsync } from './scheduleNotificationAsync';\nexport { default as cancelScheduledNotificationAsync } from './cancelScheduledNotificationAsync';\nexport { default as cancelAllScheduledNotificationsAsync } from './cancelAllScheduledNotificationsAsync';\nexport { default as getNotificationCategoriesAsync } from './getNotificationCategoriesAsync';\nexport { default as setNotificationCategoryAsync } from './setNotificationCategoryAsync';\nexport { default as deleteNotificationCategoryAsync } from './deleteNotificationCategoryAsync';\nexport { default as getNextTriggerDateAsync } from './getNextTriggerDateAsync';\nexport { default as useLastNotificationResponse } from './useLastNotificationResponse';\nexport { setAutoServerRegistrationEnabledAsync } from './DevicePushTokenAutoRegistration.fx';\nexport { default as registerTaskAsync } from './registerTaskAsync';\nexport { default as unregisterTaskAsync } from './unregisterTaskAsync';\nexport * from './TokenEmitter';\nexport * from './NotificationsEmitter';\nexport * from './NotificationsHandler';\nexport * from './NotificationPermissions';\nexport * from './NotificationChannelGroupManager.types';\nexport * from './NotificationChannelManager.types';\nexport * from './NotificationPermissions.types';\nexport * from './Notifications.types';\nexport * from './Tokens.types';\n"]}
@@ -0,0 +1,2 @@
1
+ export default function unregisterForNotificationsAsync(): Promise<void>;
2
+ //# sourceMappingURL=unregisterForNotificationsAsync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unregisterForNotificationsAsync.d.ts","sourceRoot":"","sources":["../src/unregisterForNotificationsAsync.ts"],"names":[],"mappings":"AAIA,wBAA8B,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7E"}
@@ -0,0 +1,9 @@
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
+ import PushTokenManager from './PushTokenManager';
3
+ export default async function unregisterForNotificationsAsync() {
4
+ if (!PushTokenManager.unregisterForNotificationsAsync) {
5
+ throw new UnavailabilityError('ExpoNotifications', 'unregisterForNotificationsAsync');
6
+ }
7
+ return PushTokenManager.unregisterForNotificationsAsync();
8
+ }
9
+ //# sourceMappingURL=unregisterForNotificationsAsync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unregisterForNotificationsAsync.js","sourceRoot":"","sources":["../src/unregisterForNotificationsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,+BAA+B;IAC3D,IAAI,CAAC,gBAAgB,CAAC,+BAA+B,EAAE;QACrD,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,iCAAiC,CAAC,CAAC;KACvF;IACD,OAAO,gBAAgB,CAAC,+BAA+B,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport PushTokenManager from './PushTokenManager';\n\nexport default async function unregisterForNotificationsAsync(): Promise<void> {\n if (!PushTokenManager.unregisterForNotificationsAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'unregisterForNotificationsAsync');\n }\n return PushTokenManager.unregisterForNotificationsAsync();\n}\n"]}
@@ -45,6 +45,13 @@ EX_EXPORT_METHOD_AS(getDevicePushTokenAsync,
45
45
  });
46
46
  }
47
47
 
48
+ EX_EXPORT_METHOD_AS(unregisterForNotificationsAsync,
49
+ unregisterForNotificationsAsync:(EXPromiseResolveBlock)resolve reject:(EXPromiseRejectBlock)reject)
50
+ {
51
+ [[UIApplication sharedApplication] unregisterForRemoteNotifications];
52
+ resolve(nil);
53
+ }
54
+
48
55
  # pragma mark - EXModuleRegistryConsumer
49
56
 
50
57
  - (void)setModuleRegistry:(EXModuleRegistry *)moduleRegistry
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Notifications module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -37,14 +37,14 @@
37
37
  "preset": "expo-module-scripts/ios"
38
38
  },
39
39
  "dependencies": {
40
- "@expo/config-plugins": "^4.0.14",
40
+ "@expo/config-plugins": "~5.0.0",
41
41
  "@expo/image-utils": "^0.3.18",
42
42
  "@ide/backoff": "^1.0.0",
43
43
  "abort-controller": "^3.0.0",
44
44
  "assert": "^2.0.0",
45
45
  "badgin": "^1.1.5",
46
- "expo-application": "~4.1.0",
47
- "expo-constants": "~13.1.0",
46
+ "expo-application": "~4.2.0",
47
+ "expo-constants": "~13.2.0",
48
48
  "fs-extra": "^9.1.0",
49
49
  "uuid": "^3.4.0"
50
50
  },
@@ -58,5 +58,5 @@
58
58
  "peerDependencies": {
59
59
  "expo": "*"
60
60
  },
61
- "gitHead": "b9d655c1bed682ad8919e071dd923968773f05b5"
61
+ "gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
62
62
  }
@@ -1,14 +1,16 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
2
  export declare type NotificationsPluginProps = {
3
3
  /**
4
- * (Android only) Local path to an image to use as the icon for push notifications.
4
+ * Local path to an image to use as the icon for push notifications.
5
5
  * 96x96 all-white png with transparency. We recommend following
6
6
  * [Google's design guidelines](https://material.io/design/iconography/product-icons.html#design-principles).
7
+ * @platform android
7
8
  */
8
9
  icon?: string;
9
10
  /**
10
- * (Android only) Tint color for the push notification image when it appears in the notification tray.
11
+ * Tint color for the push notification image when it appears in the notification tray.
11
12
  * @default '#ffffff'
13
+ * @platform android
12
14
  */
13
15
  color?: string;
14
16
  /**
@@ -16,8 +18,9 @@ export declare type NotificationsPluginProps = {
16
18
  */
17
19
  sounds?: string[];
18
20
  /**
19
- * (iOS only) Environment of the app: either 'development' or 'production'. Defaults to 'development'.
21
+ * Environment of the app: either 'development' or 'production'.
20
22
  * @default 'development'
23
+ * @platform ios
21
24
  */
22
25
  mode?: 'development' | 'production';
23
26
  };
@@ -7,14 +7,16 @@ const pkg = require('expo-notifications/package.json');
7
7
 
8
8
  export type NotificationsPluginProps = {
9
9
  /**
10
- * (Android only) Local path to an image to use as the icon for push notifications.
10
+ * Local path to an image to use as the icon for push notifications.
11
11
  * 96x96 all-white png with transparency. We recommend following
12
12
  * [Google's design guidelines](https://material.io/design/iconography/product-icons.html#design-principles).
13
+ * @platform android
13
14
  */
14
15
  icon?: string;
15
16
  /**
16
- * (Android only) Tint color for the push notification image when it appears in the notification tray.
17
+ * Tint color for the push notification image when it appears in the notification tray.
17
18
  * @default '#ffffff'
19
+ * @platform android
18
20
  */
19
21
  color?: string;
20
22
  /**
@@ -22,8 +24,9 @@ export type NotificationsPluginProps = {
22
24
  */
23
25
  sounds?: string[];
24
26
  /**
25
- * (iOS only) Environment of the app: either 'development' or 'production'. Defaults to 'development'.
27
+ * Environment of the app: either 'development' or 'production'.
26
28
  * @default 'development'
29
+ * @platform ios
27
30
  */
28
31
  mode?: 'development' | 'production';
29
32
  };
@@ -2,4 +2,5 @@ import { ProxyNativeModule } from 'expo-modules-core';
2
2
 
3
3
  export interface PushTokenManagerModule extends ProxyNativeModule {
4
4
  getDevicePushTokenAsync?: () => Promise<string>;
5
+ unregisterForNotificationsAsync?: () => Promise<void>;
5
6
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';
2
+ export { default as unregisterForNotificationsAsync } from './unregisterForNotificationsAsync';
2
3
  export { default as getExpoPushTokenAsync } from './getExpoPushTokenAsync';
3
4
  export { default as getPresentedNotificationsAsync } from './getPresentedNotificationsAsync';
4
5
  export { default as presentNotificationAsync } from './presentNotificationAsync';
@@ -0,0 +1,10 @@
1
+ import { UnavailabilityError } from 'expo-modules-core';
2
+
3
+ import PushTokenManager from './PushTokenManager';
4
+
5
+ export default async function unregisterForNotificationsAsync(): Promise<void> {
6
+ if (!PushTokenManager.unregisterForNotificationsAsync) {
7
+ throw new UnavailabilityError('ExpoNotifications', 'unregisterForNotificationsAsync');
8
+ }
9
+ return PushTokenManager.unregisterForNotificationsAsync();
10
+ }
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "./build"
6
6
  },
7
7
  "include": ["./src"],
8
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
8
+ "exclude": ["**/__mocks__/*", "**/__tests__/*", "**/__stories__/*"]
9
9
  }