|
9 | 9 | #import <Foundation/Foundation.h> |
10 | 10 |
|
11 | 11 | #import <Batch/BatchActions.h> |
| 12 | +#import <Batch/BatchMessagingCloseReason.h> |
12 | 13 |
|
13 | 14 | @class BatchInAppMessage, BatchMessage, BatchPushMessage, BatchMessageAction; |
14 | 15 |
|
| 16 | +@protocol BatchInAppDelegate <NSObject> |
| 17 | + |
| 18 | +@optional |
| 19 | + |
| 20 | +/// Called when an In-App message should be presented to the user. |
| 21 | +/// |
| 22 | +/// - Parameter message: In-App message to show. |
| 23 | +- (void)batchInAppMessageReady:(BatchInAppMessage *_Nonnull)message NS_SWIFT_NAME(batchInAppMessageReady(message:)); |
| 24 | + |
| 25 | +@end |
| 26 | + |
15 | 27 | /// Implement this protocol if you want to be notified of what happens to the messaging view (for example, perform some |
16 | 28 | /// analytics on show/hide). |
17 | 29 | @protocol BatchMessagingDelegate <NSObject> |
|
23 | 35 | /// - Parameter messageIdentifier: Analytics message identifier string. Can be nil. |
24 | 36 | - (void)batchMessageDidAppear:(NSString *_Nullable)messageIdentifier; |
25 | 37 |
|
26 | | -/// Called when the message view was dismissed by a user interaction (close button tap, swipe gesture...) |
27 | | -/// |
28 | | -/// - Parameter messageIdentifier: Analytics message identifier string. Can be nil. |
29 | | -- (void)batchMessageWasCancelledByUserAction:(NSString *_Nullable)messageIdentifier |
30 | | - NS_SWIFT_NAME(batchMessageWasCancelledByUserAction(_:)); |
31 | | - |
32 | | -/// Called when the message view was dismissed automatically after the auto closing countdown. |
33 | | -/// |
34 | | -/// - Parameter messageIdentifier: Analytics message identifier string. Can be nil. |
35 | | -- (void)batchMessageWasCancelledByAutoclose:(NSString *_Nullable)messageIdentifier |
36 | | - NS_SWIFT_NAME(batchMessageWasCancelledByAutoclose(_:)); |
37 | | - |
38 | 38 | /// Called when Batch needs to present a message in automatic mode. |
39 | 39 | /// |
40 | 40 | /// Implement this method if you need to specify the view controller that will present Batch content. |
|
52 | 52 | /// - action: Action that will be performed. Fields can be nil if the action was only to dismiss the message on tap. |
53 | 53 | /// __DO NOT__ run the action yourself: the SDK will automatically do it. |
54 | 54 | /// - identifier: Analytics message identifier string. Can be nil. |
55 | | -/// - index: Index of the action/CTA. If the action comes from the "global tap action", the index |
56 | | -/// will be ``BatchMessageGlobalActionIndex`` If the index is greater than or equal to zero, |
| 55 | +/// - ctaIdentifier: Identifier of the action/CTA. If the action comes from the "global tap action", the identifier |
| 56 | +/// will be ``BatchMessageGlobalActionIndex``, |
57 | 57 | /// you can cast the action to ``BatchMessageCTA`` |
58 | 58 | - (void)batchMessageDidTriggerAction:(BatchMessageAction *_Nonnull)action |
59 | 59 | messageIdentifier:(NSString *_Nullable)identifier |
60 | | - actionIndex:(NSInteger)index; |
| 60 | + ctaIdentifier:(NSString *_Nonnull)ctaIdentifier; |
61 | 61 |
|
62 | 62 | /// Called when the message view disappeared from the screen. |
63 | 63 | /// |
64 | | -/// - Parameter messageIdentifier: Analytics message identifier string. Can be nil. |
65 | | -- (void)batchMessageDidDisappear:(NSString *_Nullable)messageIdentifier; |
66 | | - |
67 | | -/// Called when an In-App message should be presented to the user. |
68 | | -/// |
69 | | -/// - Parameter message: In-App message to show. |
70 | | -- (void)batchInAppMessageReady:(nonnull BatchInAppMessage *)message NS_SWIFT_NAME(batchInAppMessageReady(message:)); |
71 | | - |
72 | | -/// Called when the message view was closed because of an error. |
73 | | -/// |
74 | | -/// - Parameter messageIdentifier: Analytics message identifier string. Can be nil. |
75 | | -- (void)batchMessageWasCancelledByError:(NSString *_Nullable)messageIdentifier |
76 | | - NS_SWIFT_NAME(batchMessageWasCancelledByError(_:)); |
77 | | - |
78 | | -/// Called when the WebView message view will be dismissed due to the user navigating away or triggering an action |
79 | | -/// (using the Javascript SDK). |
80 | | -/// |
81 | 64 | /// - Parameters: |
82 | | -/// - action: Action that will be performed. Fields can be nil if the action was only to dismiss the message on |
83 | | -/// tap. __DO NOT__ run the action yourself: the SDK will automatically do it. Can be nil. |
84 | | -/// - messageIdentifier: Analytics message identifier string. Can be nil. |
85 | | -/// - analyticsIdentifier: Click analytic identifier. Matches the `analyticsID` parameter of the Javascript call, |
86 | | -/// or the `batchAnalyticsID` query parameter of a link. |
87 | | -- (void)batchWebViewMessageDidTriggerAction:(BatchMessageAction *_Nullable)action |
88 | | - messageIdentifier:(NSString *_Nullable)messageIdentifier |
89 | | - analyticsIdentifier:(NSString *_Nullable)analyticsIdentifier; |
| 65 | +/// - messageIdentifier: Analytics message identifier string. Can be nil. |
| 66 | +/// - reason: Enum for the different reasons why an In-App message can be closed |
| 67 | +- (void)batchMessageDidDisappear:(NSString *_Nullable)messageIdentifier reason:(BatchMessagingCloseReason)reason; |
90 | 68 |
|
91 | 69 | @end |
92 | 70 |
|
|
97 | 75 | /// handling In-App messages manually. |
98 | 76 | @property (class, nullable) id<BatchMessagingDelegate> delegate; |
99 | 77 |
|
| 78 | +/// Sets Batch's In-App delegate. The delegate is used for handling In-App messages manually |
| 79 | +@property (class, nullable) id<BatchInAppDelegate> inAppDelegate; |
| 80 | + |
100 | 81 | /// Toggles whether Batch should change the shared `AVAudioSession` configuration by itelf. |
101 | 82 | /// |
102 | 83 | /// It is used to avoid stopping the user's music when displaying a video inapp, |
|
107 | 88 | /// Default: true |
108 | 89 | /// |
109 | 90 | /// In-App messaging is not affected by this. If you want to manually display the In-App message, call |
110 | | -/// ``BatchMessaging/setDelegate:`` with a delegate that implement ``BatchMessagingDelegate/batchInAppMessageReady:``. |
| 91 | +/// ``BatchMessaging/setDelegate:`` with a delegate that implement |
| 92 | +/// ``BatchInAppDelegate/batchInAppMessageReady:``. |
111 | 93 | /// - Note: If automatic mode is enabled, manual integration methods will not work. |
112 | 94 | @property (class) BOOL automaticMode; |
113 | 95 |
|
|
0 commit comments