4444***/
4545
4646#import < Foundation/Foundation.h>
47-
48- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
49- #define XC8_AVAILABLE 1
5047#import < UserNotifications/UserNotifications.h>
51- #endif
52-
5348
5449#pragma clang diagnostic push
5550#pragma clang diagnostic ignored "-Wstrict-prototypes"
@@ -73,6 +68,26 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
7368 OSNotificationDisplayTypeNotification
7469};
7570
71+ @interface OSInAppMessageAction : NSObject
72+
73+ // The action name attached to the IAM action
74+ @property (strong , nonatomic , nullable ) NSString *clickName;
75+
76+ // The URL (if any) that should be opened when the action occurs
77+ @property (strong , nonatomic , nullable ) NSURL *clickUrl;
78+
79+ // Whether or not the click action is first click on the IAM
80+ @property (nonatomic ) BOOL firstClick;
81+
82+ // Whether or not the click action dismisses the message
83+ @property (nonatomic ) BOOL closesMessage;
84+
85+ @end
86+
87+ @protocol OSInAppMessageDelegate <NSObject >
88+ @optional
89+ - (void )handleMessageAction : (OSInAppMessageAction * _Nonnull)action NS_SWIFT_NAME(handleMessageAction(action:));
90+ @end
7691
7792@interface OSNotificationAction : NSObject
7893
@@ -155,7 +170,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
155170/* Parses an APS push payload into a OSNotificationPayload object.
156171 Useful to call from your NotificationServiceExtension when the
157172 didReceiveNotificationRequest:withContentHandler: method fires. */
158- +(instancetype )parseWithApns : (nonnull NSDictionary *)message ;
173+ + (instancetype )parseWithApns : (nonnull NSDictionary *)message ;
159174
160175@end
161176
@@ -181,11 +196,8 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
181196@property (readonly , getter =isSilentNotification)BOOL silentNotification;
182197
183198/* iOS 10+: Indicates whether or not the received notification has mutableContent : 1 assigned to its payload
184- Used for UNNotificationServiceExtension to launch extension.
185- */
186- #if XC8_AVAILABLE
199+ Used for UNNotificationServiceExtension to launch extension. */
187200@property (readonly , getter =hasMutableContent)BOOL mutableContent;
188- #endif
189201
190202/* Convert object into an NSString that can be convertible into a custom Dictionary / JSON Object */
191203- (NSString *)stringify ;
@@ -218,16 +230,6 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
218230 OSNotificationPermissionProvisional
219231};
220232
221- typedef void (^OSNotificationDisplayTypeResponse)(OSNotificationDisplayType displayType);
222-
223- // Notification Display Type Delegate
224- // Allows apps to customize per-notification display-type
225- @protocol OSNotificationDisplayTypeDelegate <NSObject >
226- - (void )willPresentInFocusNotificationWithPayload : (OSNotificationPayload *)payload
227- withCompletion : (OSNotificationDisplayTypeResponse)completion ;
228- @end
229-
230-
231233// Permission Classes
232234@interface OSPermissionState : NSObject
233235
@@ -318,6 +320,9 @@ typedef void (^OSHandleNotificationReceivedBlock)(OSNotification* notification);
318320/* Block for handling a user reaction to a notification*/
319321typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * result);
320322
323+ /* Block for handling user click on an in app message*/
324+ typedef void (^OSHandleInAppMessageActionClickBlock)(OSInAppMessageAction* action);
325+
321326/* Dictionary of keys to pass alongside the init settings*/
322327
323328/* Let OneSignal directly prompt for push notifications on init*/
@@ -415,10 +420,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
415420
416421+ (OSPermissionSubscriptionState*)getPermissionSubscriptionState ;
417422
418- // When the app is in-focus, this allows you to add a delegate that can customize the
419- // display type for specific notifications
420- + (void )setNotificationDisplayTypeDelegate : (NSObject <OSNotificationDisplayTypeDelegate>*)delegate ;
421-
422423+ (void )addPermissionObserver : (NSObject <OSPermissionObserver>*)observer ;
423424+ (void )removePermissionObserver : (NSObject <OSPermissionObserver>*)observer ;
424425
@@ -429,6 +430,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
429430+ (void )removeEmailSubscriptionObserver : (NSObject <OSEmailSubscriptionObserver>*)observer ;
430431
431432+ (void )setSubscription : (BOOL )enable ;
433+ + (BOOL )isInAppMessagingPaused ;
434+ + (void )pauseInAppMessages : (BOOL )pause ;
432435
433436// - Posting Notification
434437+ (void )postNotification : (NSDictionary *)jsonData ;
@@ -444,6 +447,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
444447// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
445448+ (void )setMSDKType : (NSString *)type ;
446449
450+ + (void )setInAppMessageClickHandler : (OSHandleInAppMessageActionClickBlock)delegate ;
447451
448452// iOS 10 only
449453// Process from Notification Service Extension.
@@ -474,6 +478,14 @@ typedef void (^OSEmailSuccessBlock)();
474478+ (void )setEmail : (NSString * _Nonnull)email ;
475479+ (void )setEmail : (NSString * _Nonnull)email withEmailAuthHashToken : (NSString * _Nullable)hashToken ;
476480
481+ // In App Messaging Trigger methods
482+ + (void )addTrigger : (NSString * _Nonnull)key withValue : (id _Nonnull)value ;
483+ + (void )addTriggers : (NSDictionary <NSString *, id> * _Nonnull)triggers ;
484+ + (void )removeTriggerForKey : (NSString * _Nonnull)key ;
485+ + (void )removeTriggersForKeys : (NSArray <NSString *> * _Nonnull)keys ;
486+ + (NSDictionary <NSString *, id> * _Nonnull)getTriggers ;
487+ + (id _Nullable)getTriggerValueForKey : (NSString * _Nonnull)key ;
488+
477489+ (void )setExternalUserId : (NSString * _Nonnull)externalId ;
478490+ (void )removeExternalUserId ;
479491
0 commit comments