Skip to content

Commit 85f8704

Browse files
committed
forwarding InAppMessageDelegate to OSMessagingController
1 parent 3ef1dd1 commit 85f8704

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

iOS_SDK/OneSignalSDK/Source/OSInAppMessageInternal.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#import "OneSignalHelper.h"
3030
#import "OneSignalCommonDefines.h"
3131

32+
@implementation OSInAppMessage
33+
@end
34+
3235
@interface OSInAppMessageInternal ()
3336

3437
@property (strong, nonatomic, nonnull) NSMutableSet <NSString *> *clickedClickIds;

iOS_SDK/OneSignalSDK/Source/OSMessagingController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
6464
- (id)getTriggerValueForKey:(NSString *)key;
6565

6666
- (void)setInAppMessageClickHandler:(OSInAppMessageClickBlock)actionClickBlock;
67+
- (void)setInAppMessageDelegate:(NSObject<OSInAppMessageDelegate>*)delegate;
6768

6869
@end
6970

iOS_SDK/OneSignalSDK/Source/OSMessagingController.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ @interface OSMessagingController ()
6969
// Click action block to allow overridden behavior when clicking an IAM
7070
@property (strong, nonatomic, nullable) OSInAppMessageClickBlock actionClickBlock;
7171

72+
@property (weak, nonatomic, nullable) NSObject<OSInAppMessageDelegate> *inAppMessageDelegate;
73+
7274
@property (strong, nullable) OSInAppMessageViewController *viewController;
7375

7476
@property (nonatomic, readwrite) NSTimeInterval (^dateGenerator)(void);
7577

76-
@property (nonatomic, nullable) NSObject<OSInAppMessagePrompt>*currentPromptAction;
78+
@property (nonatomic, nullable) NSObject<OSInAppMessagePrompt> *currentPromptAction;
7779

7880
@property (nonatomic, nullable) NSArray<NSObject<OSInAppMessagePrompt> *> *currentPromptActions;
7981

@@ -227,6 +229,10 @@ - (void)setInAppMessageClickHandler:(OSInAppMessageClickBlock)actionClickBlock {
227229
self.actionClickBlock = actionClickBlock;
228230
}
229231

232+
- (void)setInAppMessageDelegate:(NSObject<OSInAppMessageDelegate>*)delegate {
233+
self.inAppMessageDelegate = delegate;
234+
}
235+
230236
- (void)presentInAppMessage:(OSInAppMessageInternal *)message {
231237
if (!message.variantId) {
232238
let errorMessage = [NSString stringWithFormat:@"Attempted to display a message with a nil variantId. Current preferred language is %@, supported message variants are %@", NSLocale.preferredLanguages, message.variants];
@@ -802,6 +808,7 @@ - (void)webViewContentFinishedLoading:(OSInAppMessageInternal *)message {
802808
[self addKeySceneToWindow:self.window];
803809

804810
[self.window makeKeyAndVisible];
811+
// Did Display
805812
}
806813

807814
// Required to display if the app is using a Scene

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ + (void)setInAppMessageClickHandler:(OSInAppMessageClickBlock)block {
723723

724724
+ (void)setInAppMessageDelegate:(NSObject<OSInAppMessageDelegate> *_Nullable)delegate; {
725725
[OneSignal onesignal_Log:ONE_S_LL_VERBOSE message:@"In app message delegate set successfully"];
726+
[OSMessagingController.sharedInstance setInAppMessageDelegate:delegate];
726727
}
727728

728729
/*

0 commit comments

Comments
 (0)