expo-notifications 0.32.9 → 0.32.10

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 (58) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +1 -1
  4. package/android/src/main/java/expo/modules/notifications/notifications/NotificationManager.java +1 -1
  5. package/android/src/main/java/expo/modules/notifications/service/NotificationForwarderActivity.kt +2 -2
  6. package/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt +22 -7
  7. package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoHandlingDelegate.kt +5 -7
  8. package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoNotificationLifecycleListener.java +13 -7
  9. package/android/src/main/java/expo/modules/notifications/service/delegates/SharedPreferencesNotificationCategoriesStore.kt +4 -3
  10. package/build/useLastNotificationResponse.d.ts.map +1 -1
  11. package/build/useLastNotificationResponse.js +3 -8
  12. package/build/useLastNotificationResponse.js.map +1 -1
  13. package/expo-module.config.json +1 -1
  14. package/ios/EXNotifications/Notifications/Categories/CategoriesModule.swift +44 -22
  15. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.9/expo.modules.notifications-0.32.9-sources.jar → 0.32.10/expo.modules.notifications-0.32.10-sources.jar} +0 -0
  16. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10-sources.jar.md5 +1 -0
  17. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10-sources.jar.sha1 +1 -0
  18. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10-sources.jar.sha256 +1 -0
  19. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10-sources.jar.sha512 +1 -0
  20. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.aar +0 -0
  21. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.aar.md5 +1 -0
  22. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.aar.sha1 +1 -0
  23. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.aar.sha256 +1 -0
  24. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.aar.sha512 +1 -0
  25. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.9/expo.modules.notifications-0.32.9.module → 0.32.10/expo.modules.notifications-0.32.10.module} +22 -22
  26. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.module.md5 +1 -0
  27. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.module.sha1 +1 -0
  28. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.module.sha256 +1 -0
  29. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.module.sha512 +1 -0
  30. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/{0.32.9/expo.modules.notifications-0.32.9.pom → 0.32.10/expo.modules.notifications-0.32.10.pom} +1 -1
  31. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.pom.md5 +1 -0
  32. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.pom.sha1 +1 -0
  33. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.pom.sha256 +1 -0
  34. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.10/expo.modules.notifications-0.32.10.pom.sha512 +1 -0
  35. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml +4 -4
  36. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.md5 +1 -1
  37. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha1 +1 -1
  38. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha256 +1 -1
  39. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/maven-metadata.xml.sha512 +1 -1
  40. package/package.json +2 -2
  41. package/src/useLastNotificationResponse.ts +3 -10
  42. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9-sources.jar.md5 +0 -1
  43. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9-sources.jar.sha1 +0 -1
  44. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9-sources.jar.sha256 +0 -1
  45. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9-sources.jar.sha512 +0 -1
  46. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.aar +0 -0
  47. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.aar.md5 +0 -1
  48. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.aar.sha1 +0 -1
  49. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.aar.sha256 +0 -1
  50. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.aar.sha512 +0 -1
  51. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.module.md5 +0 -1
  52. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.module.sha1 +0 -1
  53. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.module.sha256 +0 -1
  54. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.module.sha512 +0 -1
  55. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.pom.md5 +0 -1
  56. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.pom.sha1 +0 -1
  57. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.pom.sha256 +0 -1
  58. package/local-maven-repo/host/exp/exponent/expo.modules.notifications/0.32.9/expo.modules.notifications-0.32.9.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.32.10 — 2025-09-04
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [android] do not send faulty duplicate `TextInputNotificationResponse` events ([#39356](https://github.com/expo/expo/pull/39356) by [@vonovak](https://github.com/vonovak))
18
+ - fix text response not present on some Android versions ([#39350](https://github.com/expo/expo/pull/39350) by [@vonovak](https://github.com/vonovak))
19
+ - [ios] fix race condition in `setNotificationCategoryAsync` ([#39306](https://github.com/expo/expo/pull/39306) by [@vonovak](https://github.com/vonovak))
20
+
13
21
  ## 0.32.9 — 2025-09-03
14
22
 
15
23
  _This version does not introduce any user-facing changes._
@@ -5,13 +5,13 @@ plugins {
5
5
  }
6
6
 
7
7
  group = 'host.exp.exponent'
8
- version = '0.32.9'
8
+ version = '0.32.10'
9
9
 
10
10
  android {
11
11
  namespace "expo.modules.notifications"
12
12
  defaultConfig {
13
13
  versionCode 21
14
- versionName '0.32.9'
14
+ versionName '0.32.10'
15
15
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16
16
  }
17
17
 
@@ -40,7 +40,7 @@ public class NotificationsPackage extends BasePackage {
40
40
 
41
41
  @Override
42
42
  public List<ReactActivityLifecycleListener> createReactActivityLifecycleListeners(Context activityContext) {
43
- return Collections.singletonList(new ExpoNotificationLifecycleListener(activityContext, mNotificationManager));
43
+ return Collections.singletonList(new ExpoNotificationLifecycleListener(mNotificationManager));
44
44
  }
45
45
  }
46
46
 
@@ -138,7 +138,7 @@ public class NotificationManager implements SingletonModule {
138
138
  // OR a background state (ExpoNotificationLifecycleListener::onNewIntent)
139
139
 
140
140
  // If we've just come from a background state, we'll have listeners set up
141
- // pass on the notification to them
141
+ // - pass on the notification to them
142
142
  if (!mListenerReferenceMap.isEmpty()) {
143
143
  for (WeakReference<NotificationListener> listenerReference : mListenerReferenceMap.values()) {
144
144
  NotificationListener listener = listenerReference.get();
@@ -15,8 +15,8 @@ class NotificationForwarderActivity : Activity() {
15
15
  override fun onCreate(savedInstanceState: Bundle?) {
16
16
  super.onCreate(savedInstanceState)
17
17
  val broadcastIntent =
18
- NotificationsService.createNotificationResponseBroadcastIntent(applicationContext, intent.extras)
19
- val notificationResponse = NotificationsService.getNotificationResponseFromBroadcastIntent(broadcastIntent)
18
+ NotificationsService.createNotificationResponseBroadcastIntent(applicationContext, intent)
19
+ val notificationResponse = NotificationsService.getNotificationResponseFromBroadcastIntent(intent)
20
20
  ExpoHandlingDelegate.openAppToForeground(this, notificationResponse)
21
21
  sendBroadcast(broadcastIntent)
22
22
  finish()
@@ -459,8 +459,7 @@ open class NotificationsService : BroadcastReceiver() {
459
459
  // are not allowed. If the notification wants to open foreground app,
460
460
  // we should use the dedicated Activity pendingIntent.
461
461
  if (action.opensAppToForeground() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
462
- val notificationResponse = getNotificationResponseFromBroadcastIntent(intent)
463
- return ExpoHandlingDelegate.createPendingIntentForOpeningApp(context, intent, notificationResponse)
462
+ return ExpoHandlingDelegate.createPendingIntentForOpeningApp(context, intent)
464
463
  }
465
464
 
466
465
  // We're defaulting to the behaviour prior API 31 (mutable) even though Android recommends immutability
@@ -474,17 +473,24 @@ open class NotificationsService : BroadcastReceiver() {
474
473
  }
475
474
 
476
475
  /**
477
- * Recreate an Intent from [createNotificationResponseIntent] extras
476
+ * Recreate an Intent from [createNotificationResponseIntent] intent
478
477
  * for [NotificationForwarderActivity] to send broadcasts
479
478
  */
480
- fun createNotificationResponseBroadcastIntent(context: Context, extras: Bundle?): Intent {
479
+ fun createNotificationResponseBroadcastIntent(context: Context, intent: Intent?): Intent {
480
+ val extras = intent?.extras
481
481
  val notification = extras?.getParcelable<Notification>(NOTIFICATION_KEY)
482
482
  val action = extras?.getParcelable<NotificationAction>(NOTIFICATION_ACTION_KEY)
483
483
  if (notification == null || action == null) {
484
484
  throw IllegalArgumentException("notification ($notification) and action ($action) should not be null")
485
485
  }
486
- val backgroundAction = NotificationAction(action.identifier, action.title, false)
487
- val intent = Intent(
486
+ val textResponse = RemoteInput.getResultsFromIntent(intent)?.getString(USER_TEXT_RESPONSE_KEY)
487
+ val isTextInputResponse = textResponse != null && action is TextInputNotificationAction
488
+ val backgroundAction = if (isTextInputResponse) {
489
+ TextInputNotificationAction(action.identifier, action.title, false, action.placeholder)
490
+ } else {
491
+ NotificationAction(action.identifier, action.title, false)
492
+ }
493
+ val broadcastIntent = Intent(
488
494
  NOTIFICATION_EVENT_ACTION,
489
495
  getUriBuilder()
490
496
  .appendPath(notification.notificationRequest.identifier)
@@ -498,8 +504,17 @@ open class NotificationsService : BroadcastReceiver() {
498
504
  intent.putExtra(EVENT_TYPE_KEY, RECEIVE_RESPONSE_TYPE)
499
505
  intent.putExtra(NOTIFICATION_KEY, notification)
500
506
  intent.putExtra(NOTIFICATION_ACTION_KEY, backgroundAction as Parcelable)
507
+
508
+ // Include the text response in the new intent
509
+ if (isTextInputResponse) {
510
+ val remoteInput = RemoteInput.Builder(USER_TEXT_RESPONSE_KEY).build()
511
+ val remoteInputResults = Bundle().apply {
512
+ putString(USER_TEXT_RESPONSE_KEY, textResponse)
513
+ }
514
+ RemoteInput.addResultsToIntent(arrayOf(remoteInput), intent, remoteInputResults)
515
+ }
501
516
  }
502
- return intent
517
+ return broadcastIntent
503
518
  }
504
519
 
505
520
  fun getNotificationResponseFromBroadcastIntent(intent: Intent): NotificationResponse {
@@ -47,12 +47,10 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
47
47
  }
48
48
 
49
49
  sListenersReferences[listener] = WeakReference(listener)
50
- if (sPendingNotificationResponses.isNotEmpty()) {
51
- val responseIterator = sPendingNotificationResponses.iterator()
52
- while (responseIterator.hasNext()) {
53
- listener.onNotificationResponseReceived(responseIterator.next())
54
- responseIterator.remove()
55
- }
50
+ val responseIterator = sPendingNotificationResponses.iterator()
51
+ while (responseIterator.hasNext()) {
52
+ listener.onNotificationResponseReceived(responseIterator.next())
53
+ responseIterator.remove()
56
54
  }
57
55
  }
58
56
 
@@ -62,7 +60,7 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
62
60
  * - the foreground main Activity
63
61
  * - the background [NotificationForwarderActivity] Activity that send notification clicked events through broadcast
64
62
  */
65
- fun createPendingIntentForOpeningApp(context: Context, broadcastIntent: Intent, notificationResponse: NotificationResponse): PendingIntent {
63
+ fun createPendingIntentForOpeningApp(context: Context, broadcastIntent: Intent): PendingIntent {
66
64
  var intentFlags = PendingIntent.FLAG_UPDATE_CURRENT
67
65
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
68
66
  // The intent may include `RemoteInput` from `TextInputNotificationAction`.
@@ -1,7 +1,9 @@
1
1
  package expo.modules.notifications.service.delegates;
2
2
 
3
+ import static expo.modules.notifications.service.NotificationsService.NOTIFICATION_RESPONSE_KEY;
4
+ import static expo.modules.notifications.service.NotificationsService.TEXT_INPUT_NOTIFICATION_RESPONSE_KEY;
5
+
3
6
  import android.app.Activity;
4
- import android.content.Context;
5
7
  import android.content.Intent;
6
8
  import android.os.Bundle;
7
9
  import android.util.Log;
@@ -10,11 +12,12 @@ import expo.modules.core.interfaces.ReactActivityLifecycleListener;
10
12
  import expo.modules.notifications.notifications.NotificationManager;
11
13
  import expo.modules.notifications.notifications.debug.DebugLogging;
12
14
 
15
+ // TODO vonovak consider removing this class entirely for SDK 55, its purpose is unclear
13
16
  public class ExpoNotificationLifecycleListener implements ReactActivityLifecycleListener {
14
17
 
15
18
  private NotificationManager mNotificationManager;
16
19
 
17
- public ExpoNotificationLifecycleListener(Context context, NotificationManager notificationManager) {
20
+ public ExpoNotificationLifecycleListener(NotificationManager notificationManager) {
18
21
  mNotificationManager = notificationManager;
19
22
  }
20
23
 
@@ -33,8 +36,9 @@ public class ExpoNotificationLifecycleListener implements ReactActivityLifecycle
33
36
  if (intent != null) {
34
37
  Bundle extras = intent.getExtras();
35
38
  if (extras != null) {
36
- if (extras.containsKey("notificationResponse")) {
37
- Log.d("ReactNativeJS", "[native] ExpoNotificationLifecycleListener contains an unmarshaled notification response. Skipping.");
39
+ // only actions that have opensAppToForeground: true are handled here
40
+ if (extras.containsKey(NOTIFICATION_RESPONSE_KEY) || extras.containsKey(TEXT_INPUT_NOTIFICATION_RESPONSE_KEY)) {
41
+ Log.d("ReactNativeJS", "[native] ExpoNotificationLifecycleListener contains an unmarshalled notification response. Skipping.");
38
42
  return;
39
43
  }
40
44
  DebugLogging.logBundle("ExpoNotificationLifeCycleListener.onCreate:", extras);
@@ -56,9 +60,11 @@ public class ExpoNotificationLifecycleListener implements ReactActivityLifecycle
56
60
  public boolean onNewIntent(Intent intent) {
57
61
  Bundle extras = intent.getExtras();
58
62
  if (extras != null) {
59
- if (extras.containsKey("notificationResponse")) {
60
- Log.d("ReactNativeJS", "[native] ExpoNotificationLifecycleListener contains an unmarshaled notification response. Skipping.");
61
- intent.removeExtra("notificationResponse");
63
+ if (extras.containsKey(NOTIFICATION_RESPONSE_KEY) || extras.containsKey(TEXT_INPUT_NOTIFICATION_RESPONSE_KEY)) {
64
+ intent.removeExtra(NOTIFICATION_RESPONSE_KEY);
65
+ intent.removeExtra(TEXT_INPUT_NOTIFICATION_RESPONSE_KEY);
66
+ // response events are already handled by
67
+ // NotificationForwarderActivity -> NotificationsService.onReceiveNotificationResponse -> NotificationEmitter.onNotificationResponseReceived
62
68
  return ReactActivityLifecycleListener.super.onNewIntent(intent);
63
69
  }
64
70
  DebugLogging.logBundle("ExpoNotificationLifeCycleListener.onNewIntent:", extras);
@@ -86,14 +86,15 @@ class SharedPreferencesNotificationCategoriesStore(context: Context) {
86
86
  * @return Return true if category was deleted, false if not.
87
87
  */
88
88
  fun removeNotificationCategory(identifier: String): Boolean {
89
+ val id = preferencesNotificationCategoryKey(identifier)
89
90
  sharedPreferences.getString(
90
- preferencesNotificationCategoryKey(identifier),
91
+ id,
91
92
  null
92
- ).let { if (it == null) return false }
93
+ ) ?: return false
93
94
 
94
95
  return sharedPreferences
95
96
  .edit()
96
- .remove(preferencesNotificationCategoryKey(identifier))
97
+ .remove(id)
97
98
  .commit()
98
99
  }
99
100
 
@@ -1 +1 @@
1
- {"version":3,"file":"useLastNotificationResponse.d.ts","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAOxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B,8BA+BlD;AAKD,eAAO,MAAM,qBAAqB,GAChC,cAAc,yBAAyB,EACvC,aAAa,oBAAoB,GAAG,IAAI,gCAYzC,CAAC"}
1
+ {"version":3,"file":"useLastNotificationResponse.d.ts","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAOxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B,8BAwBlD;AAKD,eAAO,MAAM,qBAAqB,GAChC,cAAc,yBAAyB,EACvC,aAAa,oBAAoB,GAAG,IAAI,gCAYzC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { useLayoutEffect, useState } from 'react';
2
- import { addNotificationResponseReceivedListener, addNotificationResponseClearedListener, getLastNotificationResponseAsync, } from './NotificationsEmitter';
2
+ import { addNotificationResponseReceivedListener, addNotificationResponseClearedListener, getLastNotificationResponse, } from './NotificationsEmitter';
3
3
  /**
4
4
  * A React hook which returns the notification response that was received most recently
5
5
  * (a notification response designates an interaction with a notification, such as tapping on it).
@@ -42,20 +42,15 @@ export default function useLastNotificationResponse() {
42
42
  const [lastNotificationResponse, setLastNotificationResponse] = useState(undefined);
43
43
  // useLayoutEffect ensures the listener is registered as soon as possible
44
44
  useLayoutEffect(() => {
45
- let isMounted = true;
46
45
  // Get the last response first, in case it was set earlier (even in native code on startup)
47
- getLastNotificationResponseAsync().then((response) => {
48
- if (isMounted) {
49
- setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response));
50
- }
51
- });
46
+ const response = getLastNotificationResponse();
47
+ setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response));
52
48
  // Set up listener for responses that come in, and set the last response if needed
53
49
  const subscription = addNotificationResponseReceivedListener((response) => setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response)));
54
50
  const clearResponseSubscription = addNotificationResponseClearedListener(() => {
55
51
  setLastNotificationResponse(null);
56
52
  });
57
53
  return () => {
58
- isMounted = false;
59
54
  subscription.remove();
60
55
  clearResponseSubscription.remove();
61
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLastNotificationResponse.js","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EACL,uCAAuC,EACvC,sCAAsC,EACtC,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B;IACjD,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,GAC3D,QAAQ,CAA4B,SAAS,CAAC,CAAC;IAEjD,yEAAyE;IACzE,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,2FAA2F;QAC3F,gCAAgC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnD,IAAI,SAAS,EAAE,CAAC;gBACd,2BAA2B,CAAC,CAAC,YAAY,EAAE,EAAE,CAC3C,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAC9C,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,kFAAkF;QAClF,MAAM,YAAY,GAAG,uCAAuC,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxE,2BAA2B,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAC7F,CAAC;QACF,MAAM,yBAAyB,GAAG,sCAAsC,CAAC,GAAG,EAAE;YAC5E,2BAA2B,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;YAClB,YAAY,CAAC,MAAM,EAAE,CAAC;YACtB,yBAAyB,CAAC,MAAM,EAAE,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,iEAAiE;AACjE,uFAAuF;AACvF,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,YAAuC,EACvC,WAAwC,EACxC,EAAE;IACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QACjD,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QAC3C,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nimport { MaybeNotificationResponse, NotificationResponse } from './Notifications.types';\nimport {\n addNotificationResponseReceivedListener,\n addNotificationResponseClearedListener,\n getLastNotificationResponseAsync,\n} from './NotificationsEmitter';\n\n/**\n * A React hook which returns the notification response that was received most recently\n * (a notification response designates an interaction with a notification, such as tapping on it).\n *\n * To clear the last notification response, use [`clearLastNotificationResponseAsync()`](#notificationsclearlastnotificationresponseasync).\n *\n * > If you don't want to use a hook, you can use `Notifications.getLastNotificationResponseAsync()` instead.\n *\n * @return The hook may return one of these three types/values:\n * - `undefined` - until we're sure of what to return,\n * - `null` - if no notification response has been received yet,\n * - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.\n *\n * @example\n * Responding to a notification tap by opening a URL that could be put into the notification's `data`\n * (opening the URL is your responsibility and is not a part of the `expo-notifications` API):\n * ```jsx\n * import * as Notifications from 'expo-notifications';\n * import { Linking } from 'react-native';\n *\n * export default function App() {\n * const lastNotificationResponse = Notifications.useLastNotificationResponse();\n * React.useEffect(() => {\n * if (\n * lastNotificationResponse &&\n * lastNotificationResponse.notification.request.content.data.url &&\n * lastNotificationResponse.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER\n * ) {\n * Linking.openURL(lastNotificationResponse.notification.request.content.data.url);\n * }\n * }, [lastNotificationResponse]);\n * return (\n * // Your app content\n * );\n * }\n * ```\n * @header listen\n */\nexport default function useLastNotificationResponse() {\n const [lastNotificationResponse, setLastNotificationResponse] =\n useState<MaybeNotificationResponse>(undefined);\n\n // useLayoutEffect ensures the listener is registered as soon as possible\n useLayoutEffect(() => {\n let isMounted = true;\n // Get the last response first, in case it was set earlier (even in native code on startup)\n getLastNotificationResponseAsync().then((response) => {\n if (isMounted) {\n setLastNotificationResponse((prevResponse) =>\n determineNextResponse(prevResponse, response)\n );\n }\n });\n\n // Set up listener for responses that come in, and set the last response if needed\n const subscription = addNotificationResponseReceivedListener((response) =>\n setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response))\n );\n const clearResponseSubscription = addNotificationResponseClearedListener(() => {\n setLastNotificationResponse(null);\n });\n return () => {\n isMounted = false;\n subscription.remove();\n clearResponseSubscription.remove();\n };\n }, []);\n\n return lastNotificationResponse;\n}\n\n// returns the new response if it is different from the previous,\n// also has to return undefined until we're sure of what to return (null or a response)\n// the transition from response to null is invalid\nexport const determineNextResponse = (\n prevResponse: MaybeNotificationResponse,\n newResponse: NotificationResponse | null\n) => {\n if (!newResponse) {\n return null;\n }\n if (!prevResponse) {\n return newResponse;\n }\n return prevResponse.notification.request.identifier !==\n newResponse.notification.request.identifier\n ? newResponse\n : prevResponse;\n};\n"]}
1
+ {"version":3,"file":"useLastNotificationResponse.js","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EACL,uCAAuC,EACvC,sCAAsC,EACtC,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B;IACjD,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,GAC3D,QAAQ,CAA4B,SAAS,CAAC,CAAC;IAEjD,yEAAyE;IACzE,eAAe,CAAC,GAAG,EAAE;QACnB,2FAA2F;QAC3F,MAAM,QAAQ,GAAG,2BAA2B,EAAE,CAAC;QAC/C,2BAA2B,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE7F,kFAAkF;QAClF,MAAM,YAAY,GAAG,uCAAuC,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxE,2BAA2B,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAC7F,CAAC;QACF,MAAM,yBAAyB,GAAG,sCAAsC,CAAC,GAAG,EAAE;YAC5E,2BAA2B,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,MAAM,EAAE,CAAC;YACtB,yBAAyB,CAAC,MAAM,EAAE,CAAC;QACrC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,iEAAiE;AACjE,uFAAuF;AACvF,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,YAAuC,EACvC,WAAwC,EACxC,EAAE;IACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QACjD,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU;QAC3C,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,YAAY,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\nimport { MaybeNotificationResponse, NotificationResponse } from './Notifications.types';\nimport {\n addNotificationResponseReceivedListener,\n addNotificationResponseClearedListener,\n getLastNotificationResponse,\n} from './NotificationsEmitter';\n\n/**\n * A React hook which returns the notification response that was received most recently\n * (a notification response designates an interaction with a notification, such as tapping on it).\n *\n * To clear the last notification response, use [`clearLastNotificationResponseAsync()`](#notificationsclearlastnotificationresponseasync).\n *\n * > If you don't want to use a hook, you can use `Notifications.getLastNotificationResponseAsync()` instead.\n *\n * @return The hook may return one of these three types/values:\n * - `undefined` - until we're sure of what to return,\n * - `null` - if no notification response has been received yet,\n * - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.\n *\n * @example\n * Responding to a notification tap by opening a URL that could be put into the notification's `data`\n * (opening the URL is your responsibility and is not a part of the `expo-notifications` API):\n * ```jsx\n * import * as Notifications from 'expo-notifications';\n * import { Linking } from 'react-native';\n *\n * export default function App() {\n * const lastNotificationResponse = Notifications.useLastNotificationResponse();\n * React.useEffect(() => {\n * if (\n * lastNotificationResponse &&\n * lastNotificationResponse.notification.request.content.data.url &&\n * lastNotificationResponse.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER\n * ) {\n * Linking.openURL(lastNotificationResponse.notification.request.content.data.url);\n * }\n * }, [lastNotificationResponse]);\n * return (\n * // Your app content\n * );\n * }\n * ```\n * @header listen\n */\nexport default function useLastNotificationResponse() {\n const [lastNotificationResponse, setLastNotificationResponse] =\n useState<MaybeNotificationResponse>(undefined);\n\n // useLayoutEffect ensures the listener is registered as soon as possible\n useLayoutEffect(() => {\n // Get the last response first, in case it was set earlier (even in native code on startup)\n const response = getLastNotificationResponse();\n setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response));\n\n // Set up listener for responses that come in, and set the last response if needed\n const subscription = addNotificationResponseReceivedListener((response) =>\n setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response))\n );\n const clearResponseSubscription = addNotificationResponseClearedListener(() => {\n setLastNotificationResponse(null);\n });\n return () => {\n subscription.remove();\n clearResponseSubscription.remove();\n };\n }, []);\n\n return lastNotificationResponse;\n}\n\n// returns the new response if it is different from the previous,\n// also has to return undefined until we're sure of what to return (null or a response)\n// the transition from response to null is invalid\nexport const determineNextResponse = (\n prevResponse: MaybeNotificationResponse,\n newResponse: NotificationResponse | null\n) => {\n if (!newResponse) {\n return null;\n }\n if (!prevResponse) {\n return newResponse;\n }\n return prevResponse.notification.request.identifier !==\n newResponse.notification.request.identifier\n ? newResponse\n : prevResponse;\n};\n"]}
@@ -33,7 +33,7 @@
33
33
  "publication": {
34
34
  "groupId": "host.exp.exponent",
35
35
  "artifactId": "expo.modules.notifications",
36
- "version": "0.32.9",
36
+ "version": "0.32.10",
37
37
  "repository": "local-maven-repo"
38
38
  }
39
39
  }
@@ -2,9 +2,50 @@
2
2
 
3
3
  import ExpoModulesCore
4
4
  import UIKit
5
- import MachO
5
+
6
+ actor CategoryManager {
7
+ private var categories: Set<UNNotificationCategory>?
8
+
9
+ func setCategory(identifier: String, actions: [CategoryActionRecord], options: CategoryOptionsRecord?) async -> CategoryRecord {
10
+ let categoryRecord = CategoryRecord(identifier, actions: actions, options: options)
11
+ let newCategory = categoryRecord.toUNNotificationCategory()
12
+
13
+ let current = await loadCategories()
14
+ let updated = current.filter { $0.identifier != identifier }.union([newCategory])
15
+
16
+ await updateCategories(updated)
17
+ return CategoryRecord(newCategory)
18
+ }
19
+
20
+ func deleteCategory(identifier: String) async -> Bool {
21
+ let current = await loadCategories()
22
+ let exists = current.contains { $0.identifier == identifier }
23
+
24
+ if exists {
25
+ let updated = current.filter { $0.identifier != identifier }
26
+ await updateCategories(updated)
27
+ }
28
+ return exists
29
+ }
30
+
31
+ private func loadCategories() async -> Set<UNNotificationCategory> {
32
+ if let cached = categories {
33
+ return cached
34
+ }
35
+ let fresh = await UNUserNotificationCenter.current().notificationCategories()
36
+ categories = fresh
37
+ return fresh
38
+ }
39
+
40
+ private func updateCategories(_ newCategories: Set<UNNotificationCategory>) async {
41
+ categories = newCategories
42
+ UNUserNotificationCenter.current().setNotificationCategories(newCategories)
43
+ }
44
+ }
6
45
 
7
46
  open class CategoriesModule: Module {
47
+ private let categoryManager = CategoryManager()
48
+
8
49
  public func definition() -> ModuleDefinition {
9
50
  Name("ExpoNotificationCategoriesModule")
10
51
 
@@ -27,29 +68,10 @@ open class CategoriesModule: Module {
27
68
  }
28
69
 
29
70
  open func setNotificationCategoryAsync(identifier: String, actions: [CategoryActionRecord], options: CategoryOptionsRecord?) async -> CategoryRecord {
30
- let categoryRecord = CategoryRecord(identifier, actions: actions, options: options)
31
- let newNotificationCategory = categoryRecord.toUNNotificationCategory()
32
- let oldCategories = await UNUserNotificationCenter.current().notificationCategories()
33
- let newCategories = oldCategories
34
- .filter { oldCategory in
35
- return oldCategory.identifier != newNotificationCategory.identifier
36
- }
37
- .union([newNotificationCategory])
38
- UNUserNotificationCenter.current().setNotificationCategories(newCategories)
39
- return CategoryRecord(newNotificationCategory)
71
+ return await categoryManager.setCategory(identifier: identifier, actions: actions, options: options)
40
72
  }
41
73
 
42
74
  open func deleteNotificationCategoryAsync(identifier: String) async -> Bool {
43
- let oldCategories = await UNUserNotificationCenter.current().notificationCategories()
44
- let didDelete = oldCategories.contains { oldCategory in
45
- return oldCategory.identifier == identifier
46
- }
47
- if didDelete {
48
- let newCategories = oldCategories.filter { oldCategory in
49
- return oldCategory.identifier != identifier
50
- }
51
- UNUserNotificationCenter.current().setNotificationCategories(newCategories)
52
- }
53
- return didDelete
75
+ return await categoryManager.deleteCategory(identifier: identifier)
54
76
  }
55
77
  }
@@ -0,0 +1 @@
1
+ 2674c7c733ba0f80e0d2b10696cc21141756c0d32100db7c96c942573bc9afde
@@ -0,0 +1 @@
1
+ 3f440b5ad0a2bc1e931aeee41a90e73a01fcfb49151052c2dda06d7fee844fa89e0279562e931009ccc6d4dcc21b3da0d3c9d8eba0a9dc9c04771570d79845fd
@@ -0,0 +1 @@
1
+ c6dac23e57a51b3cc5a8eee7fa9c92609b5d0d589855a505facf196bd88e9960
@@ -0,0 +1 @@
1
+ a8ec19c21f69061ccc18cb0b9f51759d5d2f5c1129b1e44da4b803b68e5d83c273e8e4ea5952032abff13c052901e481f013e78588b969ce98a3d995b77f47d6
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "host.exp.exponent",
5
5
  "module": "expo.modules.notifications",
6
- "version": "0.32.9",
6
+ "version": "0.32.10",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.notifications-0.32.9.aar",
28
- "url": "expo.modules.notifications-0.32.9.aar",
29
- "size": 384715,
30
- "sha512": "dd3f365bfd6ea662007e58b2df8b583ead5049a7726370228835a1a29ba6a858baba658394549d4486d73356f5f97e42fad69b5162c1ffb75abc84f1a103b78a",
31
- "sha256": "2918ed670b2d8a6559325a6ec9a19b4ab43e9e243f09e72e074272f8ce11f79f",
32
- "sha1": "301978a4d3a0d5814ed31ee5854e1f7b761828f0",
33
- "md5": "52fa7e73f05ec9e24c3d535e5d886097"
27
+ "name": "expo.modules.notifications-0.32.10.aar",
28
+ "url": "expo.modules.notifications-0.32.10.aar",
29
+ "size": 385096,
30
+ "sha512": "a8ec19c21f69061ccc18cb0b9f51759d5d2f5c1129b1e44da4b803b68e5d83c273e8e4ea5952032abff13c052901e481f013e78588b969ce98a3d995b77f47d6",
31
+ "sha256": "c6dac23e57a51b3cc5a8eee7fa9c92609b5d0d589855a505facf196bd88e9960",
32
+ "sha1": "5c565e1fa875b0701c63da5bae4af5937b877cf9",
33
+ "md5": "c4b4a629ef9cdef938237bf679c40543"
34
34
  }
35
35
  ]
36
36
  },
@@ -122,13 +122,13 @@
122
122
  ],
123
123
  "files": [
124
124
  {
125
- "name": "expo.modules.notifications-0.32.9.aar",
126
- "url": "expo.modules.notifications-0.32.9.aar",
127
- "size": 384715,
128
- "sha512": "dd3f365bfd6ea662007e58b2df8b583ead5049a7726370228835a1a29ba6a858baba658394549d4486d73356f5f97e42fad69b5162c1ffb75abc84f1a103b78a",
129
- "sha256": "2918ed670b2d8a6559325a6ec9a19b4ab43e9e243f09e72e074272f8ce11f79f",
130
- "sha1": "301978a4d3a0d5814ed31ee5854e1f7b761828f0",
131
- "md5": "52fa7e73f05ec9e24c3d535e5d886097"
125
+ "name": "expo.modules.notifications-0.32.10.aar",
126
+ "url": "expo.modules.notifications-0.32.10.aar",
127
+ "size": 385096,
128
+ "sha512": "a8ec19c21f69061ccc18cb0b9f51759d5d2f5c1129b1e44da4b803b68e5d83c273e8e4ea5952032abff13c052901e481f013e78588b969ce98a3d995b77f47d6",
129
+ "sha256": "c6dac23e57a51b3cc5a8eee7fa9c92609b5d0d589855a505facf196bd88e9960",
130
+ "sha1": "5c565e1fa875b0701c63da5bae4af5937b877cf9",
131
+ "md5": "c4b4a629ef9cdef938237bf679c40543"
132
132
  }
133
133
  ]
134
134
  },
@@ -142,13 +142,13 @@
142
142
  },
143
143
  "files": [
144
144
  {
145
- "name": "expo.modules.notifications-0.32.9-sources.jar",
146
- "url": "expo.modules.notifications-0.32.9-sources.jar",
147
- "size": 99056,
148
- "sha512": "ce65caf6c6c6799c26cb74b2ee722de501f6986071018c0da85f79f28858422ae8eff86db05b1e636ab06ec1dbe5bceac32822f83fa5eeded137d2d37a4df78d",
149
- "sha256": "84d1daa174a334cbd2ab7b2a2ba13fc31b92d6168fef0a820478e277549fa067",
150
- "sha1": "524f042843a88a52038a6d375f8ac39cc8850c0d",
151
- "md5": "655ab013d290da813256f46fa63886df"
145
+ "name": "expo.modules.notifications-0.32.10-sources.jar",
146
+ "url": "expo.modules.notifications-0.32.10-sources.jar",
147
+ "size": 99407,
148
+ "sha512": "3f440b5ad0a2bc1e931aeee41a90e73a01fcfb49151052c2dda06d7fee844fa89e0279562e931009ccc6d4dcc21b3da0d3c9d8eba0a9dc9c04771570d79845fd",
149
+ "sha256": "2674c7c733ba0f80e0d2b10696cc21141756c0d32100db7c96c942573bc9afde",
150
+ "sha1": "c04acc3b1369624a875d78158cd92ab7fc941043",
151
+ "md5": "26b870ecb6040de42f6cfa1a5caad419"
152
152
  }
153
153
  ]
154
154
  }
@@ -0,0 +1 @@
1
+ 2353e11b5b8fc9c21166a68c6490961c5abc43874c3da77f494133dd8dcc21af
@@ -0,0 +1 @@
1
+ a86b279c1eab02a3382154b06e50543948c5edbdf8350803f3f2b5b1618e76fd84af1e6d06cfd1a9e0d5fb6daebe9295cfbfd2af5bd0e3f489b70e147b064df0
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>host.exp.exponent</groupId>
11
11
  <artifactId>expo.modules.notifications</artifactId>
12
- <version>0.32.9</version>
12
+ <version>0.32.10</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.notifications</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ dcabdfd231bd3d54182ba6554c083403ab2aafd852c6ba47c6241ef3e7f857af
@@ -0,0 +1 @@
1
+ 623abc05f2c226d6271b473e8138e434535d2a048914407e3c10bd00eee51378a72ed0168ed472ca4b4e7f3ccdafd771786b3d390b387640ba776a10ba5f1ce5
@@ -3,11 +3,11 @@
3
3
  <groupId>host.exp.exponent</groupId>
4
4
  <artifactId>expo.modules.notifications</artifactId>
5
5
  <versioning>
6
- <latest>0.32.9</latest>
7
- <release>0.32.9</release>
6
+ <latest>0.32.10</latest>
7
+ <release>0.32.10</release>
8
8
  <versions>
9
- <version>0.32.9</version>
9
+ <version>0.32.10</version>
10
10
  </versions>
11
- <lastUpdated>20250903164526</lastUpdated>
11
+ <lastUpdated>20250904150716</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 3f391cd560ef3b0e6561e15a7d8c7579
1
+ f5cccbdbadcd05e8343da91c2aa159c1
@@ -1 +1 @@
1
- a4f5078e868563c638d1f080798c9ee207d77dff
1
+ 284ea1c8d695572042781f8ee706d05297c08ea9
@@ -1 +1 @@
1
- 7b5e7e3acc2a83ec95ea1a5a73037609d1f8cf999d799d7d51bdc4327c7a9300
1
+ cc18c499eec7aad75f89d85d3c12116b611926b1105038f90b35677cc52abb66
@@ -1 +1 @@
1
- 7b6caaa16e9b26fbbf8fbaf607206fa8563704f919bdaaffe3c12c251d86fdc054e67fa851ffb89dbcd951584a225b2beb4bd2be1ff2f6c7e4643b296173447f
1
+ e55df80ff094762f9465a36624f6d8d3b31311b3c74124df878c6310ceb096021032759458027fd3239970dfd1d14fd15142a700c1ceba407e5cb92ff3eb2732
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.32.9",
3
+ "version": "0.32.10",
4
4
  "description": "Provides an API to fetch push notification tokens and to present, schedule, receive, and respond to notifications.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -59,5 +59,5 @@
59
59
  "react": "*",
60
60
  "react-native": "*"
61
61
  },
62
- "gitHead": "f97e6d1cae0cb14d5eed1b08fad6d12a7144af3a"
62
+ "gitHead": "8cafaff8076e443e6c80e8013ec809f4f290f24d"
63
63
  }
@@ -4,7 +4,7 @@ import { MaybeNotificationResponse, NotificationResponse } from './Notifications
4
4
  import {
5
5
  addNotificationResponseReceivedListener,
6
6
  addNotificationResponseClearedListener,
7
- getLastNotificationResponseAsync,
7
+ getLastNotificationResponse,
8
8
  } from './NotificationsEmitter';
9
9
 
10
10
  /**
@@ -51,15 +51,9 @@ export default function useLastNotificationResponse() {
51
51
 
52
52
  // useLayoutEffect ensures the listener is registered as soon as possible
53
53
  useLayoutEffect(() => {
54
- let isMounted = true;
55
54
  // Get the last response first, in case it was set earlier (even in native code on startup)
56
- getLastNotificationResponseAsync().then((response) => {
57
- if (isMounted) {
58
- setLastNotificationResponse((prevResponse) =>
59
- determineNextResponse(prevResponse, response)
60
- );
61
- }
62
- });
55
+ const response = getLastNotificationResponse();
56
+ setLastNotificationResponse((prevResponse) => determineNextResponse(prevResponse, response));
63
57
 
64
58
  // Set up listener for responses that come in, and set the last response if needed
65
59
  const subscription = addNotificationResponseReceivedListener((response) =>
@@ -69,7 +63,6 @@ export default function useLastNotificationResponse() {
69
63
  setLastNotificationResponse(null);
70
64
  });
71
65
  return () => {
72
- isMounted = false;
73
66
  subscription.remove();
74
67
  clearResponseSubscription.remove();
75
68
  };
@@ -1 +0,0 @@
1
- 84d1daa174a334cbd2ab7b2a2ba13fc31b92d6168fef0a820478e277549fa067
@@ -1 +0,0 @@
1
- ce65caf6c6c6799c26cb74b2ee722de501f6986071018c0da85f79f28858422ae8eff86db05b1e636ab06ec1dbe5bceac32822f83fa5eeded137d2d37a4df78d
@@ -1 +0,0 @@
1
- 2918ed670b2d8a6559325a6ec9a19b4ab43e9e243f09e72e074272f8ce11f79f
@@ -1 +0,0 @@
1
- dd3f365bfd6ea662007e58b2df8b583ead5049a7726370228835a1a29ba6a858baba658394549d4486d73356f5f97e42fad69b5162c1ffb75abc84f1a103b78a
@@ -1 +0,0 @@
1
- 2ac834917442a0d3450cd9c2ae94e171c0beb53b198c2abb8e2a273ab616a7a6
@@ -1 +0,0 @@
1
- 88602c37ec9e12e0ae8462e828be1b72b6c209a301c1d7c25db1c4a43e2512405fc974faf8c21924015f4f48b4cbee872f9132e85736a50d6c5a77f212ced664
@@ -1 +0,0 @@
1
- ba73e3855d6a482419c3d849d64a0d55644f0b57ef4248bf27d90cd83257d362
@@ -1 +0,0 @@
1
- c8f373d376f65f0375bb50d84a706ba42a088dcc3ba503c394998e688db237929e5c565436a27e92a40a813d1c095575fdb824e16a60e2128cbd0efbf7e0ac0c