react-native-notify-kit 10.8.1 → 10.9.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 (89) hide show
  1. package/README.md +35 -18
  2. package/android/build.gradle +50 -4
  3. package/android/src/main/AndroidManifest.xml +15 -0
  4. package/android/src/main/java/app/notifee/core/EventBus.java +4 -0
  5. package/android/src/main/java/app/notifee/core/ForegroundService.java +395 -5
  6. package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitReceiver.java +15 -0
  7. package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitScheduler.java +461 -0
  8. package/android/src/main/java/app/notifee/core/FullScreenNotificationActivity.java +76 -0
  9. package/android/src/main/java/app/notifee/core/InitialNotificationLedger.java +262 -0
  10. package/android/src/main/java/app/notifee/core/Notifee.java +142 -20
  11. package/android/src/main/java/app/notifee/core/NotificationManager.java +50 -6
  12. package/android/src/main/java/app/notifee/core/NotificationPendingIntent.java +14 -0
  13. package/android/src/main/java/app/notifee/core/NotificationReceiverHandler.java +11 -2
  14. package/android/src/main/java/app/notifee/core/event/InitialNotificationEvent.java +15 -0
  15. package/android/src/main/java/app/notifee/core/event/NotificationEvent.java +6 -0
  16. package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +29 -0
  17. package/android/src/main/kotlin/io/invertase/notifee/NotifeeEventSubscriber.kt +3 -0
  18. package/android/src/test/java/app/notifee/core/ForegroundServiceRunLimitTest.java +2357 -0
  19. package/android/src/test/java/app/notifee/core/ForegroundServiceTest.java +23 -13
  20. package/android/src/test/java/app/notifee/core/NotifeeGetInitialNotificationTest.java +3805 -0
  21. package/android/src/test/java/app/notifee/core/ShadowServiceCompatibilityTest.java +170 -0
  22. package/android/src/test/resources/robolectric.properties +4 -0
  23. package/cli/dist/cli.js +0 -1
  24. package/cli/dist/commands/initNse.js +1 -2
  25. package/cli/dist/lib/detectProject.js +1 -2
  26. package/cli/dist/lib/initNseCore.js +0 -1
  27. package/cli/dist/lib/logger.js +0 -1
  28. package/cli/dist/lib/patchPodfile.js +0 -1
  29. package/cli/dist/lib/patchXcodeProject.js +22 -3
  30. package/cli/dist/lib/writeTemplates.js +0 -1
  31. package/cli/dist/lib/xcode.js +6 -0
  32. package/cli/dist/templates/NotificationService.swift.tmpl +74 -6
  33. package/cli/package.json +1 -0
  34. package/cli/vendor/xcode/AUTHORS +6 -0
  35. package/cli/vendor/xcode/LICENSE +202 -0
  36. package/cli/vendor/xcode/NOTICE +5 -0
  37. package/cli/vendor/xcode/README.md +32 -0
  38. package/cli/vendor/xcode/UPSTREAM-SHA256.json +12 -0
  39. package/cli/vendor/xcode/index.js +18 -0
  40. package/cli/vendor/xcode/lib/parseJob.js +32 -0
  41. package/cli/vendor/xcode/lib/parser/pbxproj.js +1904 -0
  42. package/cli/vendor/xcode/lib/parser/pbxproj.pegjs +280 -0
  43. package/cli/vendor/xcode/lib/pbxFile.js +233 -0
  44. package/cli/vendor/xcode/lib/pbxProject.js +2205 -0
  45. package/cli/vendor/xcode/lib/pbxWriter.js +309 -0
  46. package/dist/NotifeeNativeModule.web.d.ts +2 -2
  47. package/dist/types/Module.d.ts +10 -3
  48. package/dist/types/Notification.d.ts +12 -1
  49. package/dist/types/Notification.js +3 -0
  50. package/dist/types/Notification.js.map +1 -1
  51. package/dist/types/NotificationAndroid.d.ts +9 -0
  52. package/dist/types/NotificationAndroid.js.map +1 -1
  53. package/dist/validators/validateAndroidNotification.js +26 -1
  54. package/dist/validators/validateAndroidNotification.js.map +1 -1
  55. package/dist/validators/validateAndroidStyle.js +6 -0
  56. package/dist/validators/validateAndroidStyle.js.map +1 -1
  57. package/dist/validators/validateIOSAttachment.js +3 -1
  58. package/dist/validators/validateIOSAttachment.js.map +1 -1
  59. package/dist/version.d.ts +1 -1
  60. package/dist/version.js +1 -1
  61. package/package.json +8 -5
  62. package/src/NotifeeNativeModule.web.ts +2 -2
  63. package/src/types/Module.ts +10 -3
  64. package/src/types/Notification.ts +13 -0
  65. package/src/types/NotificationAndroid.ts +10 -0
  66. package/src/validators/validateAndroidNotification.ts +31 -1
  67. package/src/validators/validateAndroidStyle.ts +10 -2
  68. package/src/validators/validateIOSAttachment.ts +5 -1
  69. package/src/version.ts +1 -1
  70. package/cli/dist/cli.bundle.js +0 -20834
  71. package/cli/dist/cli.d.ts +0 -2
  72. package/cli/dist/cli.js.map +0 -1
  73. package/cli/dist/commands/initNse.d.ts +0 -12
  74. package/cli/dist/commands/initNse.js.map +0 -1
  75. package/cli/dist/lib/detectProject.d.ts +0 -12
  76. package/cli/dist/lib/detectProject.js.map +0 -1
  77. package/cli/dist/lib/initNseCore.d.ts +0 -8
  78. package/cli/dist/lib/initNseCore.js.map +0 -1
  79. package/cli/dist/lib/logger.d.ts +0 -4
  80. package/cli/dist/lib/logger.js.map +0 -1
  81. package/cli/dist/lib/patchPodfile.d.ts +0 -23
  82. package/cli/dist/lib/patchPodfile.js.map +0 -1
  83. package/cli/dist/lib/patchXcodeProject.d.ts +0 -41
  84. package/cli/dist/lib/patchXcodeProject.js.map +0 -1
  85. package/cli/dist/lib/writeTemplates.d.ts +0 -11
  86. package/cli/dist/lib/writeTemplates.js.map +0 -1
  87. package/cli/dist/templates/templates/Info.plist.tmpl +0 -29
  88. package/cli/dist/templates/templates/NotificationService.swift.tmpl +0 -100
  89. package/cli/dist/templates/templates/NotifyKitNSE.entitlements.tmpl +0 -6
@@ -119,7 +119,7 @@ public class ForegroundServiceTest {
119
119
 
120
120
  @Test
121
121
  @Config(
122
- sdk = {34, 35},
122
+ sdk = {34, 35, 37},
123
123
  shadows = SliceAShadowService.class)
124
124
  public void sliceA_demotionPrecedesDestructiveRetirementAndEventWork() throws Exception {
125
125
  ForegroundService service = sliceAService(ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
@@ -221,7 +221,9 @@ public class ForegroundServiceTest {
221
221
  }
222
222
 
223
223
  @Test
224
- @Config(sdk = 35, shadows = SliceAShadowService.class)
224
+ @Config(
225
+ sdk = {35, 37},
226
+ shadows = SliceAShadowService.class)
225
227
  public void sliceA_reservedUnknownAndAcceptedUndeliveredStartsRemainHeld() throws Exception {
226
228
  ForegroundService service = sliceAService(ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
227
229
  RecordingServiceContext context = useRecordingContext();
@@ -338,7 +340,9 @@ public class ForegroundServiceTest {
338
340
  }
339
341
 
340
342
  @Test
341
- @Config(sdk = 35, shadows = SliceAShadowService.class)
343
+ @Config(
344
+ sdk = {35, 37},
345
+ shadows = SliceAShadowService.class)
342
346
  public void sliceA_demotionThrowPreservesEvidenceAndPrimaryEvenWhenStopThrows() throws Exception {
343
347
  ForegroundService service = sliceAService(ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC);
344
348
  Object runner = issue81Field(service, "mRunnerToken");
@@ -1047,7 +1051,8 @@ public class ForegroundServiceTest {
1047
1051
  }
1048
1052
 
1049
1053
  @Implementation
1050
- protected void startForeground(int id, Notification notification, int foregroundServiceType) {
1054
+ protected void startForeground(int id, Notification notification, int foregroundServiceType)
1055
+ throws Exception {
1051
1056
  if (promotionFailure != null) throw promotionFailure;
1052
1057
  promotions++;
1053
1058
  foreground = true;
@@ -1272,7 +1277,9 @@ public class ForegroundServiceTest {
1272
1277
  }
1273
1278
 
1274
1279
  @Test
1275
- @Config(sdk = 35, shadows = Issue81ShadowService.class)
1280
+ @Config(
1281
+ sdk = {35, 37},
1282
+ shadows = Issue81ShadowService.class)
1276
1283
  public void issue82_pendingB_definiteRejectionReevaluatesRecovery_unknownDoesNot()
1277
1284
  throws Exception {
1278
1285
  for (RuntimeException reply :
@@ -1824,7 +1831,7 @@ public class ForegroundServiceTest {
1824
1831
 
1825
1832
  @Test
1826
1833
  @Config(
1827
- sdk = {31, 33, 34, 35},
1834
+ sdk = {31, 33, 34, 35, 37},
1828
1835
  shadows = Issue81ShadowService.class)
1829
1836
  public void issue81_retryFreshDenied_recoversWithoutClaimingPromotion() throws Exception {
1830
1837
  issue81AssertFreshRecovery(Service.START_FLAG_RETRY);
@@ -2030,7 +2037,9 @@ public class ForegroundServiceTest {
2030
2037
  }
2031
2038
 
2032
2039
  @Test
2033
- @Config(sdk = 33, shadows = Issue81ShadowService.class)
2040
+ @Config(
2041
+ sdk = {33, 37},
2042
+ shadows = Issue81ShadowService.class)
2034
2043
  public void issue81_deniedA_withQueuedStop_promotesBBeforeStopping() throws Exception {
2035
2044
  RecordingServiceContext context = useRecordingContext();
2036
2045
  ForegroundService service = issue81Service();
@@ -2371,7 +2380,7 @@ public class ForegroundServiceTest {
2371
2380
 
2372
2381
  @Test
2373
2382
  @Config(
2374
- sdk = {31, 34},
2383
+ sdk = {31, 34, 37},
2375
2384
  shadows = Issue81ShadowService.class)
2376
2385
  public void issue81_deferredRecovery_lateSecurityRejection_stops() throws Exception {
2377
2386
  issue81AssertLateRejection(new SecurityException("B rejected"));
@@ -3105,7 +3114,7 @@ public class ForegroundServiceTest {
3105
3114
  }
3106
3115
 
3107
3116
  @Implementation
3108
- protected void startForeground(int id, Notification notification) {
3117
+ protected void startForeground(int id, Notification notification) throws Exception {
3109
3118
  if (!forwardingTyped) {
3110
3119
  recordPromotion(id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE);
3111
3120
  }
@@ -3113,7 +3122,7 @@ public class ForegroundServiceTest {
3113
3122
  }
3114
3123
 
3115
3124
  @Implementation
3116
- protected void startForeground(int id, Notification notification, int type) {
3125
+ protected void startForeground(int id, Notification notification, int type) throws Exception {
3117
3126
  recordPromotion(id, notification, type);
3118
3127
  // ShadowService's typed overload delegates to the two-argument shadow. Record only the
3119
3128
  // actual platform invocation so the witness cannot count that delegation as a second call.
@@ -4180,7 +4189,7 @@ public class ForegroundServiceTest {
4180
4189
  @Implements(Service.class)
4181
4190
  public static class DenyOldNotificationShadowService extends ShadowService {
4182
4191
  @Implementation
4183
- protected void startForeground(int id, Notification notification) {
4192
+ protected void startForeground(int id, Notification notification) throws Exception {
4184
4193
  if ("B".equals(notification.extras.getString(Notification.EXTRA_TITLE))) {
4185
4194
  throw new ForegroundServiceStartNotAllowedException("real old START denied");
4186
4195
  }
@@ -5274,7 +5283,7 @@ public class ForegroundServiceTest {
5274
5283
  @Implements(Service.class)
5275
5284
  public static class RejectBStartForegroundShadowService extends ShadowService {
5276
5285
  @Implementation
5277
- protected void startForeground(int id, Notification notification) {
5286
+ protected void startForeground(int id, Notification notification) throws Exception {
5278
5287
  if ("B".equals(notification.extras.getString(Notification.EXTRA_TITLE))) {
5279
5288
  throw new SecurityException("posting B rejected");
5280
5289
  }
@@ -5282,7 +5291,8 @@ public class ForegroundServiceTest {
5282
5291
  }
5283
5292
 
5284
5293
  @Implementation
5285
- protected void startForeground(int id, Notification notification, int foregroundServiceType) {
5294
+ protected void startForeground(int id, Notification notification, int foregroundServiceType)
5295
+ throws Exception {
5286
5296
  if ("B".equals(notification.extras.getString(Notification.EXTRA_TITLE))) {
5287
5297
  throw new SecurityException("posting B rejected");
5288
5298
  }