Skip to content

Commit a8aebe7

Browse files
committed
Remove OSInAppMessage iOS
* Remove OSInAppMessage * Remove InAppMessage lifecycle handler params methods
1 parent 6462641 commit a8aebe7

File tree

1 file changed

+2
-58
lines changed

1 file changed

+2
-58
lines changed

ios/Classes/OneSignalPlugin.m

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ it will add the observers (ie. subscription)
5555

5656
@property (strong, nonatomic) NSMutableDictionary* notificationCompletionCache;
5757
@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;
6558
@end
6659

6760
@implementation OneSignalPlugin
@@ -76,10 +69,6 @@ + (instancetype)sharedInstance {
7669
sharedInstance.notificationCompletionCache = [NSMutableDictionary new];;
7770
sharedInstance.hasSetInAppMessageClickedHandler = false;
7871
sharedInstance.hasSetNotificationWillShowInForegroundHandler = false;
79-
sharedInstance.hasSetOnWillDisplayInAppMessageHandler = false;
80-
sharedInstance.hasSetOnDidDisplayInAppMessageHandler = false;
81-
sharedInstance.hasSetOnWillDismissInAppMessageHandler = false;
82-
sharedInstance.hasSetOnDidDismissInAppMessageHandler = false;
8372
});
8473
return sharedInstance;
8574
}
@@ -162,14 +151,6 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
162151
[self initNotificationWillShowInForegroundHandlerParams];
163152
else if ([@"OneSignal#completeNotification" isEqualToString:call.method])
164153
[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];
173154
else
174155
result(FlutterMethodNotImplemented);
175156
}
@@ -178,11 +159,11 @@ - (void)setAppId:(FlutterMethodCall *)call withResult:(FlutterResult)result {
178159
[OneSignal setInAppMessageClickHandler:^(OSInAppMessageAction *action) {
179160
[self handleInAppMessageClicked:action];
180161
}];
181-
182-
[OneSignal setInAppMessageLifecycleHandler:self];
183162

184163
[OneSignal setAppId:call.arguments[@"appId"]];
185164

165+
[OneSignal setInAppMessageLifecycleHandler: self];
166+
186167
// If the user has required privacy consent, the SDK will not
187168
// add these observers. So we should delay adding the observers
188169
// until consent has been provided.
@@ -419,43 +400,6 @@ - (void)handleInAppMessageClicked:(OSInAppMessageAction *)action {
419400
[self.channel invokeMethod:@"OneSignal#handleClickedInAppMessage" arguments:action.toJson];
420401
}
421402

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-
459403
#pragma mark OSInAppMessageLifeCycleHandler
460404
- (void)onWillDisplayInAppMessage:(OSInAppMessage *) result {
461405
[self.channel invokeMethod:@"OneSignal#onWillDisplayInAppMessage" arguments:result.toJson];

0 commit comments

Comments
 (0)