From b37ed53f35cbbf6f541a18f5a3c402acc18126f0 Mon Sep 17 00:00:00 2001 From: yogevbd Date: Wed, 2 Oct 2019 13:43:04 +0300 Subject: [PATCH] Add identical registerRemoteNotifications api for iOS and Android --- lib/src/Notifications.ts | 8 ++++++++ lib/src/NotificationsAndroid.ts | 4 ++-- lib/src/NotificationsIOS.ts | 2 +- lib/src/adapters/NativeCommandsSender.ts | 2 +- lib/src/commands/Commands.ts | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/src/Notifications.ts b/lib/src/Notifications.ts index 1669402..58e9f85 100644 --- a/lib/src/Notifications.ts +++ b/lib/src/Notifications.ts @@ -35,6 +35,14 @@ export class NotificationsRoot { this.android = new NotificationsAndroid(this.commands); } + /** + * registerRemoteNotifications + */ + public registerRemoteNotifications() { + this.ios.registerRemoteNotifications(); + this.android.registerRemoteNotifications(); + } + /** * postLocalNotification */ diff --git a/lib/src/NotificationsAndroid.ts b/lib/src/NotificationsAndroid.ts index 8688512..33686e2 100644 --- a/lib/src/NotificationsAndroid.ts +++ b/lib/src/NotificationsAndroid.ts @@ -17,7 +17,7 @@ export class NotificationsAndroid { /** * Refresh FCM token */ - public refreshToken() { - return this.commands.refreshToken(); + public registerRemoteNotifications() { + this.commands.refreshToken(); } } diff --git a/lib/src/NotificationsIOS.ts b/lib/src/NotificationsIOS.ts index cb4a08b..73f1e1d 100644 --- a/lib/src/NotificationsIOS.ts +++ b/lib/src/NotificationsIOS.ts @@ -18,7 +18,7 @@ export class NotificationsIOS { /** * Request permissions to send remote notifications */ - public requestPermissions() { + public registerRemoteNotifications() { return this.commands.requestPermissions(); } diff --git a/lib/src/adapters/NativeCommandsSender.ts b/lib/src/adapters/NativeCommandsSender.ts index 67b7c26..12d2c6f 100644 --- a/lib/src/adapters/NativeCommandsSender.ts +++ b/lib/src/adapters/NativeCommandsSender.ts @@ -48,7 +48,7 @@ export class NativeCommandsSender { } refreshToken() { - return this.nativeCommandsModule.refreshToken(); + this.nativeCommandsModule.refreshToken(); } registerPushKit() { diff --git a/lib/src/commands/Commands.ts b/lib/src/commands/Commands.ts index eed7b75..9e5ea0e 100644 --- a/lib/src/commands/Commands.ts +++ b/lib/src/commands/Commands.ts @@ -78,6 +78,6 @@ export class Commands { } public refreshToken() { - return this.nativeCommandsSender.refreshToken(); + this.nativeCommandsSender.refreshToken(); } } -- 2.26.2