react-native-notify-kit 10.3.0 → 10.3.1

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 (19) hide show
  1. package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +1 -3
  2. package/android/src/main/kotlin/io/invertase/notifee/NotifeeApiModule.kt +2 -1
  3. package/android/src/test/java/app/notifee/core/NotifeeAlarmManagerCurrentBehaviorTest.java +3 -3
  4. package/android/src/test/java/app/notifee/core/NotificationManagerCreateTriggerNotificationCurrentBehaviorTest.java +12 -6
  5. package/android/src/test/java/app/notifee/core/NotificationManagerPressActionOptOutTest.java +2 -1
  6. package/android/src/test/java/app/notifee/core/NotificationReceiverHandlerInitialNotificationTest.java +2 -1
  7. package/android/src/test/java/app/notifee/core/model/ChannelModelTest.java +5 -4
  8. package/android/src/test/java/app/notifee/core/model/IntervalTriggerModelTest.java +2 -1
  9. package/android/src/test/java/app/notifee/core/model/NotificationAndroidModelTest.java +5 -4
  10. package/android/src/test/java/app/notifee/core/model/NotificationAndroidStyleModelTest.java +4 -3
  11. package/android/src/test/java/app/notifee/core/utility/BundleValueReaderTest.java +2 -1
  12. package/android/src/test/java/app/notifee/core/utility/ObjectUtilsTest.java +1 -2
  13. package/android/src/test/java/io/invertase/notifee/HeadlessTaskReactHostTest.java +6 -5
  14. package/android/src/test/java/io/invertase/notifee/NotifeeEventSubscriberRoutingTest.java +19 -10
  15. package/android/src/test/java/io/invertase/notifee/NotifeeReactUtilsDrawerTest.java +1 -1
  16. package/dist/version.d.ts +1 -1
  17. package/dist/version.js +1 -1
  18. package/package.json +1 -1
  19. package/src/version.ts +1 -1
@@ -471,9 +471,7 @@ public class NotificationAndroidModel {
471
471
 
472
472
  int importance =
473
473
  BundleValueReader.getIntPreserving(
474
- mNotificationAndroidBundle,
475
- "importance",
476
- NotificationManagerCompat.IMPORTANCE_DEFAULT);
474
+ mNotificationAndroidBundle, "importance", NotificationManagerCompat.IMPORTANCE_DEFAULT);
477
475
  switch (importance) {
478
476
  case NotificationManagerCompat.IMPORTANCE_HIGH:
479
477
  return NotificationCompat.PRIORITY_HIGH;
@@ -9,6 +9,7 @@ import android.os.Build
9
9
  import android.os.Bundle
10
10
  import app.notifee.core.Logger
11
11
  import app.notifee.core.Notifee
12
+ import app.notifee.core.WarmupHelper
12
13
  import com.facebook.react.bridge.Arguments
13
14
  import com.facebook.react.bridge.Promise
14
15
  import com.facebook.react.bridge.ReactApplicationContext
@@ -331,7 +332,7 @@ class NotifeeApiModule(reactContext: ReactApplicationContext) :
331
332
  executor.submit {
332
333
  android.os.Trace.beginSection("notifee:prewarm")
333
334
  try {
334
- app.notifee.core.WarmupHelper.runWarmup(context)
335
+ WarmupHelper.runWarmup(context)
335
336
  promise.resolve(null)
336
337
  } catch (t: Throwable) {
337
338
  // Best-effort semantics: warmup failures don't reject the promise.
@@ -199,7 +199,8 @@ public class NotifeeAlarmManagerCurrentBehaviorTest {
199
199
 
200
200
  @Test
201
201
  public void rescheduleNotification_otherInteger_completesWithoutRoomUpdate() throws Exception {
202
- runRescheduleNotificationExpectingNoUpdate(rescheduleTriggerWithType(Integer.valueOf(99), true));
202
+ runRescheduleNotificationExpectingNoUpdate(
203
+ rescheduleTriggerWithType(Integer.valueOf(99), true));
203
204
  }
204
205
 
205
206
  @Test
@@ -256,8 +257,7 @@ public class NotifeeAlarmManagerCurrentBehaviorTest {
256
257
  String id = "am-type-reboot-" + suffix;
257
258
  Bundle triggerBundle = rescheduleTriggerWithType(typeValue, true);
258
259
  seedDisplayRow(id, triggerBundle);
259
- long originalTimestamp =
260
- triggerTimestamp(repo.getWorkDataById(id).get(5, TimeUnit.SECONDS));
260
+ long originalTimestamp = triggerTimestamp(repo.getWorkDataById(id).get(5, TimeUnit.SECONDS));
261
261
 
262
262
  runRescheduleNotificationsFromRoom();
263
263
 
@@ -63,7 +63,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
63
63
  public void createTriggerNotification_missingType_dispatchesTimestampBranch() throws Exception {
64
64
  Bundle triggerBundle = new Bundle();
65
65
 
66
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
66
+ assertCompletes(
67
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
67
68
 
68
69
  verifyTimestampBranch(triggerBundle);
69
70
  verifyIntervalBranchNeverCalled();
@@ -75,7 +76,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
75
76
  Bundle triggerBundle = new Bundle();
76
77
  triggerBundle.putString("type", null);
77
78
 
78
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
79
+ assertCompletes(
80
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
79
81
 
80
82
  verifyTimestampBranch(triggerBundle);
81
83
  verifyIntervalBranchNeverCalled();
@@ -85,7 +87,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
85
87
  public void createTriggerNotification_integerZero_dispatchesTimestampBranch() throws Exception {
86
88
  Bundle triggerBundle = triggerBundleWithType(Integer.valueOf(0));
87
89
 
88
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
90
+ assertCompletes(
91
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
89
92
 
90
93
  verifyTimestampBranch(triggerBundle);
91
94
  verifyIntervalBranchNeverCalled();
@@ -95,7 +98,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
95
98
  public void createTriggerNotification_integerOne_dispatchesIntervalBranch() throws Exception {
96
99
  Bundle triggerBundle = triggerBundleWithType(Integer.valueOf(1));
97
100
 
98
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
101
+ assertCompletes(
102
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
99
103
 
100
104
  verifyIntervalBranch(triggerBundle);
101
105
  verifyTimestampBranchNeverCalled();
@@ -105,7 +109,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
105
109
  public void createTriggerNotification_otherInteger_completesWithoutScheduling() throws Exception {
106
110
  Bundle triggerBundle = triggerBundleWithType(Integer.valueOf(99));
107
111
 
108
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
112
+ assertCompletes(
113
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
109
114
 
110
115
  verifyTimestampBranchNeverCalled();
111
116
  verifyIntervalBranchNeverCalled();
@@ -115,7 +120,8 @@ public class NotificationManagerCreateTriggerNotificationCurrentBehaviorTest {
115
120
  public void createTriggerNotification_doubleType_truncatesBeforeDispatch() throws Exception {
116
121
  Bundle triggerBundle = triggerBundleWithType(Double.valueOf(1.9d));
117
122
 
118
- assertCompletes(NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
123
+ assertCompletes(
124
+ NotificationManager.createTriggerNotification(notificationModel, triggerBundle));
119
125
 
120
126
  verifyIntervalBranch(triggerBundle);
121
127
  verifyTimestampBranchNeverCalled();
@@ -106,7 +106,8 @@ public class NotificationManagerPressActionOptOutTest {
106
106
 
107
107
  private static Notification displayNotification(NotificationModel notificationModel)
108
108
  throws Exception {
109
- ListenableFuture<Void> future = NotificationManager.displayNotification(notificationModel, null);
109
+ ListenableFuture<Void> future =
110
+ NotificationManager.displayNotification(notificationModel, null);
110
111
  future.get(5, TimeUnit.SECONDS);
111
112
 
112
113
  Context context = RuntimeEnvironment.getApplication();
@@ -92,7 +92,8 @@ public class NotificationReceiverHandlerInitialNotificationTest {
92
92
  assertNotNull(
93
93
  "Android 12+ handler currently posts InitialNotificationEvent for no-launch ACTION_PRESS",
94
94
  initialNotificationEvent);
95
- assertEquals("handler-action-no-launch", initialNotificationEvent.getNotificationModel().getId());
95
+ assertEquals(
96
+ "handler-action-no-launch", initialNotificationEvent.getNotificationModel().getId());
96
97
  assertPressAction(initialNotificationEvent.getExtras(), "reply", null, null);
97
98
  }
98
99
 
@@ -33,7 +33,8 @@ public class ChannelModelTest {
33
33
  integerBundle.putInt("visibility", NotificationCompat.VISIBILITY_SECRET);
34
34
  ChannelModel integerModel = ChannelModel.fromBundle(integerBundle);
35
35
 
36
- assertEquals(NotificationManagerCompat.IMPORTANCE_HIGH, integerModel.getImportance().intValue());
36
+ assertEquals(
37
+ NotificationManagerCompat.IMPORTANCE_HIGH, integerModel.getImportance().intValue());
37
38
  assertEquals(NotificationCompat.VISIBILITY_SECRET, integerModel.getVisibility());
38
39
 
39
40
  Bundle doubleBundle = new Bundle();
@@ -83,7 +84,8 @@ public class ChannelModelTest {
83
84
  Bundle validBundle = new Bundle();
84
85
  putRawParcelableArrayList(validBundle, "vibrationPattern", vibrationPattern);
85
86
 
86
- assertArrayEquals(new long[] {100L, 200L}, ChannelModel.fromBundle(validBundle).getVibrationPattern());
87
+ assertArrayEquals(
88
+ new long[] {100L, 200L}, ChannelModel.fromBundle(validBundle).getVibrationPattern());
87
89
 
88
90
  ArrayList<Object> invalidPattern = new ArrayList<>();
89
91
  invalidPattern.add(100L);
@@ -109,8 +111,7 @@ public class ChannelModelTest {
109
111
  }
110
112
 
111
113
  @SuppressWarnings({"rawtypes", "unchecked"})
112
- private static void putRawParcelableArrayList(
113
- Bundle bundle, String key, ArrayList<?> arrayList) {
114
+ private static void putRawParcelableArrayList(Bundle bundle, String key, ArrayList<?> arrayList) {
114
115
  bundle.putParcelableArrayList(key, (ArrayList) arrayList);
115
116
  }
116
117
  }
@@ -66,6 +66,7 @@ public class IntervalTriggerModelTest {
66
66
  Bundle bundle = new Bundle();
67
67
  bundle.putString("interval", "15");
68
68
 
69
- assertThrows(ClassCastException.class, () -> IntervalTriggerModel.fromBundle(bundle).getInterval());
69
+ assertThrows(
70
+ ClassCastException.class, () -> IntervalTriggerModel.fromBundle(bundle).getInterval());
70
71
  }
71
72
  }
@@ -260,7 +260,8 @@ public class NotificationAndroidModelTest {
260
260
  Bundle validBundle = new Bundle();
261
261
  putRawParcelableArrayList(validBundle, "flags", flags);
262
262
 
263
- assertArrayEquals(new int[] {1, 2}, NotificationAndroidModel.fromBundle(validBundle).getFlags());
263
+ assertArrayEquals(
264
+ new int[] {1, 2}, NotificationAndroidModel.fromBundle(validBundle).getFlags());
264
265
 
265
266
  ArrayList<Object> invalidFlags = new ArrayList<>();
266
267
  invalidFlags.add(1L);
@@ -274,7 +275,8 @@ public class NotificationAndroidModelTest {
274
275
 
275
276
  @Test
276
277
  public void vibrationPattern_missingEmptyIntegerAndUnsupportedValues_preserveCurrentBehavior() {
277
- assertArrayEquals(new long[0], NotificationAndroidModel.fromBundle(new Bundle()).getVibrationPattern());
278
+ assertArrayEquals(
279
+ new long[0], NotificationAndroidModel.fromBundle(new Bundle()).getVibrationPattern());
278
280
 
279
281
  Bundle emptyBundle = new Bundle();
280
282
  putRawParcelableArrayList(emptyBundle, "vibrationPattern", new ArrayList<Integer>());
@@ -302,8 +304,7 @@ public class NotificationAndroidModelTest {
302
304
  }
303
305
 
304
306
  @SuppressWarnings({"rawtypes", "unchecked"})
305
- private static void putRawParcelableArrayList(
306
- Bundle bundle, String key, ArrayList<?> arrayList) {
307
+ private static void putRawParcelableArrayList(Bundle bundle, String key, ArrayList<?> arrayList) {
307
308
  bundle.putParcelableArrayList(key, (ArrayList) arrayList);
308
309
  }
309
310
  }
@@ -52,7 +52,9 @@ public class NotificationAndroidStyleModelTest {
52
52
  Bundle truncatedDoubleBundle = new Bundle();
53
53
  truncatedDoubleBundle.putDouble("type", 1.9d);
54
54
  NotificationCompat.Style truncatedStyle =
55
- NotificationAndroidStyleModel.fromBundle(truncatedDoubleBundle).getStyleTask(executor).get();
55
+ NotificationAndroidStyleModel.fromBundle(truncatedDoubleBundle)
56
+ .getStyleTask(executor)
57
+ .get();
56
58
  assertTrue(truncatedStyle instanceof NotificationCompat.BigTextStyle);
57
59
  }
58
60
 
@@ -147,8 +149,7 @@ public class NotificationAndroidStyleModelTest {
147
149
  }
148
150
 
149
151
  @SuppressWarnings({"rawtypes", "unchecked"})
150
- private static void putRawParcelableArrayList(
151
- Bundle bundle, String key, ArrayList<?> arrayList) {
152
+ private static void putRawParcelableArrayList(Bundle bundle, String key, ArrayList<?> arrayList) {
152
153
  bundle.putParcelableArrayList(key, (ArrayList) arrayList);
153
154
  }
154
155
  }
@@ -102,7 +102,8 @@ public class BundleValueReaderTest {
102
102
  NullPointerException.class,
103
103
  () -> BundleValueReader.getLongPreserving(bundle, "explicitNull", 42L));
104
104
  assertThrows(
105
- ClassCastException.class, () -> BundleValueReader.getLongPreserving(bundle, "integer", 42L));
105
+ ClassCastException.class,
106
+ () -> BundleValueReader.getLongPreserving(bundle, "integer", 42L));
106
107
  }
107
108
 
108
109
  @Test
@@ -135,8 +135,7 @@ public class ObjectUtilsTest {
135
135
  }
136
136
 
137
137
  @SuppressWarnings({"rawtypes", "unchecked"})
138
- private static void putRawParcelableArrayList(
139
- Bundle bundle, String key, ArrayList<?> arrayList) {
138
+ private static void putRawParcelableArrayList(Bundle bundle, String key, ArrayList<?> arrayList) {
140
139
  bundle.putParcelableArrayList(key, (ArrayList) arrayList);
141
140
  }
142
141
  }
@@ -25,9 +25,9 @@ import org.junit.Before;
25
25
  import org.junit.Test;
26
26
  import org.junit.runner.RunWith;
27
27
  import org.mockito.ArgumentCaptor;
28
+ import org.robolectric.RobolectricTestRunner;
28
29
  import org.robolectric.RuntimeEnvironment;
29
30
  import org.robolectric.Shadows;
30
- import org.robolectric.RobolectricTestRunner;
31
31
  import org.robolectric.annotation.Config;
32
32
  import org.robolectric.annotation.LooperMode;
33
33
 
@@ -80,15 +80,16 @@ public class HeadlessTaskReactHostTest {
80
80
  "ReactContext listener should be removed after initialization",
81
81
  0,
82
82
  application.reactHost.listeners.size());
83
- Shadows.shadowOf(Looper.getMainLooper()).idleFor(499, java.util.concurrent.TimeUnit.MILLISECONDS);
84
- verify(appRegistry, never()).startHeadlessTask(anyInt(), any(String.class), any(WritableMap.class));
83
+ Shadows.shadowOf(Looper.getMainLooper())
84
+ .idleFor(499, java.util.concurrent.TimeUnit.MILLISECONDS);
85
+ verify(appRegistry, never())
86
+ .startHeadlessTask(anyInt(), any(String.class), any(WritableMap.class));
85
87
 
86
88
  Shadows.shadowOf(Looper.getMainLooper()).idleFor(1, java.util.concurrent.TimeUnit.MILLISECONDS);
87
89
 
88
90
  ArgumentCaptor<Integer> taskIdCaptor = ArgumentCaptor.forClass(Integer.class);
89
91
  verify(appRegistry)
90
- .startHeadlessTask(
91
- taskIdCaptor.capture(), eq("test-headless-task"), same(copiedParams));
92
+ .startHeadlessTask(taskIdCaptor.capture(), eq("test-headless-task"), same(copiedParams));
92
93
  assertEquals(taskIdCaptor.getValue().intValue(), taskConfig.getReactTaskId());
93
94
  assertEquals(
94
95
  "source payload should be copied into the queued task",
@@ -30,9 +30,9 @@ import org.junit.Before;
30
30
  import org.junit.Test;
31
31
  import org.junit.runner.RunWith;
32
32
  import org.mockito.MockedStatic;
33
+ import org.robolectric.RobolectricTestRunner;
33
34
  import org.robolectric.RuntimeEnvironment;
34
35
  import org.robolectric.Shadows;
35
- import org.robolectric.RobolectricTestRunner;
36
36
  import org.robolectric.annotation.Config;
37
37
 
38
38
  @RunWith(RobolectricTestRunner.class)
@@ -76,8 +76,8 @@ public class NotifeeEventSubscriberRoutingTest {
76
76
  WritableMap notificationMap = mock(WritableMap.class);
77
77
  WritableMap pressActionMap = mock(WritableMap.class);
78
78
 
79
- try (MockedStatic<Arguments> arguments = mockArguments(
80
- eventMap, detailMap, notificationMap, pressActionMap)) {
79
+ try (MockedStatic<Arguments> arguments =
80
+ mockArguments(eventMap, detailMap, notificationMap, pressActionMap)) {
81
81
  new NotifeeEventSubscriber().onNotificationEvent(buildPressEvent("routing-foreground"));
82
82
  }
83
83
 
@@ -90,7 +90,8 @@ public class NotifeeEventSubscriberRoutingTest {
90
90
  verify(emitter).emit(NotifeeEventSubscriber.NOTIFICATION_EVENT_KEY, eventMap);
91
91
  verify(eventMap, never()).copy();
92
92
  assertEquals("foreground routing must not queue a headless task", 0, taskQueueSize());
93
- assertEquals("foreground routing must not start ReactHost", 0, application.reactHost.startCalls);
93
+ assertEquals(
94
+ "foreground routing must not start ReactHost", 0, application.reactHost.startCalls);
94
95
  }
95
96
 
96
97
  @Test
@@ -111,8 +112,8 @@ public class NotifeeEventSubscriberRoutingTest {
111
112
  WritableMap pressActionMap = mock(WritableMap.class);
112
113
  when(eventMap.copy()).thenReturn(queuedEventMap);
113
114
 
114
- try (MockedStatic<Arguments> arguments = mockArguments(
115
- eventMap, detailMap, notificationMap, pressActionMap)) {
115
+ try (MockedStatic<Arguments> arguments =
116
+ mockArguments(eventMap, detailMap, notificationMap, pressActionMap)) {
116
117
  new NotifeeEventSubscriber().onNotificationEvent(buildPressEvent("routing-background"));
117
118
  }
118
119
 
@@ -128,11 +129,18 @@ public class NotifeeEventSubscriberRoutingTest {
128
129
 
129
130
  assertEquals("background routing should queue exactly one headless task", 1, taskQueueSize());
130
131
  HeadlessTask.TaskConfig queuedTask = headlessTaskQueue().get(0);
131
- assertEquals(NotifeeEventSubscriber.NOTIFICATION_EVENT_KEY, queuedTask.getTaskConfig().getTaskKey());
132
+ assertEquals(
133
+ NotifeeEventSubscriber.NOTIFICATION_EVENT_KEY, queuedTask.getTaskConfig().getTaskKey());
132
134
  assertEquals(60000L, queuedTask.getTaskConfig().getTimeout());
133
135
  assertSame(queuedEventMap, queuedTask.getTaskConfig().getData());
134
- assertEquals("background routing should initialize ReactHost via reflection", 1, application.reactHost.startCalls);
135
- assertEquals("background routing should register one ReactContext listener", 1, application.reactHost.listeners.size());
136
+ assertEquals(
137
+ "background routing should initialize ReactHost via reflection",
138
+ 1,
139
+ application.reactHost.startCalls);
140
+ assertEquals(
141
+ "background routing should register one ReactContext listener",
142
+ 1,
143
+ application.reactHost.listeners.size());
136
144
  }
137
145
 
138
146
  private static MockedStatic<Arguments> mockArguments(
@@ -142,7 +150,8 @@ public class NotifeeEventSubscriberRoutingTest {
142
150
  WritableMap pressActionMap) {
143
151
  MockedStatic<Arguments> arguments = mockStatic(Arguments.class);
144
152
  arguments.when(Arguments::createMap).thenReturn(eventMap, detailMap);
145
- arguments.when(() -> Arguments.fromBundle(any(Bundle.class)))
153
+ arguments
154
+ .when(() -> Arguments.fromBundle(any(Bundle.class)))
146
155
  .thenReturn(notificationMap, pressActionMap);
147
156
  return arguments;
148
157
  }
@@ -4,8 +4,8 @@ import app.notifee.core.ContextHolder;
4
4
  import org.junit.Before;
5
5
  import org.junit.Test;
6
6
  import org.junit.runner.RunWith;
7
- import org.robolectric.RuntimeEnvironment;
8
7
  import org.robolectric.RobolectricTestRunner;
8
+ import org.robolectric.RuntimeEnvironment;
9
9
  import org.robolectric.annotation.Config;
10
10
 
11
11
  @RunWith(RobolectricTestRunner.class)
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "10.3.0";
1
+ export declare const version = "10.3.1";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '10.3.0';
2
+ export const version = '10.3.1';
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-notify-kit",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
4
4
  "author": "Marco Crupi",
5
5
  "description": "Maintained Notifee-compatible fork for React Native — advanced local notifications for Android & iOS.",
6
6
  "main": "dist/index.js",
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '10.3.0';
2
+ export const version = '10.3.1';