[ReactNative] pass in launchOptions to relevant bridged modules
This commit is contained in:
parent
63ab6e8281
commit
824da1bada
|
@ -13,8 +13,6 @@
|
|||
|
||||
@interface RCTPushNotificationManager : NSObject <RCTBridgeModule>
|
||||
|
||||
- (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
+ (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
|
||||
+ (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification;
|
||||
|
||||
|
|
|
@ -24,14 +24,8 @@ RCT_EXPORT_MODULE()
|
|||
@synthesize bridge = _bridge;
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initWithInitialNotification:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_initialNotification = [initialNotification copy];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(handleRemoteNotificationReceived:)
|
||||
name:RCTRemoteNotificationReceived
|
||||
|
@ -45,6 +39,12 @@ RCT_EXPORT_MODULE()
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)setBridge:(RCTBridge *)bridge
|
||||
{
|
||||
_bridge = bridge;
|
||||
_initialNotification = [bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] copy];
|
||||
}
|
||||
|
||||
+ (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
|
||||
{
|
||||
if ([application respondsToSelector:@selector(registerForRemoteNotifications)]) {
|
||||
|
|
Loading…
Reference in New Issue