@selligent-marketing-cloud/selligent-react-native 2.3.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +311 -315
- package/RNSelligent.podspec +3 -4
- package/android/build.gradle +39 -31
- package/android/libs/sdk-release.aar +0 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +41 -18
- package/android/src/main/java/com/selligent/SMSettingsFactory.java +1 -1
- package/android/src/main/java/com/selligent/Settings.java +14 -7
- package/constants.d.ts +18 -12
- package/constants.js +29 -25
- package/index.android.js +42 -0
- package/index.d.ts +14 -12
- package/index.ios.js +12 -29
- package/index.js +11 -31
- package/ios/ClientSettings.h +2 -1
- package/ios/ClientSettings.m +4 -2
- package/ios/EnumMapper.h +3 -8
- package/ios/EnumMapper.m +8 -26
- package/ios/RNSelligent.m +25 -27
- package/ios/RemoteMessageDisplayType.h +5 -0
- package/ios/SMManagerSetting+ClientSettings.m +10 -4
- package/ios/SelligentReactNative.xcodeproj/project.pbxproj +4 -12
- package/ios/include/SMBaseMessage.h +8 -12
- package/ios/include/SMBlock.h +2 -2
- package/ios/include/SMClearCache.h +0 -2
- package/ios/include/SMContentAlignment.h +1 -2
- package/ios/include/SMDeviceInfos.h +10 -8
- package/ios/include/SMDisplayMode.h +1 -2
- package/ios/include/SMEvent.h +20 -16
- package/ios/include/SMEventUser.h +0 -1
- package/ios/include/SMEventUserLogin.h +11 -16
- package/ios/include/SMEventUserLogout.h +12 -16
- package/ios/include/SMEventUserRegistration.h +12 -17
- package/ios/include/SMEventUserUnregistration.h +12 -16
- package/ios/include/SMFailure.h +1 -6
- package/ios/include/SMHelper.h +7 -2
- package/ios/include/SMInAppContentHTMLViewController.h +11 -9
- package/ios/include/SMInAppContentImageViewController.h +6 -6
- package/ios/include/SMInAppContentMessage.h +12 -12
- package/ios/include/SMInAppContentStyleOptions.h +91 -79
- package/ios/include/SMInAppContentType.h +2 -3
- package/ios/include/SMInAppContentURLViewController.h +10 -9
- package/ios/include/SMInAppContentViewController.h +3 -6
- package/ios/include/SMInAppMessage.h +22 -14
- package/ios/include/SMInAppMessageType.h +2 -6
- package/ios/include/SMInAppRefreshType.h +1 -1
- package/ios/include/SMLink.h +7 -11
- package/ios/include/SMLog.h +1 -1
- package/ios/include/SMManager+DataTransaction.h +6 -13
- package/ios/include/SMManager+InAppContent.h +20 -23
- package/ios/include/SMManager+InAppMessage.h +65 -42
- package/ios/include/SMManager+Log.h +3 -14
- package/ios/include/SMManager+RemoteNotification.h +38 -34
- package/ios/include/SMManager+SMEvent.h +10 -10
- package/ios/include/SMManager+SMLink.h +44 -0
- package/ios/include/SMManager+SilentPush.h +5 -22
- package/ios/include/SMManager+StyleOptions.h +5 -8
- package/ios/include/SMManager+UserNotification.h +45 -33
- package/ios/include/SMManager+ViewController.h +45 -0
- package/ios/include/SMManager.h +14 -23
- package/ios/include/SMManagerInAppMessageDelegate.h +24 -0
- package/ios/include/SMManagerSetting.h +61 -33
- package/ios/include/SMManagerSettingIAC.h +6 -17
- package/ios/include/SMManagerSettingIAM.h +7 -16
- package/ios/include/SMManagerUniversalLinksDelegate.h +23 -0
- package/ios/include/SMMessage.h +1 -3
- package/ios/include/SMNSNotification.h +19 -5
- package/ios/include/SMNotificationAnnotationData.h +4 -8
- package/ios/include/SMNotificationButtonData.h +1 -6
- package/ios/include/SMNotificationButtonType.h +1 -14
- package/ios/include/SMNotificationMessage.h +31 -0
- package/ios/include/SMRemoteMessageDisplayType.h +32 -0
- package/ios/include/SMSuccess.h +1 -4
- package/ios/{libSelligentMobile2.5.2.a → libSelligentMobile.a} +0 -0
- package/package.json +3 -3
- package/trigger.yml +9 -0
- package/ios/LocationAuthorisationStatus.h +0 -6
- package/ios/LocationAuthorisationType.h +0 -4
- package/ios/include/SMLocationAuthorisationType.h +0 -57
- package/ios/include/SMManager+Location.h +0 -97
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
#import "SMManager.h"
|
|
10
10
|
|
|
11
|
+
@class SMNotificationMessage;
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* This category contains the basic step-by-step implementation to get you started.
|
|
14
15
|
* Make sure to read the category SMManager(SilentPush) to learn more about background-remote-notification.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
+
* ##Handling Remote Notifications
|
|
17
18
|
* In order to receive remote-notification from the back-end, all the following methods must be included in you application's delegate:
|
|
18
19
|
*
|
|
19
20
|
* - didRegisterForRemoteNotificationsWithDeviceToken:
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
*
|
|
24
25
|
* Finally, make sure to call registerForRemoteNotification according to your application's need.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
+
* ##Receiving Remote Notifications
|
|
27
28
|
* When a remote-notification is received, the library will automatically display a custom UIViewController.
|
|
28
29
|
* Should you want to prevent this behaviour, feel free to configure the SMManagerSetting accordingly before starting the SMManager.
|
|
29
30
|
*
|
|
@@ -33,21 +34,16 @@
|
|
|
33
34
|
* Finally, should you want to know when the user interact with UIViewController's control, an NSNotification is also posted providing information about the selected element.
|
|
34
35
|
* For additionnal information about NSNotification processing and handling, please check SMNSNotification
|
|
35
36
|
*
|
|
36
|
-
*
|
|
37
|
+
* ##Displaying notification
|
|
37
38
|
* The application can display any notification based on its ID using the API displayNotificationID:
|
|
38
39
|
* These IDs can be retrieved from broadcasted NSNotification.
|
|
39
40
|
* (Please read SMNSNotification for additional information).
|
|
40
41
|
*
|
|
41
42
|
* A convenient method is provided to display the last received remote-notification using displayLastReceivedRemotePushNotification
|
|
42
43
|
*
|
|
43
|
-
* #SMManager+RemoteNotification :#
|
|
44
|
-
*
|
|
45
44
|
*/
|
|
46
45
|
@interface SMManager (RemoteNotification)
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
47
|
/*!
|
|
52
48
|
* Mandatory method which allows notification registration
|
|
53
49
|
*
|
|
@@ -56,29 +52,35 @@
|
|
|
56
52
|
* However, you may call this API later in your code according to your application need. Just remember that this call is mandatory to receive remote-notifications
|
|
57
53
|
* @warning If your device has already been registered to remote-notifications by your application or a third-party framework, then this call is not mandatory.
|
|
58
54
|
*/
|
|
59
|
-
- (void)registerForRemoteNotification;
|
|
55
|
+
- (void) registerForRemoteNotification;
|
|
60
56
|
|
|
57
|
+
/*!
|
|
58
|
+
* Optional method which allows getting a provisional push token [more info](https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications)
|
|
59
|
+
*
|
|
60
|
+
* @discussion This API will automatically obtain a push token without asking the user, triggering registerForRemoteNotification afterwards will still present the prompt to the user.
|
|
61
|
+
* @warning iOS 12+ method, do only implement this method when you have a clear strategy about how to engage with these type of users.
|
|
62
|
+
*/
|
|
63
|
+
- (void) registerForProvisionalRemoteNotification API_AVAILABLE(macos(10.14), ios(12.0), watchos(5.0), tvos(12.0));
|
|
61
64
|
|
|
62
65
|
/**
|
|
63
66
|
* Use this API to unregister the current device. In other words, the device will not receive any remote-notification from our backend server anymore.
|
|
64
|
-
* @warning This does NOT call unregisterForRemoteNotifications on the sharedApplication instance.
|
|
67
|
+
* @warning Deprecated method. This does NOT call unregisterForRemoteNotifications on the sharedApplication instance.
|
|
65
68
|
* Therefore, the application can still receive third-party remote-notifications.
|
|
66
69
|
*/
|
|
67
|
-
- (void)unregisterForRemoteNotification __deprecated __deprecated_msg("Use disableRemoteNotification instead.");
|
|
68
|
-
|
|
70
|
+
- (void) unregisterForRemoteNotification __deprecated __deprecated_msg("Use disableRemoteNotification instead.");
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
73
|
* Use this API to enable the selligent notification on current device. In other words, the device will receive any remote-notification from selligent backend server.
|
|
72
|
-
* @warning This is independent from
|
|
74
|
+
* @warning This is independent from registerForRemoteNotification and from notification settings for the app on device level.
|
|
73
75
|
*/
|
|
74
|
-
- (void)enableRemoteNotification;
|
|
76
|
+
- (void) enableRemoteNotification;
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* Use this API to disable the selligent notification on current device. In other words, the device will not receive any remote-notification from selligent backend server anymore.
|
|
78
80
|
* @warning This does NOT call unregisterForRemoteNotifications on the sharedApplication instance.
|
|
79
81
|
* Therefore, the application can still receive third-party remote-notifications.
|
|
80
82
|
*/
|
|
81
|
-
- (void)disableRemoteNotification;
|
|
83
|
+
- (void) disableRemoteNotification;
|
|
82
84
|
|
|
83
85
|
/*!
|
|
84
86
|
* Mandatory API to be included in application:didRegisterForRemoteNotificationsWithDeviceToken:
|
|
@@ -86,28 +88,23 @@
|
|
|
86
88
|
* @param deviceToken A string that identifies the device to APNs.
|
|
87
89
|
* @discussion This method is mandatory to handle properly all notifications
|
|
88
90
|
*/
|
|
89
|
-
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*) deviceToken;
|
|
90
|
-
|
|
91
|
+
- (void) didRegisterForRemoteNotificationsWithDeviceToken:(NSData*_Nonnull) deviceToken;
|
|
91
92
|
|
|
92
93
|
/*!
|
|
93
|
-
* @warning Deprecated method - replaced by didRegisterUserNotificationSettings;
|
|
94
94
|
* Mandatory API to be included in application:didRegisterUserNotificationSettings
|
|
95
95
|
*
|
|
96
96
|
* @param notificationSettings The user notification settings that are available to your app.
|
|
97
97
|
* @discussion This method confirms the type of notification the user would like to receive.
|
|
98
|
-
* @
|
|
98
|
+
* @warning Deprecated method - replaced by didRegisterUserNotificationSettings;
|
|
99
99
|
*/
|
|
100
|
-
- (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings
|
|
101
|
-
|
|
100
|
+
- (void) didRegisterUserNotificationSettings:(UIUserNotificationSettings*_Nonnull)notificationSettings __deprecated;
|
|
102
101
|
|
|
103
102
|
/*!
|
|
104
103
|
* Mandatory API to be included in application:didRegisterUserNotificationSettings
|
|
105
104
|
*
|
|
106
105
|
* @discussion This method confirms the type of notification the user would like to receive.
|
|
107
106
|
*/
|
|
108
|
-
- (void)didRegisterUserNotificationSettings;
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
- (void) didRegisterUserNotificationSettings;
|
|
111
108
|
|
|
112
109
|
/*!
|
|
113
110
|
* Mandatory API to be included in application:didFailToRegisterForRemoteNotificationsWithError
|
|
@@ -115,8 +112,7 @@
|
|
|
115
112
|
* @param error An NSError object that encapsulates information why registration did not succeed. Provided by the delegate call
|
|
116
113
|
* @discussion Called when the user has deactivated remote-notification or if any other error happen.
|
|
117
114
|
*/
|
|
118
|
-
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
|
|
119
|
-
|
|
115
|
+
- (void) didFailToRegisterForRemoteNotificationsWithError:(NSError *_Nonnull)error;
|
|
120
116
|
|
|
121
117
|
/*!
|
|
122
118
|
* Mandatory API to be included in application:didReceiveRemoteNotification
|
|
@@ -126,7 +122,7 @@
|
|
|
126
122
|
* @discussion This method is not mandatory anymore if you implement didReceiveRemoteNotification:fetchCompletionHandler:
|
|
127
123
|
* For additional information about background-remote-notifications, please check SMManager(SilentPush) for further details.
|
|
128
124
|
*/
|
|
129
|
-
- (void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
|
|
125
|
+
- (void) didReceiveRemoteNotification:(NSDictionary *_Nonnull)userInfo;
|
|
130
126
|
|
|
131
127
|
/**
|
|
132
128
|
* Display a notification based on its ID
|
|
@@ -137,8 +133,7 @@
|
|
|
137
133
|
* This feature has initially been added to allow applications to display remote-notifications at any time (not directly when the push is received).
|
|
138
134
|
* Then, it has been extended to display In-App-Messages. For additional information about IAM, please read SMManager(InAppMessage).
|
|
139
135
|
*/
|
|
140
|
-
- (void)displayNotificationID:(NSString*)idNotification;
|
|
141
|
-
|
|
136
|
+
- (void) displayNotificationID:(NSString*_Nullable)idNotification;
|
|
142
137
|
|
|
143
138
|
/**
|
|
144
139
|
* Retrieve and display the last known notification.
|
|
@@ -148,9 +143,7 @@
|
|
|
148
143
|
* At this stage, only the very last remote-notification can be recovered, previous ones are automaticly overriden.
|
|
149
144
|
* To learn more about this API, please read documentation in [SMManagerSetting](SMManagerSetting), more particularly [SMManagerSetting shouldDisplayRemoteNotification]
|
|
150
145
|
*/
|
|
151
|
-
- (void)displayLastReceivedRemotePushNotification;
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
- (void) displayLastReceivedRemotePushNotification;
|
|
154
147
|
|
|
155
148
|
/**
|
|
156
149
|
* Retrieve information about the last received remote-notification
|
|
@@ -160,8 +153,19 @@
|
|
|
160
153
|
* At this stage, only the very last remote-notification can be recovered, previous ones are automaticly overriden.
|
|
161
154
|
* To learn more about this API, please read documentation in [SMManagerSetting](SMManagerSetting), more particularly [SMManagerSetting shouldDisplayRemoteNotification]
|
|
162
155
|
*/
|
|
163
|
-
- (NSDictionary*)retrieveLastRemotePushNotification;
|
|
164
|
-
|
|
156
|
+
- (NSDictionary*_Nullable) retrieveLastRemotePushNotification;
|
|
165
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Tells to the SDK that a certain SMNotificationMessage object has been seen.
|
|
160
|
+
* The SDK will send an opened event to the Selligent platform.
|
|
161
|
+
*
|
|
162
|
+
* @param notificationMessage SMNotificationMessage that needs to be marked as seen.
|
|
163
|
+
* @discussion This is a convinient method when the behaviour when receiving a remote-notification is handled at App side
|
|
164
|
+
* and the standard events need to be sent back to the Selligent platform.
|
|
165
|
+
* @warning The App will be fully responsible of possible event duplication in the Selligent platform when implementing this method,
|
|
166
|
+
* as each execution will trigger a new event, so make sure to just trigger it once if you don't want this to happen.
|
|
167
|
+
* @see SMNotificationMessage
|
|
168
|
+
*/
|
|
169
|
+
- (void) setNotificationMessageAsSeen:(SMNotificationMessage*_Nullable)notificationMessage;
|
|
166
170
|
|
|
167
171
|
@end
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
@class SMEvent;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* #Sending events :#
|
|
15
14
|
* Sending any set of data to the back-end can be done with the API sendSMEvent:
|
|
16
15
|
*
|
|
17
|
-
*
|
|
16
|
+
* ##Event type
|
|
18
17
|
* Few default events are already available for you to be used.
|
|
19
18
|
* They all inhirit from SMEvent and are configurable through their constructors.
|
|
20
19
|
* At the time of this writing, they default provided events are :
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
* * SMEventUserRegistration
|
|
25
24
|
* * SMEventUserUnregistration
|
|
26
25
|
*
|
|
27
|
-
*
|
|
26
|
+
* ##Custom events
|
|
28
27
|
* Simplest case is to create an instance of SMEvent.
|
|
29
28
|
* Then, inject your data in it (Code example bellow).
|
|
30
29
|
*
|
|
@@ -32,36 +31,37 @@
|
|
|
32
31
|
*
|
|
33
32
|
* The library will keep sending events to the backend as far as they inhirit from SMEvent.
|
|
34
33
|
*
|
|
35
|
-
*
|
|
34
|
+
* ##Injecting custom data in events
|
|
36
35
|
* Any information can be appended to an event and sent to your back-end.
|
|
37
36
|
* This is basically done by creating a dictionary containing your data and injecting it as in the example bellow.
|
|
38
37
|
*
|
|
39
38
|
*
|
|
40
39
|
* @code
|
|
41
40
|
* // Dictionary with your custom data
|
|
41
|
+
*
|
|
42
42
|
* NSDictionary *dictMyCustomData = @{@"MyKey": @"MyValue"};
|
|
43
|
+
*
|
|
43
44
|
* // Create the event
|
|
45
|
+
*
|
|
44
46
|
* SMEvent *event = [SMEvent eventWithDictionary:dictMyCustomData];
|
|
47
|
+
*
|
|
45
48
|
* // Sent the event to the back-end
|
|
49
|
+
*
|
|
46
50
|
* [[SMManager sharedInstance] sendSMEvent:event];
|
|
47
51
|
* @endcode
|
|
48
52
|
*
|
|
49
53
|
* The exemple above is considered as a custom event.
|
|
50
54
|
* The same principle can be applied to any event-type subclasses stated above or to your own subclasses of SMEvent.
|
|
51
|
-
*
|
|
52
|
-
* #SMManager+SMEvent :#
|
|
53
55
|
*/
|
|
54
56
|
@interface SMManager (SMEvent)
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
58
|
/*!
|
|
59
59
|
* Send an event to the Selligent platform
|
|
60
60
|
*
|
|
61
61
|
* @param event An SMEvent object containing your event
|
|
62
62
|
* @discussion Should you want to track the event's response, please check SMEvent
|
|
63
|
+
* @see SMEvent
|
|
63
64
|
*/
|
|
64
|
-
- (void)sendSMEvent:(SMEvent*)event;
|
|
65
|
-
|
|
65
|
+
- (void) sendSMEvent:(SMEvent*_Nullable)event;
|
|
66
66
|
|
|
67
67
|
@end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SMManager+SMLink.h
|
|
3
|
+
// MobileSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Biosca on 7/12/21.
|
|
6
|
+
// Copyright © 2021 Selligent. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "SMManagerUniversalLinksDelegate.h"
|
|
10
|
+
|
|
11
|
+
@class SMNotificationMessage;
|
|
12
|
+
@class SMLink;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This category will help you to manage specific behaviour related to SMLink.
|
|
16
|
+
*/
|
|
17
|
+
@interface SMManager (SMLink)
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used to let the app manage the behaviour of "deeplink" button types containing universal links.
|
|
21
|
+
*
|
|
22
|
+
* @param delegate An object implementing SMManagerUniversalLinksDelegate methods
|
|
23
|
+
* @discussion This setting will allow you to manage the behaviour of the click in a "deeplink" button type that contains an universal link.
|
|
24
|
+
* In order to do it, the delegate object should implement [SMManagerUniversalLinksDelegate executeLinkAction:] method, it will provide the app with the defined NSURL.
|
|
25
|
+
* @see SMManagerUniversalLinksDelegate
|
|
26
|
+
*/
|
|
27
|
+
- (void) universalLinksDelegate:(id <SMManagerUniversalLinksDelegate>_Nullable) delegate;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Tells to the SDK that a certain SMLink object has been clicked.
|
|
31
|
+
* The SDK will send a clicked event to the Selligent platform.
|
|
32
|
+
*
|
|
33
|
+
* @param link SMLink that needs to be marked as clicked.
|
|
34
|
+
* @param notificationMessage The SMNotificationMessage from where the link was extracted.
|
|
35
|
+
* @discussion This is a convinient method when the behaviour when receiving a remote-notification is handled at App side
|
|
36
|
+
* and the standard events need to be sent back to the Selligent platform.
|
|
37
|
+
* @warning The App will be fully responsible of possible event duplication in the Selligent platform when implementing this method,
|
|
38
|
+
* as each execution will trigger a new event, so make sure to just trigger it once if you don't want this to happen.
|
|
39
|
+
* @see SMLink
|
|
40
|
+
* @see SMNotificationMessage
|
|
41
|
+
*/
|
|
42
|
+
- (void) setLinkAsClicked:(SMLink*_Nullable)link fromMessage:(SMNotificationMessage*_Nullable)notificationMessage;
|
|
43
|
+
|
|
44
|
+
@end
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
#import "SMManager+RemoteNotification.h"
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* Optionally, you can support silent-remote-notificaiton which will not render anything on the device.
|
|
14
13
|
* To know more about this topic, please visit [the Apple documentation.](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1)
|
|
@@ -16,22 +15,15 @@
|
|
|
16
15
|
* Even if you're not planning to use silent-pushes, we recommand enabling this service in your application anyway.
|
|
17
16
|
* As using this service will also improve rendering time for the usual (non-silent) remote-notifications.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
18
|
+
* ##Implementation
|
|
20
19
|
* In a nutshell, you should do the following :
|
|
21
20
|
*
|
|
22
21
|
* * In the application's target, enable the following: Capabilities > Background Modes > Remote Notifications
|
|
23
22
|
* * Removing previous call to didReceiveRemoteNotification: (see last point of "Start library")
|
|
24
23
|
* * Implement didReceiveRemoteNotification:fetchCompletionHandler: in UIApplication's delegate.
|
|
25
|
-
*
|
|
26
|
-
* #SMManager+SilentPush :#
|
|
27
24
|
*/
|
|
28
25
|
@interface SMManager (SilentPush)
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
27
|
/**
|
|
36
28
|
* Mandatory API to be included in application:didReceiveRemoteNotification:fetchCompletionHandler
|
|
37
29
|
* Handle and display the received notification according to different application state.
|
|
@@ -40,11 +32,9 @@
|
|
|
40
32
|
* @param completionHandler The block-completion to be processed after the download. Provided by the delegate call
|
|
41
33
|
* @discussion It is recommended to use this API over didReceiveRemoteNotification: as it handles silent-remote-notificaitons.
|
|
42
34
|
* @warning You must enable "Remote notifications" in your application's Capabilities in order to use this API.
|
|
43
|
-
* If this capability is not
|
|
35
|
+
* If this capability is not useful to your application, you must use [SMManager(RemoteNotification) didReceiveRemoteNotification:] instead.
|
|
44
36
|
*/
|
|
45
|
-
- (void)didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
- (void) didReceiveRemoteNotification:(NSDictionary *_Nullable)userInfo fetchCompletionHandler:(void (^_Nullable)(UIBackgroundFetchResult))completionHandler;
|
|
48
38
|
|
|
49
39
|
/**
|
|
50
40
|
* See didReceiveRemoteNotification:fetchCompletionHandler:
|
|
@@ -56,15 +46,8 @@
|
|
|
56
46
|
* Use it only if your application need to overide the service.
|
|
57
47
|
* Otherwise, please use didReceiveRemoteNotification:fetchCompletionHandler:
|
|
58
48
|
* @warning You must enable "Remote notifications" in your application's Capabilities in order to use this API.
|
|
59
|
-
* If this capability is not
|
|
49
|
+
* If this capability is not useful to your application, you must use [SMManager(RemoteNotification) didReceiveRemoteNotification:] instead.
|
|
60
50
|
*/
|
|
61
|
-
- (void)didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler ForceResultFetch:(UIBackgroundFetchResult)resultFetch;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
- (void) didReceiveRemoteNotification:(NSDictionary *_Nullable)userInfo fetchCompletionHandler:(void (^_Nullable)(UIBackgroundFetchResult))completionHandler ForceResultFetch:(UIBackgroundFetchResult)resultFetch;
|
|
69
52
|
|
|
70
53
|
@end
|
|
@@ -13,27 +13,24 @@
|
|
|
13
13
|
/*!
|
|
14
14
|
* Allows you to customise the appearance of all the In App Content containers
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* ##Implementation
|
|
17
17
|
* * First create a SMInAppContentStyleOptions object instance
|
|
18
18
|
* * load it with loadStyleOptions:
|
|
19
|
-
*
|
|
20
|
-
* #SMManager+StyleOptions :#
|
|
21
19
|
*/
|
|
22
20
|
|
|
23
|
-
|
|
24
21
|
@interface SMManager (StyleOptions)
|
|
25
22
|
|
|
26
|
-
|
|
27
23
|
/*!
|
|
28
24
|
* This will allow you to load your custom SMInAppContentStyleOptions object
|
|
25
|
+
*
|
|
29
26
|
* @param options a SMInAppContentStyleOptions object
|
|
27
|
+
* @see SMInAppContentStyleOptions
|
|
30
28
|
*/
|
|
31
|
-
-(void)loadStyleOptions:(SMInAppContentStyleOptions*)options;
|
|
32
|
-
|
|
29
|
+
- (void) loadStyleOptions:(SMInAppContentStyleOptions*_Nullable)options;
|
|
33
30
|
|
|
34
31
|
/*!
|
|
35
32
|
* Reset style options to default one
|
|
36
33
|
*/
|
|
37
|
-
-(void) resetStyleOptions;
|
|
34
|
+
- (void) resetStyleOptions;
|
|
38
35
|
|
|
39
36
|
@end
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
#import "SMManager+RemoteNotification.h"
|
|
10
10
|
#import <UserNotifications/UserNotifications.h>
|
|
11
|
+
#import <UserNotificationsUI/UserNotificationsUI.h>
|
|
12
|
+
|
|
13
|
+
@class SMNotificationMessage;
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* In addition to the implementation of category SMManager(RemoteNotification), this category will supply a support of iOS 10 and usage of UserNotifications framework
|
|
@@ -16,10 +19,10 @@
|
|
|
16
19
|
*
|
|
17
20
|
* If you build against iOS 10+ and you use UserNotifications framework we then recommend you to implement those 2 methods of UNUserNotificationCenterDelegate in your appdelegate:
|
|
18
21
|
*
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
* -
|
|
22
|
+
* - didReceiveNotificationResponse:
|
|
23
|
+
* - didReceiveNotificationResponse:withCompletionHandler:
|
|
24
|
+
* - willPresentNotification:
|
|
25
|
+
* - willPresentNotification:withCompletionHandler:
|
|
23
26
|
*
|
|
24
27
|
* Register your appdelegate to the UNUserNotificationCenter by adding the following two lines in the didFinishLaunchingWithOptions delegate.
|
|
25
28
|
*
|
|
@@ -34,19 +37,17 @@
|
|
|
34
37
|
*
|
|
35
38
|
* Init extensions (to be used for each extensions that will be added to your project):
|
|
36
39
|
*
|
|
37
|
-
* -
|
|
40
|
+
* - startExtensionWithSetting:
|
|
38
41
|
*
|
|
39
42
|
* Notification content extension :
|
|
40
43
|
*
|
|
41
|
-
* -
|
|
44
|
+
* - didReceiveNotification:
|
|
42
45
|
*
|
|
43
46
|
* Notification service extension :
|
|
44
47
|
*
|
|
45
|
-
* -
|
|
46
|
-
* -
|
|
47
|
-
* -
|
|
48
|
-
*
|
|
49
|
-
* #SMManager+UserNotifications :#
|
|
48
|
+
* - didReceiveNotificationRequest:
|
|
49
|
+
* - didReceiveNotificationRequest:withContentHandler:
|
|
50
|
+
* - serviceExtensionTimeWillExpire
|
|
50
51
|
*
|
|
51
52
|
*/
|
|
52
53
|
@interface SMManager (UserNotification)
|
|
@@ -55,20 +56,19 @@
|
|
|
55
56
|
* Mandatory API when used inside App in AppDelegate (but is optional for Notification Content Extension), when building against iOS 10+ and using UserNotifications framework, to be included in userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler.
|
|
56
57
|
* Handle and display remote notification.
|
|
57
58
|
*
|
|
58
|
-
* @param response
|
|
59
|
+
* @param response An UNNotificationResponse that contains information about the notification and the interaction the user has done with it. Provided by the delegate call
|
|
59
60
|
* @discussion This method is mandatory when used in AppDelegate but is optional when implementing Notification content extension. When used in Notification Content Extension it provides to the sdk the ability to process the action that should be triggered without opening the app (in this case don't forget to call the completionhandler with the desired UNNotificationContentExtensionResponseOption
|
|
60
61
|
*/
|
|
61
|
-
- (void)didReceiveNotificationResponse:(UNNotificationResponse*_Nonnull)response;
|
|
62
|
-
|
|
62
|
+
- (void) didReceiveNotificationResponse:(UNNotificationResponse*_Nonnull)response;
|
|
63
63
|
|
|
64
64
|
/*!
|
|
65
65
|
* Mandatory API, when building against iOS 10+ and using UserNotifications framework, to be included in userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler
|
|
66
66
|
* Handle and display remote notification.
|
|
67
67
|
*
|
|
68
|
-
* @param response
|
|
69
|
-
* @param completionHandler A completion that will be called
|
|
68
|
+
* @param response An UNNotificationResponse that contains information about the notification and the interaction the user has done with it. Provided by the delegate call
|
|
69
|
+
* @param completionHandler A completion that will be called with the option UNNotificationContentExtensionResponseOptionDismiss
|
|
70
70
|
*/
|
|
71
|
-
- (void)didReceiveNotificationResponse:(UNNotificationResponse *_Nonnull)response withCompletionHandler:(void (^_Nullable)(
|
|
71
|
+
- (void) didReceiveNotificationResponse:(UNNotificationResponse *_Nonnull)response withCompletionHandler:(void (^_Nullable)(UNNotificationContentExtensionResponseOption option))completionHandler;
|
|
72
72
|
|
|
73
73
|
/*!
|
|
74
74
|
* Mandatory API, when building against iOS 10+ and using UserNotifications framework, to be included in userNotificationCenter:willPresentNotification:withCompletionHandler
|
|
@@ -83,31 +83,32 @@
|
|
|
83
83
|
*
|
|
84
84
|
* @param notification A UNNotification that contains information about the notification.
|
|
85
85
|
*/
|
|
86
|
-
- (void)willPresentNotification:(UNNotification*_Nonnull)notification;
|
|
86
|
+
- (void) willPresentNotification:(UNNotification*_Nonnull)notification;
|
|
87
87
|
|
|
88
88
|
/*!
|
|
89
89
|
* Mandatory API, when building against iOS 10+ and using UserNotifications framework, to be included in userNotificationCenter:willPresentNotification:withCompletionHandler
|
|
90
|
-
* Handle the remote notification when app is in foreground and call the completionHandler(UNNotificationPresentationOptionAlert) by default.
|
|
90
|
+
* Handle the remote notification when app is in foreground and call the completionHandler(UNNotificationPresentationOptionAlert) by default (or UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionList for iOS 14+).
|
|
91
91
|
*
|
|
92
92
|
* This allows the SDK to inform the services that the Selligent push has been received.
|
|
93
93
|
*
|
|
94
94
|
* You don't need to call the completion handler in the delegate anymore.
|
|
95
95
|
*
|
|
96
|
-
* @param notification
|
|
97
|
-
* @param completionHandler A Completion handler that will be called with
|
|
96
|
+
* @param notification An UNNotification that contains information about the notification.
|
|
97
|
+
* @param completionHandler A Completion handler that will be called with a specific UNNotificationPresentationOption depending on the SMForegroundDisplayType value specified when starting the SDK.
|
|
98
|
+
* @see SMManagerSetting
|
|
98
99
|
*/
|
|
99
|
-
- (void)willPresentNotification:(UNNotification*_Nonnull)notification withCompletionHandler:(void (^_Nullable)(UNNotificationPresentationOptions options))completionHandler;
|
|
100
|
-
|
|
100
|
+
- (void) willPresentNotification:(UNNotification*_Nonnull)notification withCompletionHandler:(void (^_Nullable)(UNNotificationPresentationOptions options))completionHandler;
|
|
101
101
|
|
|
102
102
|
/*!
|
|
103
103
|
* Mandatory method which allows sdk initialisation when building against iOS 10+ and using Notification Extensions .
|
|
104
104
|
* To be included in didReceiveNotification: when implementing Notification content extension and/or in didReceiveNotificationRequest:withContentHandler: when implementing Notification service extension
|
|
105
105
|
*
|
|
106
106
|
* @param setting mandatory SMManagerSetting instance to start-up the library - this setting mus tbe initialised with only url, clienID and privateKet provided by selligent
|
|
107
|
-
* @see
|
|
107
|
+
* @see SMManagerSetting
|
|
108
108
|
* @discussion This method is mandatory in order to start / initialise the library and should be called in in didReceiveNotification: when implementing Notification content extension and/or in didReceiveNotificationRequest:withContentHandler: when implementing Notification service extension
|
|
109
|
+
* @see SMManagerSetting
|
|
109
110
|
*/
|
|
110
|
-
- (void)startExtensionWithSetting:(SMManagerSetting*_Nonnull)setting;
|
|
111
|
+
- (void) startExtensionWithSetting:(SMManagerSetting*_Nonnull)setting;
|
|
111
112
|
|
|
112
113
|
/*!
|
|
113
114
|
* Optional API, when building against iOS 10+ and using a Notification Content Extension target, to be included in NotificationViewController didReceiveNotification:
|
|
@@ -119,8 +120,7 @@
|
|
|
119
120
|
*
|
|
120
121
|
* @param notification A UNNotification that contains information about the notification.
|
|
121
122
|
*/
|
|
122
|
-
- (void)didReceiveNotification:(UNNotification*_Nonnull)notification;
|
|
123
|
-
|
|
123
|
+
- (void) didReceiveNotification:(UNNotification*_Nonnull)notification;
|
|
124
124
|
|
|
125
125
|
/*!
|
|
126
126
|
* Optional API, when building against iOS 10+ and using a Notification Service Extension target, to be included in NotificationService didReceiveNotificationRequest:withContentHandler:
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
*
|
|
129
129
|
* This allows the SDK to decrypt the payload before displaying it to the user if you have activated the encryption of push.
|
|
130
130
|
*
|
|
131
|
-
* @param request
|
|
131
|
+
* @param request An UNNotificationRequest that contains the original notification request.
|
|
132
132
|
* @return UNMutableNotificationContent the updated content of the payload.
|
|
133
133
|
* @discussion you can use this method if you have decided to trigger the block to execute with the modified content by yourself otherwise if you want the sdk to manage all steps please use SMManager didReceiveNotificationRequest:withContentHandler:
|
|
134
134
|
*/
|
|
135
|
-
- (UNMutableNotificationContent*_Nullable)didReceiveNotificationRequest:(UNNotificationRequest*_Nonnull)request;
|
|
135
|
+
- (UNMutableNotificationContent*_Nullable) didReceiveNotificationRequest:(UNNotificationRequest*_Nonnull)request;
|
|
136
136
|
|
|
137
137
|
/*!
|
|
138
138
|
* Optional API, when building against iOS 10+ and using a Notification Service Extension target, to be included in NotificationService didReceiveNotificationRequest:withContentHandler:
|
|
@@ -140,16 +140,28 @@
|
|
|
140
140
|
*
|
|
141
141
|
* This allows the SDK to decrypt the payload before displaying it to the user if you have activated the encryption of push.
|
|
142
142
|
*
|
|
143
|
-
* @param request
|
|
143
|
+
* @param request An UNNotificationRequest that contains the original notification request.
|
|
144
144
|
* @param contentHandler The block to execute with the modified content
|
|
145
|
-
* @discussion you can use this method if you want the sdk to manage the display of the notification after
|
|
145
|
+
* @discussion you can use this method if you want the sdk to manage the display of the notification after the decryption has been processed
|
|
146
146
|
*/
|
|
147
|
-
- (void)didReceiveNotificationRequest:(UNNotificationRequest*_Nonnull)request withContentHandler:(void (^_Nullable)(UNNotificationContent*_Nonnull))contentHandler;
|
|
147
|
+
- (void) didReceiveNotificationRequest:(UNNotificationRequest*_Nonnull)request withContentHandler:(void (^_Nullable)(UNNotificationContent*_Nonnull))contentHandler;
|
|
148
148
|
|
|
149
149
|
/*!
|
|
150
150
|
* Optional API, when building against iOS 10+ and using a Notification Service Extension target, to be included in NotificationService serviceExtensionTimeWillExpire
|
|
151
151
|
* Tells the sdk that the extension is about to be terminated.
|
|
152
152
|
* @discussion this method is to be implemented only if you have implemented SMManager didReceiveNotificationRequest:withContentHandler:
|
|
153
153
|
*/
|
|
154
|
-
- (void)serviceExtensionTimeWillExpire;
|
|
154
|
+
- (void) serviceExtensionTimeWillExpire;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Optional API, retrieves the SMNotificationMessage object from a given userInfo
|
|
158
|
+
*
|
|
159
|
+
* @param userInfo An NSDictionary
|
|
160
|
+
* @return SMNotificationMessage instance containing the information extracted from the given userInfo.
|
|
161
|
+
* @discussion This is a convinient method to get the SMNotificationMessage from an incoming remote-notification.
|
|
162
|
+
* It can be used for custom purposes when receiving a remote-notification in foreground for iOS 10+.
|
|
163
|
+
* @see SMNotificationMessage
|
|
164
|
+
*/
|
|
165
|
+
- (SMNotificationMessage*_Nullable) retrieveNotificationMessage:(NSDictionary*_Nullable)userInfo;
|
|
166
|
+
|
|
155
167
|
@end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SMManager+ViewController.h
|
|
3
|
+
// MobileSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by Gauthier Dumont on 07/07/15.
|
|
6
|
+
// Copyright (c) 2015 Selligent. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This category will help our SDK making the WKWebView navigation buttons enabled/disabled when needed, if inAppMessageWKNavigationDelegate is set.
|
|
11
|
+
*/
|
|
12
|
+
@interface SMManager (ViewController)
|
|
13
|
+
|
|
14
|
+
/*!
|
|
15
|
+
* Use this API inside the corresponding method in your WKNavigationDelegate when inAppMessageWKNavigationDelegate is set.
|
|
16
|
+
* It will enable the SDK to have the navigation arrows working properly and log the error when the delegate is implemented in your APP.
|
|
17
|
+
*
|
|
18
|
+
* @param webView The WKWebView from the WKNavigationDelegate.
|
|
19
|
+
* @param navigation The WKNavigation from the WKNavigationDelegate.
|
|
20
|
+
* @param error The NSError from the WKNavigationDelegate.
|
|
21
|
+
*/
|
|
22
|
+
- (void) webView:(WKWebView *_Nonnull)webView didFailNavigation:(WKNavigation *_Nonnull)navigation withError:(NSError *_Nonnull)error;
|
|
23
|
+
|
|
24
|
+
/*!
|
|
25
|
+
* Use this API inside the corresponding method in your WKNavigationDelegate when inAppMessageWKNavigationDelegate is set.
|
|
26
|
+
* It will enable the SDK to have the navigation arrows working properly when the delegate is implemented in your APP.
|
|
27
|
+
*
|
|
28
|
+
* @param webView The WKWebView from the WKNavigationDelegate.
|
|
29
|
+
* @param navigation The WKNavigation from the WKNavigationDelegate
|
|
30
|
+
*/
|
|
31
|
+
- (void) webView:(WKWebView *_Nonnull)webView didFinishNavigation:(WKNavigation *_Nonnull)navigation;
|
|
32
|
+
|
|
33
|
+
/*!
|
|
34
|
+
* Use this API inside the corresponding method in your WKNavigationDelegate when inAppMessageWKNavigationDelegate is set.
|
|
35
|
+
* It will enable the SDK to have the navigation arrows working properly when the delegate is implemented in your APP.
|
|
36
|
+
*
|
|
37
|
+
* @param webView The WKWebView from the WKNavigationDelegate.
|
|
38
|
+
* @param navigation The WKNavigation from the WKNavigationDelegate.
|
|
39
|
+
*/
|
|
40
|
+
- (void) webView:(WKWebView *_Nonnull)webView didCommitNavigation:(WKNavigation *_Nonnull)navigation;
|
|
41
|
+
|
|
42
|
+
@end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|