Commit ade806e5 authored by Yedidya Kennard's avatar Yedidya Kennard Committed by GitHub

Merge pull request #191 from wix/initial_notification_ios

getInitialNotification implemented on iOS
parents 2643b66f 3f13f6f9
...@@ -514,6 +514,17 @@ RCT_EXPORT_METHOD(requestPermissionsWithCategories:(NSArray *)json) ...@@ -514,6 +514,17 @@ RCT_EXPORT_METHOD(requestPermissionsWithCategories:(NSArray *)json)
[RNNotifications requestPermissionsWithCategories:categories]; [RNNotifications requestPermissionsWithCategories:categories];
} }
RCT_EXPORT_METHOD(getInitialNotification:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
{
NSDictionary * notification = nil;
notification = [RNNotificationsBridgeQueue sharedInstance].openedRemoteNotification ?
[RNNotificationsBridgeQueue sharedInstance].openedRemoteNotification :
[RNNotificationsBridgeQueue sharedInstance].openedLocalNotification;
[RNNotificationsBridgeQueue sharedInstance].openedRemoteNotification = nil;
[RNNotificationsBridgeQueue sharedInstance].openedLocalNotification = nil;
resolve(notification);
}
RCT_EXPORT_METHOD(log:(NSString *)message) RCT_EXPORT_METHOD(log:(NSString *)message)
{ {
NSLog(message); NSLog(message);
......
...@@ -180,6 +180,15 @@ export default class NotificationsIOS { ...@@ -180,6 +180,15 @@ export default class NotificationsIOS {
NativeRNNotifications.log(message); NativeRNNotifications.log(message);
} }
static async getInitialNotification() {
const notification = await NativeRNNotifications.getInitialNotification();
if (notification) {
return new IOSNotification(notification);
} else {
return undefined;
}
}
/** /**
* Presenting local notification * Presenting local notification
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment