Skip to content

Commit 4bef2a0

Browse files
committed
Remove cold start handling from iOS
* Cold start handling is being done by native iOS implementation
1 parent 7c5a375 commit 4bef2a0

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

ios/Classes/OneSignalPlugin.m

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,9 @@ it will add the observers (ie. subscription)
4444
*/
4545
@property (atomic) BOOL waitingForUserConsent;
4646

47-
@property (atomic) BOOL hasSetNotificationOpenedHandler;
4847
@property (atomic) BOOL hasSetInAppMessageClickedHandler;
4948
@property (atomic) BOOL hasSetNotificationWillShowInForegroundHandler;
5049

51-
/*
52-
Holds reference to any notifications received before the
53-
flutter runtime channel has been opened
54-
Thus, if a user taps a notification while the app is
55-
terminated, the SDK will still notify the app once the
56-
channel is open
57-
*/
58-
@property (strong, nonatomic) OSNotificationOpenedResult *coldStartOpenResult;
59-
6050
/*
6151
Holds reference to any in app messages received before any click action
6252
occurs on the body, button or image elements of the in app message
@@ -78,7 +68,6 @@ + (instancetype)sharedInstance {
7868
sharedInstance.waitingForUserConsent = false;
7969
sharedInstance.receivedNotificationCache = [NSMutableDictionary new];;
8070
sharedInstance.notificationCompletionCache = [NSMutableDictionary new];;
81-
sharedInstance.hasSetNotificationOpenedHandler = false;
8271
sharedInstance.hasSetInAppMessageClickedHandler = false;
8372
sharedInstance.hasSetNotificationWillShowInForegroundHandler = false;
8473
});
@@ -112,9 +101,6 @@ - (void)addObservers {
112101
[OneSignal setNotificationWillShowInForegroundHandler:^(OSNotification *notification, OSNotificationDisplayResponse completion) {
113102
[OneSignalPlugin.sharedInstance handleNotificationWillShowInForeground:notification completion:completion];
114103
}];
115-
[OneSignal setNotificationOpenedHandler:^(OSNotificationOpenedResult * _Nonnull result) {
116-
[OneSignalPlugin.sharedInstance handleNotificationOpened:result];
117-
}];
118104
}
119105

120106
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
@@ -305,12 +291,10 @@ - (void)removeExternalUserId:(FlutterMethodCall *)call withResult:(FlutterResult
305291
}
306292

307293
- (void)initNotificationOpenedHandlerParams {
308-
_hasSetNotificationOpenedHandler = true;
309-
310-
if (self.coldStartOpenResult) {
311-
[self handleNotificationOpened:self.coldStartOpenResult];
312-
self.coldStartOpenResult = nil;
313-
}
294+
[OneSignal setNotificationOpenedHandler:^(OSNotificationOpenedResult * _Nonnull result) {
295+
[OneSignal onesignalLog:ONE_S_LL_VERBOSE message:@"setNotificationOpenedHandler called from addObservers"];
296+
[OneSignalPlugin.sharedInstance handleNotificationOpened:result];
297+
}];
314298
}
315299

316300
- (void)initInAppMessageClickedHandlerParams {
@@ -328,11 +312,6 @@ - (void)initNotificationWillShowInForegroundHandlerParams {
328312

329313
#pragma mark Opened Notification Handlers
330314
- (void)handleNotificationOpened:(OSNotificationOpenedResult *)result {
331-
if (!self.hasSetNotificationOpenedHandler) {
332-
_coldStartOpenResult = result;
333-
return;
334-
}
335-
336315
[self.channel invokeMethod:@"OneSignal#handleOpenedNotification" arguments:result.toJson];
337316
}
338317

0 commit comments

Comments
 (0)