react-native-notify-kit 9.3.0 → 9.5.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.
- package/README.md +68 -2
- package/android/build.gradle +5 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/androidTest/java/app/notifee/core/DoScheduledWorkOrderingTest.java +234 -0
- package/android/src/androidTest/java/app/notifee/core/RebootRecoveryTest.java +204 -0
- package/android/src/androidTest/java/app/notifee/core/database/TimingWorkDataRepository.java +56 -0
- package/android/src/androidTest/java/app/notifee/core/database/WorkDataRepositoryRaceTest.java +221 -0
- package/android/src/androidTest/res/drawable/test_icon.xml +14 -0
- package/android/src/main/baseline-prof.txt +382 -0
- package/android/src/main/java/app/notifee/core/ForegroundService.java +269 -80
- package/android/src/main/java/app/notifee/core/InitProvider.java +48 -5
- package/android/src/main/java/app/notifee/core/Logger.java +5 -0
- package/android/src/main/java/app/notifee/core/NotifeeAlarmManager.java +160 -79
- package/android/src/main/java/app/notifee/core/NotificationManager.java +370 -288
- package/android/src/main/java/app/notifee/core/WarmupHelper.java +84 -0
- package/android/src/main/java/app/notifee/core/database/WorkDataRepository.java +38 -34
- package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +17 -1
- package/android/src/main/kotlin/io/invertase/notifee/NotifeeApiModule.kt +30 -0
- package/android/src/test/java/app/notifee/core/ForegroundServiceTest.java +182 -0
- package/android/src/test/java/app/notifee/core/database/WorkDataRepositoryFutureContractTest.java +279 -0
- package/dist/NotifeeApiModule.d.ts +1 -0
- package/dist/NotifeeApiModule.js +6 -0
- package/dist/NotifeeApiModule.js.map +1 -1
- package/dist/specs/NativeNotifeeModule.d.ts +1 -0
- package/dist/specs/NativeNotifeeModule.js.map +1 -1
- package/dist/types/Module.d.ts +19 -0
- package/dist/types/NotificationAndroid.d.ts +58 -0
- package/dist/types/NotificationAndroid.js +43 -0
- package/dist/types/NotificationAndroid.js.map +1 -1
- package/dist/utils/validate.d.ts +1 -0
- package/dist/utils/validate.js +10 -4
- package/dist/utils/validate.js.map +1 -1
- package/dist/validators/validateAndroidChannel.js +3 -3
- package/dist/validators/validateAndroidChannel.js.map +1 -1
- package/dist/validators/validateAndroidNotification.js +36 -12
- package/dist/validators/validateAndroidNotification.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/NotifeeCore/NotifeeCore+NSNotificationCenter.m +5 -1
- package/ios/NotifeeCore/NotifeeCore+UNUserNotificationCenter.m +5 -5
- package/ios/NotifeeCore/NotifeeCore.m +28 -9
- package/ios/NotifeeCore/NotifeeCoreDelegateHolder.m +5 -1
- package/ios/NotifeeCore/NotifeeCoreExtensionHelper.m +7 -2
- package/ios/RNNotifee/NotifeeApiModule.mm +31 -10
- package/package.json +1 -1
- package/src/NotifeeApiModule.ts +7 -0
- package/src/specs/NativeNotifeeModule.ts +1 -0
- package/src/types/Module.ts +20 -0
- package/src/types/NotificationAndroid.ts +62 -0
- package/src/utils/validate.ts +12 -4
- package/src/validators/validateAndroidChannel.ts +3 -3
- package/src/validators/validateAndroidNotification.ts +43 -10
- package/src/version.ts +1 -1
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
isString,
|
|
14
14
|
isUndefined,
|
|
15
15
|
isIOS,
|
|
16
|
+
isValidEnum,
|
|
17
|
+
getNumericEnumValues,
|
|
16
18
|
} from '../utils';
|
|
17
19
|
|
|
18
20
|
import { AndroidImportance } from '../types/NotificationAndroid';
|
|
@@ -20,6 +22,7 @@ import {
|
|
|
20
22
|
AndroidBadgeIconType,
|
|
21
23
|
AndroidCategory,
|
|
22
24
|
AndroidDefaults,
|
|
25
|
+
AndroidForegroundServiceBehavior,
|
|
23
26
|
AndroidForegroundServiceType,
|
|
24
27
|
AndroidFlags,
|
|
25
28
|
AndroidGroupAlertBehavior,
|
|
@@ -116,6 +119,22 @@ export default function validateAndroidNotification(
|
|
|
116
119
|
out.asForegroundService = android.asForegroundService;
|
|
117
120
|
}
|
|
118
121
|
|
|
122
|
+
/**
|
|
123
|
+
* foregroundServiceBehavior
|
|
124
|
+
*/
|
|
125
|
+
if (
|
|
126
|
+
objectHasProperty(android, 'foregroundServiceBehavior') &&
|
|
127
|
+
!isUndefined(android.foregroundServiceBehavior)
|
|
128
|
+
) {
|
|
129
|
+
if (!isValidEnum(android.foregroundServiceBehavior, AndroidForegroundServiceBehavior)) {
|
|
130
|
+
throw new Error(
|
|
131
|
+
"'notification.android.foregroundServiceBehavior' expected a valid AndroidForegroundServiceBehavior.",
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
out.foregroundServiceBehavior = android.foregroundServiceBehavior;
|
|
136
|
+
}
|
|
137
|
+
|
|
119
138
|
/**
|
|
120
139
|
* lightUpScreen
|
|
121
140
|
*/
|
|
@@ -153,7 +172,7 @@ export default function validateAndroidNotification(
|
|
|
153
172
|
* badgeIconType
|
|
154
173
|
*/
|
|
155
174
|
if (objectHasProperty(android, 'badgeIconType') && !isUndefined(android.badgeIconType)) {
|
|
156
|
-
if (!
|
|
175
|
+
if (!isValidEnum(android.badgeIconType, AndroidBadgeIconType)) {
|
|
157
176
|
throw new Error(
|
|
158
177
|
"'notification.android.badgeIconType' expected a valid AndroidBadgeIconType.",
|
|
159
178
|
);
|
|
@@ -239,7 +258,7 @@ export default function validateAndroidNotification(
|
|
|
239
258
|
);
|
|
240
259
|
}
|
|
241
260
|
|
|
242
|
-
const defaults =
|
|
261
|
+
const defaults = getNumericEnumValues(AndroidDefaults);
|
|
243
262
|
|
|
244
263
|
for (let i = 0; i < android.defaults.length; i++) {
|
|
245
264
|
if (!defaults.includes(android.defaults[i])) {
|
|
@@ -270,7 +289,7 @@ export default function validateAndroidNotification(
|
|
|
270
289
|
objectHasProperty(android, 'groupAlertBehavior') &&
|
|
271
290
|
!isUndefined(android.groupAlertBehavior)
|
|
272
291
|
) {
|
|
273
|
-
if (!
|
|
292
|
+
if (!isValidEnum(android.groupAlertBehavior, AndroidGroupAlertBehavior)) {
|
|
274
293
|
throw new Error(
|
|
275
294
|
"'notification.android.groupAlertBehavior' expected a valid AndroidGroupAlertBehavior.",
|
|
276
295
|
);
|
|
@@ -407,10 +426,10 @@ export default function validateAndroidNotification(
|
|
|
407
426
|
);
|
|
408
427
|
}
|
|
409
428
|
|
|
410
|
-
const
|
|
429
|
+
const foregroundServiceTypeValues = getNumericEnumValues(AndroidForegroundServiceType);
|
|
411
430
|
|
|
412
431
|
for (let i = 0; i < android.foregroundServiceTypes.length; i++) {
|
|
413
|
-
if (!
|
|
432
|
+
if (!foregroundServiceTypeValues.includes(android.foregroundServiceTypes[i])) {
|
|
414
433
|
throw new Error(
|
|
415
434
|
"'notification.android.foregroundServiceTypes' invalid array value, expected an AndroidForegroundServiceType value.",
|
|
416
435
|
);
|
|
@@ -429,13 +448,13 @@ export default function validateAndroidNotification(
|
|
|
429
448
|
}
|
|
430
449
|
|
|
431
450
|
if (android.flags.length === 0) {
|
|
432
|
-
throw new Error("'notification.android.flags' expected an array containing
|
|
451
|
+
throw new Error("'notification.android.flags' expected an array containing AndroidFlags.");
|
|
433
452
|
}
|
|
434
453
|
|
|
435
|
-
const
|
|
454
|
+
const flagValues = getNumericEnumValues(AndroidFlags);
|
|
436
455
|
|
|
437
456
|
for (let i = 0; i < android.flags.length; i++) {
|
|
438
|
-
if (!
|
|
457
|
+
if (!flagValues.includes(android.flags[i])) {
|
|
439
458
|
throw new Error(
|
|
440
459
|
"'notification.android.flags' invalid array value, expected an AndroidFlags value.",
|
|
441
460
|
);
|
|
@@ -502,7 +521,7 @@ export default function validateAndroidNotification(
|
|
|
502
521
|
* importance
|
|
503
522
|
*/
|
|
504
523
|
if (objectHasProperty(android, 'importance') && !isUndefined(android.importance)) {
|
|
505
|
-
if (!
|
|
524
|
+
if (!isValidEnum(android.importance, AndroidImportance)) {
|
|
506
525
|
throw new Error("'notification.android.importance' expected a valid Importance.");
|
|
507
526
|
}
|
|
508
527
|
|
|
@@ -713,7 +732,7 @@ export default function validateAndroidNotification(
|
|
|
713
732
|
* visibility
|
|
714
733
|
*/
|
|
715
734
|
if (objectHasProperty(android, 'visibility') && android.visibility !== undefined) {
|
|
716
|
-
if (!
|
|
735
|
+
if (!isValidEnum(android.visibility, AndroidVisibility)) {
|
|
717
736
|
throw new Error(
|
|
718
737
|
"'notification.android.visibility' expected a valid AndroidVisibility value.",
|
|
719
738
|
);
|
|
@@ -759,5 +778,19 @@ export default function validateAndroidNotification(
|
|
|
759
778
|
out.ongoing = true;
|
|
760
779
|
}
|
|
761
780
|
|
|
781
|
+
/**
|
|
782
|
+
* Auto-set foregroundServiceBehavior to IMMEDIATE for foreground service notifications.
|
|
783
|
+
* Only set when asForegroundService is true and the user did not provide an explicit value.
|
|
784
|
+
* When asForegroundService is false/undefined, strip the property entirely — it has no effect
|
|
785
|
+
* on non-FGS notifications and including it would bloat the Bundle unnecessarily.
|
|
786
|
+
*/
|
|
787
|
+
if (out.asForegroundService) {
|
|
788
|
+
if (android && !objectHasProperty(android, 'foregroundServiceBehavior')) {
|
|
789
|
+
out.foregroundServiceBehavior = AndroidForegroundServiceBehavior.IMMEDIATE;
|
|
790
|
+
}
|
|
791
|
+
} else {
|
|
792
|
+
delete out.foregroundServiceBehavior;
|
|
793
|
+
}
|
|
794
|
+
|
|
762
795
|
return out;
|
|
763
796
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '9.
|
|
2
|
+
export const version = '9.5.0';
|