@imatis/react-native-notifications 4.3.3-imatis.1 → 4.3.3-imatis.11

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 (77) hide show
  1. package/lib/android/app/src/main/AndroidManifest.xml +1 -0
  2. package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/JsIOHelper.java +1 -1
  3. package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +27 -7
  4. package/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotificationProps.java +8 -0
  5. package/package.json +2 -2
  6. package/.detoxrc.json +0 -37
  7. package/lib/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  8. package/lib/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  9. package/lib/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
  10. package/lib/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  11. package/lib/android/.gradle/6.1.1/gc.properties +0 -0
  12. package/lib/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  13. package/lib/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  14. package/lib/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  15. package/lib/android/.gradle/checksums/checksums.lock +0 -0
  16. package/lib/android/.gradle/checksums/md5-checksums.bin +0 -0
  17. package/lib/android/.gradle/checksums/sha1-checksums.bin +0 -0
  18. package/lib/android/.gradle/vcs-1/gc.properties +0 -0
  19. package/lib/android/local.properties +0 -8
  20. package/lib/dist/DTO/Notification.d.ts +0 -11
  21. package/lib/dist/DTO/Notification.js +0 -28
  22. package/lib/dist/DTO/Notification.test.d.ts +0 -1
  23. package/lib/dist/DTO/Notification.test.js +0 -52
  24. package/lib/dist/DTO/NotificationAndroid.d.ts +0 -7
  25. package/lib/dist/DTO/NotificationAndroid.js +0 -20
  26. package/lib/dist/DTO/NotificationAndroid.test.d.ts +0 -1
  27. package/lib/dist/DTO/NotificationAndroid.test.js +0 -25
  28. package/lib/dist/DTO/NotificationFactory.d.ts +0 -4
  29. package/lib/dist/DTO/NotificationFactory.js +0 -18
  30. package/lib/dist/DTO/NotificationIOS.d.ts +0 -12
  31. package/lib/dist/DTO/NotificationIOS.js +0 -40
  32. package/lib/dist/DTO/NotificationIOS.test.d.ts +0 -1
  33. package/lib/dist/DTO/NotificationIOS.test.js +0 -58
  34. package/lib/dist/Notifications.d.ts +0 -65
  35. package/lib/dist/Notifications.js +0 -98
  36. package/lib/dist/NotificationsAndroid.d.ts +0 -14
  37. package/lib/dist/NotificationsAndroid.js +0 -32
  38. package/lib/dist/NotificationsIOS.d.ts +0 -51
  39. package/lib/dist/NotificationsIOS.js +0 -83
  40. package/lib/dist/adapters/CompletionCallbackWrapper.d.ts +0 -11
  41. package/lib/dist/adapters/CompletionCallbackWrapper.js +0 -44
  42. package/lib/dist/adapters/NativeCommandsSender.d.ts +0 -31
  43. package/lib/dist/adapters/NativeCommandsSender.js +0 -73
  44. package/lib/dist/adapters/NativeEventsReceiver.d.ts +0 -19
  45. package/lib/dist/adapters/NativeEventsReceiver.js +0 -47
  46. package/lib/dist/adapters/UniqueIdProvider.d.ts +0 -3
  47. package/lib/dist/adapters/UniqueIdProvider.js +0 -10
  48. package/lib/dist/commands/Commands.d.ts +0 -32
  49. package/lib/dist/commands/Commands.js +0 -79
  50. package/lib/dist/commands/Commands.test.d.ts +0 -1
  51. package/lib/dist/commands/Commands.test.js +0 -201
  52. package/lib/dist/events/EventsRegistry.d.ts +0 -18
  53. package/lib/dist/events/EventsRegistry.js +0 -28
  54. package/lib/dist/events/EventsRegistry.test.d.ts +0 -1
  55. package/lib/dist/events/EventsRegistry.test.js +0 -183
  56. package/lib/dist/events/EventsRegistryIOS.d.ts +0 -12
  57. package/lib/dist/events/EventsRegistryIOS.js +0 -19
  58. package/lib/dist/events/EventsRegistryIOS.test.d.ts +0 -1
  59. package/lib/dist/events/EventsRegistryIOS.test.js +0 -53
  60. package/lib/dist/index.d.ts +0 -7
  61. package/lib/dist/index.js +0 -12
  62. package/lib/dist/interfaces/EventSubscription.d.ts +0 -3
  63. package/lib/dist/interfaces/EventSubscription.js +0 -2
  64. package/lib/dist/interfaces/NotificationActionResponse.d.ts +0 -5
  65. package/lib/dist/interfaces/NotificationActionResponse.js +0 -10
  66. package/lib/dist/interfaces/NotificationCategory.d.ts +0 -18
  67. package/lib/dist/interfaces/NotificationCategory.js +0 -20
  68. package/lib/dist/interfaces/NotificationChannel.d.ts +0 -14
  69. package/lib/dist/interfaces/NotificationChannel.js +0 -2
  70. package/lib/dist/interfaces/NotificationCompletion.d.ts +0 -10
  71. package/lib/dist/interfaces/NotificationCompletion.js +0 -9
  72. package/lib/dist/interfaces/NotificationEvents.d.ts +0 -18
  73. package/lib/dist/interfaces/NotificationEvents.js +0 -2
  74. package/lib/dist/interfaces/NotificationPermissions.d.ts +0 -14
  75. package/lib/dist/interfaces/NotificationPermissions.js +0 -2
  76. package/lib/ios/RNNotifications.xcodeproj/project.xcworkspace/xcuserdata/troy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  77. package/package-lock.json +0 -13507
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationsRoot = void 0;
4
- const NativeCommandsSender_1 = require("./adapters/NativeCommandsSender");
5
- const NativeEventsReceiver_1 = require("./adapters/NativeEventsReceiver");
6
- const Commands_1 = require("./commands/Commands");
7
- const EventsRegistry_1 = require("./events/EventsRegistry");
8
- const EventsRegistryIOS_1 = require("./events/EventsRegistryIOS");
9
- const UniqueIdProvider_1 = require("./adapters/UniqueIdProvider");
10
- const CompletionCallbackWrapper_1 = require("./adapters/CompletionCallbackWrapper");
11
- const NotificationsIOS_1 = require("./NotificationsIOS");
12
- const NotificationsAndroid_1 = require("./NotificationsAndroid");
13
- const NotificationFactory_1 = require("./DTO/NotificationFactory");
14
- class NotificationsRoot {
15
- constructor() {
16
- this.notificationFactory = new NotificationFactory_1.NotificationFactory();
17
- this.nativeEventsReceiver = new NativeEventsReceiver_1.NativeEventsReceiver(this.notificationFactory);
18
- this.nativeCommandsSender = new NativeCommandsSender_1.NativeCommandsSender();
19
- this.completionCallbackWrapper = new CompletionCallbackWrapper_1.CompletionCallbackWrapper(this.nativeCommandsSender);
20
- this.uniqueIdProvider = new UniqueIdProvider_1.UniqueIdProvider();
21
- this.commands = new Commands_1.Commands(this.nativeCommandsSender, this.uniqueIdProvider, this.notificationFactory);
22
- this.eventsRegistry = new EventsRegistry_1.EventsRegistry(this.nativeEventsReceiver, this.completionCallbackWrapper);
23
- this.eventsRegistryIOS = new EventsRegistryIOS_1.EventsRegistryIOS(this.nativeEventsReceiver, this.completionCallbackWrapper);
24
- this._ios = new NotificationsIOS_1.NotificationsIOS(this.commands, this.eventsRegistryIOS);
25
- this._android = new NotificationsAndroid_1.NotificationsAndroid(this.commands);
26
- }
27
- /**
28
- * registerRemoteNotifications
29
- */
30
- registerRemoteNotifications(options) {
31
- this.ios.registerRemoteNotifications(options);
32
- this.android.registerRemoteNotifications();
33
- }
34
- /**
35
- * postLocalNotification
36
- */
37
- postLocalNotification(notification, id) {
38
- return this.commands.postLocalNotification(notification, id);
39
- }
40
- /**
41
- * getInitialNotification
42
- */
43
- getInitialNotification() {
44
- return this.commands.getInitialNotification();
45
- }
46
- /**
47
- * getLastAction
48
- */
49
- getLastAction() {
50
- return this.commands.getLastAction();
51
- }
52
- /**
53
- * setCategories
54
- */
55
- setCategories(categories) {
56
- this.commands.setCategories(categories);
57
- }
58
- /**
59
- * cancelLocalNotification
60
- */
61
- cancelLocalNotification(notificationId) {
62
- return this.commands.cancelLocalNotification(notificationId);
63
- }
64
- /**
65
- * removeAllDeliveredNotifications
66
- */
67
- removeAllDeliveredNotifications() {
68
- return this.commands.removeAllDeliveredNotifications();
69
- }
70
- /**
71
- * isRegisteredForRemoteNotifications
72
- */
73
- isRegisteredForRemoteNotifications() {
74
- return this.commands.isRegisteredForRemoteNotifications();
75
- }
76
- /**
77
- * setNotificationChannel
78
- */
79
- setNotificationChannel(notificationChannel) {
80
- return this.android.setNotificationChannel(notificationChannel);
81
- }
82
- /**
83
- * Obtain the events registry instance
84
- */
85
- events() {
86
- return this.eventsRegistry;
87
- }
88
- /**
89
- * ios/android getters
90
- */
91
- get ios() {
92
- return this._ios;
93
- }
94
- get android() {
95
- return this._android;
96
- }
97
- }
98
- exports.NotificationsRoot = NotificationsRoot;
@@ -1,14 +0,0 @@
1
- import { Commands } from './commands/Commands';
2
- import { NotificationChannel } from './interfaces/NotificationChannel';
3
- export declare class NotificationsAndroid {
4
- private readonly commands;
5
- constructor(commands: Commands);
6
- /**
7
- * Refresh FCM token
8
- */
9
- registerRemoteNotifications(): void;
10
- /**
11
- * setNotificationChannel
12
- */
13
- setNotificationChannel(notificationChannel: NotificationChannel): void;
14
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationsAndroid = void 0;
4
- const react_native_1 = require("react-native");
5
- class NotificationsAndroid {
6
- constructor(commands) {
7
- this.commands = commands;
8
- return new Proxy(this, {
9
- get(target, name) {
10
- if (react_native_1.Platform.OS === 'android') {
11
- return target[name];
12
- }
13
- else {
14
- return () => { };
15
- }
16
- }
17
- });
18
- }
19
- /**
20
- * Refresh FCM token
21
- */
22
- registerRemoteNotifications() {
23
- this.commands.refreshToken();
24
- }
25
- /**
26
- * setNotificationChannel
27
- */
28
- setNotificationChannel(notificationChannel) {
29
- return this.commands.setNotificationChannel(notificationChannel);
30
- }
31
- }
32
- exports.NotificationsAndroid = NotificationsAndroid;
@@ -1,51 +0,0 @@
1
- import { Notification } from './DTO/Notification';
2
- import { Commands } from './commands/Commands';
3
- import { EventsRegistryIOS } from './events/EventsRegistryIOS';
4
- import { NotificationPermissionOptions } from './interfaces/NotificationPermissions';
5
- export declare class NotificationsIOS {
6
- private readonly commands;
7
- private readonly eventsRegistry;
8
- constructor(commands: Commands, eventsRegistry: EventsRegistryIOS);
9
- /**
10
- * Request permissions to send remote notifications
11
- */
12
- registerRemoteNotifications(options?: NotificationPermissionOptions): void;
13
- /**
14
- * Unregister for all remote notifications received via Apple Push Notification service
15
- */
16
- abandonPermissions(): void;
17
- /**
18
- * registerPushKit
19
- */
20
- registerPushKit(): void;
21
- /**
22
- * getBadgeCount
23
- */
24
- getBadgeCount(): Promise<number>;
25
- /**
26
- * setBadgeCount
27
- * @param count number of the new badge count
28
- */
29
- setBadgeCount(count: number): void;
30
- /**
31
- * cancelAllLocalNotifications
32
- */
33
- cancelAllLocalNotifications(): void;
34
- /**
35
- * checkPermissions
36
- */
37
- checkPermissions(): Promise<import("./interfaces/NotificationPermissions").NotificationPermissions>;
38
- /**
39
- * removeDeliveredNotifications
40
- * @param identifiers Array of notification identifiers
41
- */
42
- removeDeliveredNotifications(identifiers: Array<string>): void;
43
- /**
44
- * getDeliveredNotifications
45
- */
46
- getDeliveredNotifications(): Promise<Notification[]>;
47
- /**
48
- * Obtain the events registry instance
49
- */
50
- events(): EventsRegistryIOS;
51
- }
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationsIOS = void 0;
4
- const react_native_1 = require("react-native");
5
- class NotificationsIOS {
6
- constructor(commands, eventsRegistry) {
7
- this.commands = commands;
8
- this.eventsRegistry = eventsRegistry;
9
- return new Proxy(this, {
10
- get(target, name) {
11
- if (react_native_1.Platform.OS === 'ios') {
12
- return target[name];
13
- }
14
- else {
15
- return () => { };
16
- }
17
- }
18
- });
19
- }
20
- /**
21
- * Request permissions to send remote notifications
22
- */
23
- registerRemoteNotifications(options) {
24
- return this.commands.requestPermissions(options);
25
- }
26
- /**
27
- * Unregister for all remote notifications received via Apple Push Notification service
28
- */
29
- abandonPermissions() {
30
- return this.commands.abandonPermissions();
31
- }
32
- /**
33
- * registerPushKit
34
- */
35
- registerPushKit() {
36
- return this.commands.registerPushKit();
37
- }
38
- /**
39
- * getBadgeCount
40
- */
41
- getBadgeCount() {
42
- return this.commands.getBadgeCount();
43
- }
44
- /**
45
- * setBadgeCount
46
- * @param count number of the new badge count
47
- */
48
- setBadgeCount(count) {
49
- return this.commands.setBadgeCount(count);
50
- }
51
- /**
52
- * cancelAllLocalNotifications
53
- */
54
- cancelAllLocalNotifications() {
55
- this.commands.cancelAllLocalNotifications();
56
- }
57
- /**
58
- * checkPermissions
59
- */
60
- checkPermissions() {
61
- return this.commands.checkPermissions();
62
- }
63
- /**
64
- * removeDeliveredNotifications
65
- * @param identifiers Array of notification identifiers
66
- */
67
- removeDeliveredNotifications(identifiers) {
68
- return this.commands.removeDeliveredNotifications(identifiers);
69
- }
70
- /**
71
- * getDeliveredNotifications
72
- */
73
- getDeliveredNotifications() {
74
- return this.commands.getDeliveredNotifications();
75
- }
76
- /**
77
- * Obtain the events registry instance
78
- */
79
- events() {
80
- return this.eventsRegistry;
81
- }
82
- }
83
- exports.NotificationsIOS = NotificationsIOS;
@@ -1,11 +0,0 @@
1
- import { NativeCommandsSender } from './NativeCommandsSender';
2
- import { Notification } from "..";
3
- import { NotificationActionResponse } from '../interfaces/NotificationActionResponse';
4
- export declare class CompletionCallbackWrapper {
5
- private readonly nativeCommandsSender;
6
- constructor(nativeCommandsSender: NativeCommandsSender);
7
- wrapReceivedBackgroundCallback(callback: Function): (notification: Notification) => void;
8
- wrapReceivedForegroundCallback(callback: Function): (notification: Notification) => void;
9
- private wrapReceivedAndInvoke;
10
- wrapOpenedCallback(callback: Function): (notification: object, actionResponse?: NotificationActionResponse) => void;
11
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompletionCallbackWrapper = void 0;
4
- const react_native_1 = require("react-native");
5
- class CompletionCallbackWrapper {
6
- constructor(nativeCommandsSender) {
7
- this.nativeCommandsSender = nativeCommandsSender;
8
- }
9
- wrapReceivedBackgroundCallback(callback) {
10
- return (notification) => {
11
- this.wrapReceivedAndInvoke(callback, notification, true);
12
- };
13
- }
14
- wrapReceivedForegroundCallback(callback) {
15
- return (notification) => {
16
- this.wrapReceivedAndInvoke(callback, notification, false);
17
- };
18
- }
19
- wrapReceivedAndInvoke(callback, notification, background) {
20
- const completion = (response) => {
21
- if (react_native_1.Platform.OS === 'ios') {
22
- const identifier = notification.identifier;
23
- if (background) {
24
- this.nativeCommandsSender.finishHandlingBackgroundAction(identifier, response);
25
- }
26
- else {
27
- this.nativeCommandsSender.finishPresentingNotification(identifier, response);
28
- }
29
- }
30
- };
31
- callback(notification, completion);
32
- }
33
- wrapOpenedCallback(callback) {
34
- return (notification, actionResponse) => {
35
- const completion = () => {
36
- if (react_native_1.Platform.OS === 'ios') {
37
- this.nativeCommandsSender.finishHandlingAction(notification.identifier);
38
- }
39
- };
40
- callback(notification, completion, actionResponse);
41
- };
42
- }
43
- }
44
- exports.CompletionCallbackWrapper = CompletionCallbackWrapper;
@@ -1,31 +0,0 @@
1
- import { Notification } from '../DTO/Notification';
2
- import { NotificationCompletion } from '../interfaces/NotificationCompletion';
3
- import { NotificationPermissions } from '../interfaces/NotificationPermissions';
4
- import { NotificationCategory } from '../interfaces/NotificationCategory';
5
- import { NotificationChannel } from '../interfaces/NotificationChannel';
6
- import { NotificationPermissionOptions } from '../interfaces/NotificationPermissions';
7
- export declare class NativeCommandsSender {
8
- private readonly nativeCommandsModule;
9
- constructor();
10
- postLocalNotification(notification: Notification, id: number): void;
11
- getInitialNotification(): Promise<Object>;
12
- getLastAction(): Promise<Object>;
13
- requestPermissions(options?: NotificationPermissionOptions): void;
14
- abandonPermissions(): void;
15
- refreshToken(): void;
16
- registerPushKit(): void;
17
- setCategories(categories: [NotificationCategory?]): void;
18
- getBadgeCount(): Promise<number>;
19
- setBadgeCount(count: number): void;
20
- cancelLocalNotification(notificationId: number): void;
21
- cancelAllLocalNotifications(): void;
22
- isRegisteredForRemoteNotifications(): Promise<any>;
23
- checkPermissions(): Promise<NotificationPermissions>;
24
- removeAllDeliveredNotifications(): void;
25
- removeDeliveredNotifications(identifiers: Array<string>): void;
26
- getDeliveredNotifications(): Promise<Notification[]>;
27
- finishPresentingNotification(notificationId: string, notificationCompletion: NotificationCompletion): void;
28
- finishHandlingAction(notificationId: string): void;
29
- setNotificationChannel(notificationChannel: NotificationChannel): void;
30
- finishHandlingBackgroundAction(notificationId: string, backgroundFetchResult: string): void;
31
- }
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeCommandsSender = void 0;
4
- const react_native_1 = require("react-native");
5
- class NativeCommandsSender {
6
- constructor() {
7
- this.nativeCommandsModule = react_native_1.NativeModules.RNBridgeModule;
8
- }
9
- postLocalNotification(notification, id) {
10
- return this.nativeCommandsModule.postLocalNotification(notification, id);
11
- }
12
- getInitialNotification() {
13
- return this.nativeCommandsModule.getInitialNotification();
14
- }
15
- getLastAction() {
16
- return this.nativeCommandsModule.getLastAction();
17
- }
18
- requestPermissions(options) {
19
- return this.nativeCommandsModule.requestPermissions(options || {});
20
- }
21
- abandonPermissions() {
22
- return this.nativeCommandsModule.abandonPermissions();
23
- }
24
- refreshToken() {
25
- this.nativeCommandsModule.refreshToken();
26
- }
27
- registerPushKit() {
28
- return this.nativeCommandsModule.registerPushKit();
29
- }
30
- setCategories(categories) {
31
- this.nativeCommandsModule.setCategories(categories);
32
- }
33
- getBadgeCount() {
34
- return this.nativeCommandsModule.getBadgeCount();
35
- }
36
- setBadgeCount(count) {
37
- this.nativeCommandsModule.setBadgeCount(count);
38
- }
39
- cancelLocalNotification(notificationId) {
40
- this.nativeCommandsModule.cancelLocalNotification(notificationId);
41
- }
42
- cancelAllLocalNotifications() {
43
- this.nativeCommandsModule.cancelAllLocalNotifications();
44
- }
45
- isRegisteredForRemoteNotifications() {
46
- return this.nativeCommandsModule.isRegisteredForRemoteNotifications();
47
- }
48
- checkPermissions() {
49
- return this.nativeCommandsModule.checkPermissions();
50
- }
51
- removeAllDeliveredNotifications() {
52
- return this.nativeCommandsModule.removeAllDeliveredNotifications();
53
- }
54
- removeDeliveredNotifications(identifiers) {
55
- return this.nativeCommandsModule.removeDeliveredNotifications(identifiers);
56
- }
57
- getDeliveredNotifications() {
58
- return this.nativeCommandsModule.getDeliveredNotifications();
59
- }
60
- finishPresentingNotification(notificationId, notificationCompletion) {
61
- this.nativeCommandsModule.finishPresentingNotification(notificationId, notificationCompletion);
62
- }
63
- finishHandlingAction(notificationId) {
64
- this.nativeCommandsModule.finishHandlingAction(notificationId);
65
- }
66
- setNotificationChannel(notificationChannel) {
67
- this.nativeCommandsModule.setNotificationChannel(notificationChannel);
68
- }
69
- finishHandlingBackgroundAction(notificationId, backgroundFetchResult) {
70
- this.nativeCommandsModule.finishHandlingBackgroundAction(notificationId, backgroundFetchResult);
71
- }
72
- }
73
- exports.NativeCommandsSender = NativeCommandsSender;
@@ -1,19 +0,0 @@
1
- import { EmitterSubscription } from 'react-native';
2
- import { Registered, RegistrationError, RegisteredPushKit } from '../interfaces/NotificationEvents';
3
- import { Notification } from '../DTO/Notification';
4
- import { NotificationActionResponse } from '../interfaces/NotificationActionResponse';
5
- import { NotificationFactory } from '../DTO/NotificationFactory';
6
- export declare class NativeEventsReceiver {
7
- private readonly notificationFactory;
8
- private emitter;
9
- constructor(notificationFactory?: NotificationFactory);
10
- registerRemoteNotificationsRegistered(callback: (event: Registered) => void): EmitterSubscription;
11
- appNotificationSettingsLinked(callback: () => void): EmitterSubscription;
12
- registerPushKitRegistered(callback: (event: RegisteredPushKit) => void): EmitterSubscription;
13
- registerNotificationReceived(callback: (notification: Notification) => void): EmitterSubscription;
14
- registerNotificationReceivedBackground(callback: (notification: Notification) => void): EmitterSubscription;
15
- registerPushKitNotificationReceived(callback: (event: object) => void): EmitterSubscription;
16
- registerNotificationOpened(callback: (notification: Notification, actionResponse?: NotificationActionResponse) => void): EmitterSubscription;
17
- registerRemoteNotificationsRegistrationFailed(callback: (event: RegistrationError) => void): EmitterSubscription;
18
- registerRemoteNotificationsRegistrationDenied(callback: () => void): EmitterSubscription;
19
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeEventsReceiver = void 0;
4
- const react_native_1 = require("react-native");
5
- const NotificationActionResponse_1 = require("../interfaces/NotificationActionResponse");
6
- const NotificationFactory_1 = require("../DTO/NotificationFactory");
7
- class NativeEventsReceiver {
8
- constructor(notificationFactory = new NotificationFactory_1.NotificationFactory()) {
9
- this.notificationFactory = notificationFactory;
10
- this.emitter = new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNEventEmitter);
11
- }
12
- registerRemoteNotificationsRegistered(callback) {
13
- return this.emitter.addListener('remoteNotificationsRegistered', callback);
14
- }
15
- appNotificationSettingsLinked(callback) {
16
- return this.emitter.addListener('appNotificationSettingsLinked', callback);
17
- }
18
- registerPushKitRegistered(callback) {
19
- return this.emitter.addListener('pushKitRegistered', callback);
20
- }
21
- registerNotificationReceived(callback) {
22
- return this.emitter.addListener('notificationReceived', (payload) => {
23
- callback(this.notificationFactory.fromPayload(payload));
24
- });
25
- }
26
- registerNotificationReceivedBackground(callback) {
27
- return this.emitter.addListener('notificationReceivedBackground', (payload) => {
28
- callback(this.notificationFactory.fromPayload(payload));
29
- });
30
- }
31
- registerPushKitNotificationReceived(callback) {
32
- return this.emitter.addListener('pushKitNotificationReceived', callback);
33
- }
34
- registerNotificationOpened(callback) {
35
- return this.emitter.addListener('notificationOpened', (response) => {
36
- const action = response.action ? new NotificationActionResponse_1.NotificationActionResponse(response.action) : undefined;
37
- callback(this.notificationFactory.fromPayload(response.notification), action);
38
- });
39
- }
40
- registerRemoteNotificationsRegistrationFailed(callback) {
41
- return this.emitter.addListener('remoteNotificationsRegistrationFailed', callback);
42
- }
43
- registerRemoteNotificationsRegistrationDenied(callback) {
44
- return this.emitter.addListener('remoteNotificationsRegistrationDenied', callback);
45
- }
46
- }
47
- exports.NativeEventsReceiver = NativeEventsReceiver;
@@ -1,3 +0,0 @@
1
- export declare class UniqueIdProvider {
2
- generate(): number;
3
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UniqueIdProvider = void 0;
4
- const _ = require("lodash");
5
- class UniqueIdProvider {
6
- generate() {
7
- return parseInt(_.uniqueId());
8
- }
9
- }
10
- exports.UniqueIdProvider = UniqueIdProvider;
@@ -1,32 +0,0 @@
1
- import { NativeCommandsSender } from '../adapters/NativeCommandsSender';
2
- import { Notification } from '../DTO/Notification';
3
- import { NotificationCategory } from '../interfaces/NotificationCategory';
4
- import { NotificationChannel } from '../interfaces/NotificationChannel';
5
- import { NotificationPermissions } from '../interfaces/NotificationPermissions';
6
- import { UniqueIdProvider } from '../adapters/UniqueIdProvider';
7
- import { NotificationFactory } from '../DTO/NotificationFactory';
8
- import { NotificationPermissionOptions } from '../interfaces/NotificationPermissions';
9
- export declare class Commands {
10
- private readonly nativeCommandsSender;
11
- private readonly uniqueIdProvider;
12
- private readonly notificationFactory;
13
- constructor(nativeCommandsSender: NativeCommandsSender, uniqueIdProvider: UniqueIdProvider, notificationFactory: NotificationFactory);
14
- postLocalNotification(notification: Notification, id?: number): number;
15
- getInitialNotification(): Promise<Notification | undefined>;
16
- getLastAction(): Promise<Notification | undefined>;
17
- requestPermissions(options?: NotificationPermissionOptions): void;
18
- abandonPermissions(): void;
19
- registerPushKit(): void;
20
- setCategories(categories: [NotificationCategory?]): void;
21
- getBadgeCount(): Promise<number>;
22
- setBadgeCount(count: number): void;
23
- cancelLocalNotification(notificationId: number): void;
24
- cancelAllLocalNotifications(): void;
25
- isRegisteredForRemoteNotifications(): Promise<boolean>;
26
- checkPermissions(): Promise<NotificationPermissions>;
27
- removeAllDeliveredNotifications(): void;
28
- removeDeliveredNotifications(identifiers: Array<string>): void;
29
- getDeliveredNotifications(): Promise<Notification[]>;
30
- refreshToken(): void;
31
- setNotificationChannel(notificationChannel: NotificationChannel): void;
32
- }
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Commands = void 0;
4
- class Commands {
5
- constructor(nativeCommandsSender, uniqueIdProvider, notificationFactory) {
6
- this.nativeCommandsSender = nativeCommandsSender;
7
- this.uniqueIdProvider = uniqueIdProvider;
8
- this.notificationFactory = notificationFactory;
9
- }
10
- postLocalNotification(notification, id) {
11
- const notificationId = id ? id : this.uniqueIdProvider.generate();
12
- this.nativeCommandsSender.postLocalNotification(notification, notificationId);
13
- return notificationId;
14
- }
15
- async getInitialNotification() {
16
- return this.nativeCommandsSender.getInitialNotification().then((payload) => {
17
- if (payload) {
18
- return this.notificationFactory.fromPayload(payload);
19
- }
20
- return undefined;
21
- });
22
- }
23
- async getLastAction() {
24
- return this.nativeCommandsSender.getLastAction().then((payload) => {
25
- if (payload) {
26
- return this.notificationFactory.fromPayload(payload);
27
- }
28
- return undefined;
29
- });
30
- }
31
- requestPermissions(options) {
32
- const result = this.nativeCommandsSender.requestPermissions(options);
33
- return result;
34
- }
35
- abandonPermissions() {
36
- const result = this.nativeCommandsSender.abandonPermissions();
37
- return result;
38
- }
39
- registerPushKit() {
40
- this.nativeCommandsSender.registerPushKit();
41
- }
42
- setCategories(categories) {
43
- this.nativeCommandsSender.setCategories(categories);
44
- }
45
- getBadgeCount() {
46
- return this.nativeCommandsSender.getBadgeCount();
47
- }
48
- setBadgeCount(count) {
49
- this.nativeCommandsSender.setBadgeCount(count);
50
- }
51
- cancelLocalNotification(notificationId) {
52
- this.nativeCommandsSender.cancelLocalNotification(notificationId);
53
- }
54
- cancelAllLocalNotifications() {
55
- this.nativeCommandsSender.cancelAllLocalNotifications();
56
- }
57
- isRegisteredForRemoteNotifications() {
58
- return this.nativeCommandsSender.isRegisteredForRemoteNotifications();
59
- }
60
- checkPermissions() {
61
- return this.nativeCommandsSender.checkPermissions();
62
- }
63
- removeAllDeliveredNotifications() {
64
- this.nativeCommandsSender.removeAllDeliveredNotifications();
65
- }
66
- removeDeliveredNotifications(identifiers) {
67
- return this.nativeCommandsSender.removeDeliveredNotifications(identifiers);
68
- }
69
- getDeliveredNotifications() {
70
- return this.nativeCommandsSender.getDeliveredNotifications();
71
- }
72
- refreshToken() {
73
- this.nativeCommandsSender.refreshToken();
74
- }
75
- setNotificationChannel(notificationChannel) {
76
- this.nativeCommandsSender.setNotificationChannel(notificationChannel);
77
- }
78
- }
79
- exports.Commands = Commands;
@@ -1 +0,0 @@
1
- export {};