From baac919188120021626ba241738bb99a81b28d57 Mon Sep 17 00:00:00 2001 From: Ran Greenberg Date: Wed, 12 Jul 2017 15:57:50 +0300 Subject: [PATCH] add isRegisteredForRemoteNotifications to iOS native side --- RNNotifications/RNNotifications.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/RNNotifications/RNNotifications.m b/RNNotifications/RNNotifications.m index e91494d..e10edd1 100644 --- a/RNNotifications/RNNotifications.m +++ b/RNNotifications/RNNotifications.m @@ -549,4 +549,17 @@ RCT_EXPORT_METHOD(cancelAllLocalNotifications) [RCTSharedApplication() cancelAllLocalNotifications]; } +RCT_EXPORT_METHOD(isRegisteredForRemoteNotifications:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) +{ + BOOL ans; + + if (TARGET_IPHONE_SIMULATOR) { + ans = [[[UIApplication sharedApplication] currentUserNotificationSettings] types] != 0; + } + else { + ans = [[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; + } + resolve(@(ans)); +} + @end -- 2.26.2