Skip to content

Commit 343775d

Browse files
committed
Call initWithLaunchOptions under registerWithRegistrar
* Fix open handler not called on cold start
1 parent dda626c commit 343775d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ios/Classes/OneSignalPlugin.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ + (instancetype)sharedInstance {
7777
#pragma mark FlutterPlugin
7878
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
7979

80+
[OneSignal initWithLaunchOptions:nil];
8081
[OneSignal setMSDKType:@"flutter"];
8182

8283
// Wrapper SDK's call init with no app ID early on in the
@@ -153,7 +154,6 @@ - (void)setAppId:(FlutterMethodCall *)call withResult:(FlutterResult)result {
153154
[self handleInAppMessageClicked:action];
154155
}];
155156

156-
[OneSignal initWithLaunchOptions:nil];
157157
[OneSignal setAppId:call.arguments[@"appId"]];
158158

159159
// If the user has required privacy consent, the SDK will not
@@ -292,7 +292,6 @@ - (void)removeExternalUserId:(FlutterMethodCall *)call withResult:(FlutterResult
292292

293293
- (void)initNotificationOpenedHandlerParams {
294294
[OneSignal setNotificationOpenedHandler:^(OSNotificationOpenedResult * _Nonnull result) {
295-
[OneSignal onesignalLog:ONE_S_LL_VERBOSE message:@"setNotificationOpenedHandler called from addObservers"];
296295
[OneSignalPlugin.sharedInstance handleNotificationOpened:result];
297296
}];
298297
}

0 commit comments

Comments
 (0)