@@ -44,19 +44,9 @@ it will add the observers (ie. subscription)
44
44
*/
45
45
@property (atomic ) BOOL waitingForUserConsent;
46
46
47
- @property (atomic ) BOOL hasSetNotificationOpenedHandler;
48
47
@property (atomic ) BOOL hasSetInAppMessageClickedHandler;
49
48
@property (atomic ) BOOL hasSetNotificationWillShowInForegroundHandler;
50
49
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
-
60
50
/*
61
51
Holds reference to any in app messages received before any click action
62
52
occurs on the body, button or image elements of the in app message
@@ -78,7 +68,6 @@ + (instancetype)sharedInstance {
78
68
sharedInstance.waitingForUserConsent = false ;
79
69
sharedInstance.receivedNotificationCache = [NSMutableDictionary new ];;
80
70
sharedInstance.notificationCompletionCache = [NSMutableDictionary new ];;
81
- sharedInstance.hasSetNotificationOpenedHandler = false ;
82
71
sharedInstance.hasSetInAppMessageClickedHandler = false ;
83
72
sharedInstance.hasSetNotificationWillShowInForegroundHandler = false ;
84
73
});
@@ -112,9 +101,6 @@ - (void)addObservers {
112
101
[OneSignal setNotificationWillShowInForegroundHandler: ^(OSNotification *notification, OSNotificationDisplayResponse completion) {
113
102
[OneSignalPlugin.sharedInstance handleNotificationWillShowInForeground: notification completion: completion];
114
103
}];
115
- [OneSignal setNotificationOpenedHandler: ^(OSNotificationOpenedResult * _Nonnull result) {
116
- [OneSignalPlugin.sharedInstance handleNotificationOpened: result];
117
- }];
118
104
}
119
105
120
106
- (void )handleMethodCall : (FlutterMethodCall*)call result : (FlutterResult)result {
@@ -305,12 +291,10 @@ - (void)removeExternalUserId:(FlutterMethodCall *)call withResult:(FlutterResult
305
291
}
306
292
307
293
- (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
+ }];
314
298
}
315
299
316
300
- (void )initInAppMessageClickedHandlerParams {
@@ -328,11 +312,6 @@ - (void)initNotificationWillShowInForegroundHandlerParams {
328
312
329
313
#pragma mark Opened Notification Handlers
330
314
- (void )handleNotificationOpened : (OSNotificationOpenedResult *)result {
331
- if (!self.hasSetNotificationOpenedHandler ) {
332
- _coldStartOpenResult = result;
333
- return ;
334
- }
335
-
336
315
[self .channel invokeMethod: @" OneSignal#handleOpenedNotification" arguments: result.toJson];
337
316
}
338
317
0 commit comments