@@ -55,13 +55,6 @@ it will add the observers (ie. subscription)
55
55
56
56
@property (strong , nonatomic ) NSMutableDictionary * notificationCompletionCache;
57
57
@property (strong , nonatomic ) NSMutableDictionary * receivedNotificationCache;
58
-
59
- @property (atomic ) BOOL hasSetOnWillDisplayInAppMessageHandler;
60
- @property (atomic ) BOOL hasSetOnDidDisplayInAppMessageHandler;
61
- @property (atomic ) BOOL hasSetOnWillDismissInAppMessageHandler;
62
- @property (atomic ) BOOL hasSetOnDidDismissInAppMessageHandler;
63
-
64
- @property (strong , nonatomic ) OSInAppMessage *inAppMessage;
65
58
@end
66
59
67
60
@implementation OneSignalPlugin
@@ -76,10 +69,6 @@ + (instancetype)sharedInstance {
76
69
sharedInstance.notificationCompletionCache = [NSMutableDictionary new ];;
77
70
sharedInstance.hasSetInAppMessageClickedHandler = false ;
78
71
sharedInstance.hasSetNotificationWillShowInForegroundHandler = false ;
79
- sharedInstance.hasSetOnWillDisplayInAppMessageHandler = false ;
80
- sharedInstance.hasSetOnDidDisplayInAppMessageHandler = false ;
81
- sharedInstance.hasSetOnWillDismissInAppMessageHandler = false ;
82
- sharedInstance.hasSetOnDidDismissInAppMessageHandler = false ;
83
72
});
84
73
return sharedInstance;
85
74
}
@@ -162,14 +151,6 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
162
151
[self initNotificationWillShowInForegroundHandlerParams ];
163
152
else if ([@" OneSignal#completeNotification" isEqualToString: call.method])
164
153
[self completeNotification: call withResult: result];
165
- else if ([@" OneSignal#onWillDisplayInAppMessageHandlerParams" isEqualToString: call.method])
166
- [self onWillDisplayInAppMessageHandlerParams ];
167
- else if ([@" OneSignal#onDidDisplayInAppMessageHandlerParams" isEqualToString: call.method])
168
- [self onDidDisplayInAppMessageHandlerParams ];
169
- else if ([@" OneSignal#onWillDismissInAppMessageHandlerParams" isEqualToString: call.method])
170
- [self onWillDismissInAppMessageHandlerParams ];
171
- else if ([@" OneSignal#onDidDismissInAppMessageHandlerParams" isEqualToString: call.method])
172
- [self onDidDismissInAppMessageHandlerParams ];
173
154
else
174
155
result (FlutterMethodNotImplemented);
175
156
}
@@ -178,11 +159,11 @@ - (void)setAppId:(FlutterMethodCall *)call withResult:(FlutterResult)result {
178
159
[OneSignal setInAppMessageClickHandler: ^(OSInAppMessageAction *action) {
179
160
[self handleInAppMessageClicked: action];
180
161
}];
181
-
182
- [OneSignal setInAppMessageLifecycleHandler: self ];
183
162
184
163
[OneSignal setAppId: call.arguments[@" appId" ]];
185
164
165
+ [OneSignal setInAppMessageLifecycleHandler: self ];
166
+
186
167
// If the user has required privacy consent, the SDK will not
187
168
// add these observers. So we should delay adding the observers
188
169
// until consent has been provided.
@@ -419,43 +400,6 @@ - (void)handleInAppMessageClicked:(OSInAppMessageAction *)action {
419
400
[self .channel invokeMethod: @" OneSignal#handleClickedInAppMessage" arguments: action.toJson];
420
401
}
421
402
422
- #pragma mark In App Message lifecycle Handler
423
- - (void )onWillDisplayInAppMessageHandlerParams {
424
- self.hasSetOnWillDisplayInAppMessageHandler = YES ;
425
-
426
- if (self.inAppMessage ) {
427
- [self onWillDisplayInAppMessage: self .inAppMessage];
428
- self.inAppMessage = nil ;
429
- }
430
- }
431
-
432
- - (void )onDidDisplayInAppMessageHandlerParams {
433
- self.hasSetOnDidDisplayInAppMessageHandler = YES ;
434
-
435
- if (self.inAppMessage ) {
436
- [self onDidDisplayInAppMessage: self .inAppMessage];
437
- self.inAppMessage = nil ;
438
- }
439
- }
440
-
441
- - (void )onWillDismissInAppMessageHandlerParams {
442
- self.hasSetOnWillDismissInAppMessageHandler = YES ;
443
-
444
- if (self.inAppMessage ) {
445
- [self onWillDismissInAppMessage: self .inAppMessage];
446
- self.inAppMessage = nil ;
447
- }
448
- }
449
-
450
- - (void )onDidDismissInAppMessageHandlerParams {
451
- self.hasSetOnDidDismissInAppMessageHandler = YES ;
452
-
453
- if (self.inAppMessage ) {
454
- [self onDidDismissInAppMessage: self .inAppMessage];
455
- self.inAppMessage = nil ;
456
- }
457
- }
458
-
459
403
#pragma mark OSInAppMessageLifeCycleHandler
460
404
- (void )onWillDisplayInAppMessage : (OSInAppMessage *) result {
461
405
[self .channel invokeMethod: @" OneSignal#onWillDisplayInAppMessage" arguments: result.toJson];
0 commit comments