react-native-notify-kit 10.4.9 → 10.6.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 (62) hide show
  1. package/README.md +60 -2
  2. package/android/src/main/java/app/notifee/core/Notifee.java +9 -0
  3. package/android/src/main/java/app/notifee/core/ReceiverService.java +41 -4
  4. package/android/src/main/java/app/notifee/core/model/NotificationAndroidStyleModel.java +63 -34
  5. package/android/src/main/java/app/notifee/core/utility/FullScreenIntentUtils.java +53 -0
  6. package/android/src/main/java/app/notifee/core/utility/ResourceUtils.java +15 -1
  7. package/android/src/test/java/app/notifee/core/ReceiverServicePendingIntentIdentityTest.java +303 -0
  8. package/android/src/test/java/app/notifee/core/model/NotificationAndroidStyleModelPersonFailureTest.java +337 -0
  9. package/android/src/test/java/app/notifee/core/model/TimestampTriggerModelTest.java +27 -70
  10. package/android/src/test/java/app/notifee/core/utility/FullScreenIntentUtilsTest.java +83 -0
  11. package/android/src/test/java/app/notifee/core/utility/ResourceUtilsBitmapOwnershipTest.java +145 -0
  12. package/dist/NotifeeApiModule.js +4 -0
  13. package/dist/NotifeeApiModule.js.map +1 -1
  14. package/dist/types/Notification.d.ts +2 -1
  15. package/dist/types/Notification.js.map +1 -1
  16. package/dist/types/NotificationAndroid.d.ts +17 -5
  17. package/dist/types/NotificationAndroid.js.map +1 -1
  18. package/dist/validators/validateAndroidNotification.js +4 -0
  19. package/dist/validators/validateAndroidNotification.js.map +1 -1
  20. package/dist/version.d.ts +1 -1
  21. package/dist/version.js +1 -1
  22. package/ios/NotifeeCore/NotifeeCoreExtensionHelper.m +285 -91
  23. package/ios/NotifeeCore/NotifeeCoreUtil.m +159 -13
  24. package/jest-mock.js +1 -0
  25. package/package.json +2 -2
  26. package/server/README.md +6 -4
  27. package/server/dist/android.d.ts +8 -0
  28. package/server/dist/android.d.ts.map +1 -0
  29. package/server/dist/android.js +20 -0
  30. package/server/dist/android.js.map +1 -0
  31. package/server/dist/buildPayload.d.ts +3 -0
  32. package/server/dist/buildPayload.d.ts.map +1 -0
  33. package/server/dist/buildPayload.js +82 -0
  34. package/server/dist/buildPayload.js.map +1 -0
  35. package/server/dist/index.d.ts +6 -0
  36. package/server/dist/index.d.ts.map +1 -0
  37. package/server/dist/index.js +12 -0
  38. package/server/dist/index.js.map +1 -0
  39. package/server/dist/ios.d.ts +11 -0
  40. package/server/dist/ios.d.ts.map +1 -0
  41. package/server/dist/ios.js +61 -0
  42. package/server/dist/ios.js.map +1 -0
  43. package/server/dist/serialize.d.ts +11 -0
  44. package/server/dist/serialize.d.ts.map +1 -0
  45. package/server/dist/serialize.js +32 -0
  46. package/server/dist/serialize.js.map +1 -0
  47. package/server/dist/types.d.ts +2 -0
  48. package/server/dist/types.d.ts.map +1 -0
  49. package/server/dist/types.js +3 -0
  50. package/server/dist/types.js.map +1 -0
  51. package/server/dist/validation.d.ts +3 -0
  52. package/server/dist/validation.d.ts.map +1 -0
  53. package/server/dist/validation.js +115 -0
  54. package/server/dist/validation.js.map +1 -0
  55. package/server/src/android.ts +4 -4
  56. package/server/src/validation.ts +20 -0
  57. package/src/NotifeeApiModule.ts +4 -0
  58. package/src/internal/fcmContract.d.ts +10 -8
  59. package/src/types/Notification.ts +2 -1
  60. package/src/types/NotificationAndroid.ts +18 -5
  61. package/src/validators/validateAndroidNotification.ts +7 -0
  62. package/src/version.ts +1 -1
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateInput = validateInput;
4
+ const PREFIX = '[react-native-notify-kit/server]';
5
+ const RESERVED_DATA_KEYS = ['notifee_options', 'notifee_data'];
6
+ function err(category, message) {
7
+ return new Error(`${PREFIX} ${category}: ${message}`);
8
+ }
9
+ function isNonEmptyString(value) {
10
+ return typeof value === 'string' && value.length > 0;
11
+ }
12
+ function validateInput(input) {
13
+ if (input === null || typeof input !== 'object') {
14
+ throw err('Validation', 'input must be an object');
15
+ }
16
+ const routingCount = (input.token !== undefined ? 1 : 0) +
17
+ (input.topic !== undefined ? 1 : 0) +
18
+ (input.condition !== undefined ? 1 : 0);
19
+ if (routingCount !== 1) {
20
+ throw err('Routing', `exactly one of 'token', 'topic', or 'condition' must be provided. Got: ${routingCount}`);
21
+ }
22
+ if (input.token !== undefined && !isNonEmptyString(input.token)) {
23
+ throw err('Routing', "'token' must be a non-empty string");
24
+ }
25
+ if (input.topic !== undefined && !isNonEmptyString(input.topic)) {
26
+ throw err('Routing', "'topic' must be a non-empty string");
27
+ }
28
+ if (input.condition !== undefined && !isNonEmptyString(input.condition)) {
29
+ throw err('Routing', "'condition' must be a non-empty string");
30
+ }
31
+ const { notification } = input;
32
+ if (notification === null || typeof notification !== 'object') {
33
+ throw err('Validation', "'notification' is required and must be an object");
34
+ }
35
+ if (notification.id !== undefined && !isNonEmptyString(notification.id)) {
36
+ throw err('Validation', 'notification.id must be a non-empty string when provided');
37
+ }
38
+ if (!isNonEmptyString(notification.title)) {
39
+ throw err('Validation', 'notification.title is required and must be a non-empty string');
40
+ }
41
+ if (!isNonEmptyString(notification.body)) {
42
+ throw err('Validation', 'notification.body is required and must be a non-empty string');
43
+ }
44
+ if (notification.data !== undefined) {
45
+ if (notification.data === null || typeof notification.data !== 'object') {
46
+ throw err('Validation', "'notification.data' must be an object");
47
+ }
48
+ for (const reserved of RESERVED_DATA_KEYS) {
49
+ if (Object.prototype.hasOwnProperty.call(notification.data, reserved)) {
50
+ throw err('Validation', "'notifee_options' and 'notifee_data' are reserved keys and cannot be used in notification.data");
51
+ }
52
+ }
53
+ for (const [key, value] of Object.entries(notification.data)) {
54
+ if (typeof value !== 'string') {
55
+ throw err('Validation', `FCM data values must be strings. Got ${typeof value} for key '${key}'. Use JSON.stringify() if you need to pass complex values.`);
56
+ }
57
+ }
58
+ }
59
+ const attachments = notification.ios?.attachments;
60
+ if (attachments !== undefined) {
61
+ if (!Array.isArray(attachments)) {
62
+ throw err('iOS', "'notification.ios.attachments' must be an array");
63
+ }
64
+ for (const attachment of attachments) {
65
+ if (attachment === null ||
66
+ typeof attachment !== 'object' ||
67
+ typeof attachment.url !== 'string') {
68
+ throw err('iOS', "each attachment must be an object with a string 'url' field");
69
+ }
70
+ if (!attachment.url.startsWith('https://')) {
71
+ throw err('iOS', `iOS attachments require https:// URLs. Got: ${attachment.url}`);
72
+ }
73
+ }
74
+ }
75
+ if (input.options !== undefined) {
76
+ const { options } = input;
77
+ if (options === null || typeof options !== 'object') {
78
+ throw err('Validation', "'options' must be an object");
79
+ }
80
+ if (options.androidPriority !== undefined &&
81
+ options.androidPriority !== 'high' &&
82
+ options.androidPriority !== 'normal') {
83
+ throw err('Validation', `'options.androidPriority' must be 'high' or 'normal'. Got: ${String(options.androidPriority)}`);
84
+ }
85
+ if (options.iosBadgeCount !== undefined &&
86
+ (typeof options.iosBadgeCount !== 'number' ||
87
+ !Number.isFinite(options.iosBadgeCount) ||
88
+ options.iosBadgeCount < 0 ||
89
+ !Number.isInteger(options.iosBadgeCount))) {
90
+ throw err('Validation', "'options.iosBadgeCount' must be a non-negative integer");
91
+ }
92
+ if (options.ttl !== undefined &&
93
+ (typeof options.ttl !== 'number' || !Number.isInteger(options.ttl) || options.ttl <= 0)) {
94
+ throw err('Validation', `options.ttl must be a positive integer (seconds). Got: ${String(options.ttl)}`);
95
+ }
96
+ if (options.collapseKey !== undefined && !isNonEmptyString(options.collapseKey)) {
97
+ throw err('Validation', "'options.collapseKey' must be a non-empty string");
98
+ }
99
+ }
100
+ const actions = notification.android?.actions;
101
+ if (Array.isArray(actions)) {
102
+ const pressActionIds = new Set();
103
+ for (const action of actions) {
104
+ const pressActionId = action?.pressAction?.id;
105
+ if (typeof pressActionId !== 'string') {
106
+ continue;
107
+ }
108
+ if (pressActionIds.has(pressActionId)) {
109
+ throw err('Android', "'notification.android.actions' pressAction IDs must be unique within the notification");
110
+ }
111
+ pressActionIds.add(pressActionId);
112
+ }
113
+ }
114
+ }
115
+ //# sourceMappingURL=validation.js.map
@@ -0,0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CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QAEzC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,aAAa,GAAG,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC;YAC9C,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;gBACtC,SAAS;YACX,CAAC;YAED,IAAI,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACtC,MAAM,GAAG,CACP,SAAS,EACT,uFAAuF,CACxF,CAAC;YACJ,CAAC;YACD,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -5,8 +5,8 @@ type BuildAndroidContext = {
5
5
  ttlSeconds?: number;
6
6
  };
7
7
 
8
- function toAndroidPriority(priority: NotifyKitOptions['androidPriority']): 'HIGH' | 'NORMAL' {
9
- return priority === 'normal' ? 'NORMAL' : 'HIGH';
8
+ function toAndroidPriority(priority: NotifyKitOptions['androidPriority']): 'high' | 'normal' {
9
+ return priority === 'normal' ? 'normal' : 'high';
10
10
  }
11
11
 
12
12
  export function buildAndroidPayload(
@@ -18,10 +18,10 @@ export function buildAndroidPayload(
18
18
  priority: toAndroidPriority(options.androidPriority),
19
19
  };
20
20
  if (context.collapseKey !== undefined) {
21
- output.collapse_key = context.collapseKey;
21
+ output.collapseKey = context.collapseKey;
22
22
  }
23
23
  if (context.ttlSeconds !== undefined) {
24
- output.ttl = `${context.ttlSeconds}s`;
24
+ output.ttl = context.ttlSeconds * 1000;
25
25
  }
26
26
  return output;
27
27
  }
@@ -131,4 +131,24 @@ export function validateInput(input: NotifyKitPayloadInput): void {
131
131
  throw err('Validation', "'options.collapseKey' must be a non-empty string");
132
132
  }
133
133
  }
134
+
135
+ const actions = notification.android?.actions;
136
+ if (Array.isArray(actions)) {
137
+ const pressActionIds = new Set<string>();
138
+
139
+ for (const action of actions) {
140
+ const pressActionId = action?.pressAction?.id;
141
+ if (typeof pressActionId !== 'string') {
142
+ continue;
143
+ }
144
+
145
+ if (pressActionIds.has(pressActionId)) {
146
+ throw err(
147
+ 'Android',
148
+ "'notification.android.actions' pressAction IDs must be unique within the notification",
149
+ );
150
+ }
151
+ pressActionIds.add(pressActionId);
152
+ }
153
+ }
134
154
  }
@@ -602,6 +602,7 @@ export default class NotifeeApiModule extends NotifeeNativeModule implements Mod
602
602
  ios,
603
603
  android: {
604
604
  alarm: AndroidNotificationSetting.ENABLED,
605
+ fullScreenIntent: AndroidNotificationSetting.ENABLED,
605
606
  },
606
607
  web: {},
607
608
  };
@@ -614,6 +615,7 @@ export default class NotifeeApiModule extends NotifeeNativeModule implements Mod
614
615
  authorizationStatus: AuthorizationStatus.NOT_DETERMINED,
615
616
  android: {
616
617
  alarm: AndroidNotificationSetting.ENABLED,
618
+ fullScreenIntent: AndroidNotificationSetting.ENABLED,
617
619
  },
618
620
  ios: {
619
621
  alert: 1,
@@ -725,6 +727,7 @@ export default class NotifeeApiModule extends NotifeeNativeModule implements Mod
725
727
  ios,
726
728
  android: {
727
729
  alarm: AndroidNotificationSetting.ENABLED,
730
+ fullScreenIntent: AndroidNotificationSetting.ENABLED,
728
731
  },
729
732
  web: {},
730
733
  };
@@ -737,6 +740,7 @@ export default class NotifeeApiModule extends NotifeeNativeModule implements Mod
737
740
  authorizationStatus: AuthorizationStatus.NOT_DETERMINED,
738
741
  android: {
739
742
  alarm: AndroidNotificationSetting.ENABLED,
743
+ fullScreenIntent: AndroidNotificationSetting.ENABLED,
740
744
  },
741
745
  ios: {
742
746
  alert: 1,
@@ -55,7 +55,7 @@ export type NotifyKitIosConfig = {
55
55
  export type NotifyKitNotification = {
56
56
  /**
57
57
  * Optional notification identifier. When provided, it is also used as the
58
- * FCM collapse key (Android `collapse_key`, iOS `apns-collapse-id`) unless
58
+ * FCM collapse key (Android `collapseKey`, iOS `apns-collapse-id`) unless
59
59
  * `options.collapseKey` is explicitly set. Collapse key precedence (Rule 7):
60
60
  * 1. `options.collapseKey` if set
61
61
  * 2. `notification.id` if set
@@ -92,9 +92,9 @@ export type NotifyKitPayloadInput = {
92
92
  export type ApnsInterruptionLevel = 'passive' | 'active' | 'time-sensitive' | 'critical';
93
93
 
94
94
  export type NotifyKitAndroidOutput = {
95
- priority: 'HIGH' | 'NORMAL';
96
- collapse_key?: string;
97
- ttl?: string;
95
+ priority: 'high' | 'normal';
96
+ collapseKey?: string;
97
+ ttl?: number;
98
98
  };
99
99
 
100
100
  export type NotifyKitApnsAps = {
@@ -125,10 +125,12 @@ export type NotifyKitApnsOutput = {
125
125
  payload: NotifyKitApnsPayload;
126
126
  };
127
127
 
128
- export type NotifyKitPayloadOutput = {
129
- token?: string;
130
- topic?: string;
131
- condition?: string;
128
+ type NotifyKitPayloadTarget =
129
+ | { token: string; topic?: never; condition?: never }
130
+ | { topic: string; token?: never; condition?: never }
131
+ | { condition: string; token?: never; topic?: never };
132
+
133
+ export type NotifyKitPayloadOutput = NotifyKitPayloadTarget & {
132
134
  data: Record<string, string>;
133
135
  android: NotifyKitAndroidOutput;
134
136
  apns: NotifyKitApnsOutput;
@@ -277,7 +277,8 @@ export interface NotificationPressAction {
277
277
  /**
278
278
  * The interface used to describe a full-screen action for a notification.
279
279
  *
280
- * By setting a `fullScreenAction`, when the notification is displayed, it will launch a full-screen intent.
280
+ * Setting a `fullScreenAction` configures the notification to request Full-Screen Intent presentation from Android.
281
+ * Actual full-screen presentation depends on the app's Full-Screen Intent access and Android platform conditions.
281
282
  *
282
283
  * On Android; when provided to a notification action, the action will only open you application if
283
284
  * a `launchActivity` and/or a `mainComponent` is provided.
@@ -62,9 +62,9 @@ export interface NotificationAndroid {
62
62
  autoCancel?: boolean;
63
63
 
64
64
  /**
65
- * Overrides the current number of active notifications shown on the device.
66
- *
67
- * If no number is provided, the system displays the current number of active notifications.
65
+ * Sets the number associated with this notification. Compatible Android launchers may use it for
66
+ * the app icon badge, but numeric display is launcher-dependent and it is not equivalent to the
67
+ * global iOS `notifee.setBadgeCount()` API.
68
68
  */
69
69
  badgeCount?: number;
70
70
 
@@ -276,8 +276,10 @@ export interface NotificationAndroid {
276
276
  pressAction?: NotificationPressAction | null;
277
277
 
278
278
  /**
279
- * The `fullScreenAction` property allows you to show a custom UI
280
- * in full screen when the notification is displayed.
279
+ * The `fullScreenAction` property requests Full-Screen Intent presentation from Android
280
+ * when the notification is displayed.
281
+ *
282
+ * Actual full-screen presentation depends on the app's Full-Screen Intent access and Android platform conditions.
281
283
  *
282
284
  * View the [FullScreenAction](/react-native/android/behaviour#full-screen) documentation to learn
283
285
  * more.
@@ -501,6 +503,17 @@ export interface AndroidNotificationSettings {
501
503
  * View the [Trigger](/react-native/android/triggers#android-12-limitations) documentation for more information.
502
504
  */
503
505
  alarm: AndroidNotificationSetting;
506
+
507
+ /**
508
+ * Enum describing whether the app currently has the Android access required to use full-screen intents.
509
+ *
510
+ * API < 29 reports `ENABLED` because the later permission model does not apply. API 29–33 reflects
511
+ * `USE_FULL_SCREEN_INTENT`. API 34+ reflects Android's full-screen intent special app access,
512
+ * which may be restricted or revoked by the system, installer, or user.
513
+ *
514
+ * `ENABLED` does not guarantee that a particular notification will be presented full-screen.
515
+ */
516
+ fullScreenIntent?: AndroidNotificationSetting;
504
517
  }
505
518
 
506
519
  /**
@@ -103,6 +103,13 @@ export default function validateAndroidNotification(
103
103
  throw new Error(`'notification.android.actions' invalid AndroidAction. ${e.message}.`);
104
104
  }
105
105
 
106
+ const pressActionIds = new Set<string>(actions.map(action => action.pressAction.id));
107
+ if (pressActionIds.size !== actions.length) {
108
+ throw new Error(
109
+ "'notification.android.actions' pressAction IDs must be unique within the notification.",
110
+ );
111
+ }
112
+
106
113
  if (actions.length) {
107
114
  out.actions = actions;
108
115
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '10.4.9';
2
+ export const version = '10.6.0';