@selligent-marketing-cloud/selligent-react-native 3.1.0 → 3.2.6

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.
Files changed (184) hide show
  1. package/README.md +43 -1550
  2. package/RNSelligent.podspec +8 -15
  3. package/android/build.gradle +46 -79
  4. package/android/src/main/java/com/selligent/BroadcastEventType.java +4 -1
  5. package/android/src/main/java/com/selligent/ButtonAction.java +81 -0
  6. package/android/src/main/java/com/selligent/ButtonBroadcastEventDataParser.java +9 -3
  7. package/android/src/main/java/com/selligent/DeviceIdBroadcastEventDataParser.java +15 -0
  8. package/android/src/main/java/com/selligent/EventType.java +1 -1
  9. package/android/src/main/java/com/selligent/GCMTokenBroadcastEventDataParser.java +6 -1
  10. package/android/src/main/java/com/selligent/InAppMessageBroadcastEventDataParser.java +7 -1
  11. package/android/src/main/java/com/selligent/NotificationMessageBroadcastEventDataParser.java +19 -0
  12. package/android/src/main/java/com/selligent/RNSelligent.java +195 -56
  13. package/android/src/main/java/com/selligent/SMSettingsFactory.java +0 -1
  14. package/android/src/main/java/com/selligent/Settings.java +0 -9
  15. package/constants.d.ts +7 -33
  16. package/constants.js +51 -85
  17. package/documentation/README.md +826 -0
  18. package/helpers.js +5 -6
  19. package/index.android.js +8 -83
  20. package/index.d.ts +33 -43
  21. package/index.ios.js +25 -76
  22. package/index.js +153 -45
  23. package/ios/RNSelligentMapper.h +21 -0
  24. package/ios/RNSelligentMapper.m +151 -0
  25. package/ios/RNSelligentMobileSDK.xcframework/Info.plist +40 -0
  26. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +350 -0
  27. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Info.plist +0 -0
  28. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.abi.json +2603 -0
  29. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +59 -0
  30. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  31. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftinterface +59 -0
  32. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/module.modulemap +4 -0
  33. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  34. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +179 -0
  35. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +696 -0
  36. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Info.plist +0 -0
  37. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +2603 -0
  38. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +59 -0
  39. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  40. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +59 -0
  41. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +2603 -0
  42. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +59 -0
  43. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  44. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +59 -0
  45. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/module.modulemap +4 -0
  46. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  47. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +234 -0
  48. package/package.json +30 -11
  49. package/.gitattributes +0 -1
  50. package/CHANGELOG.md +0 -68
  51. package/android/README.md +0 -15
  52. package/android/build/generated/source/buildConfig/debug/com/selligent/BuildConfig.java +0 -12
  53. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -9
  54. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  55. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
  56. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  57. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  58. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  59. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -6781
  60. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  61. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  62. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  63. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  64. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  65. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory$1.class +0 -0
  66. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory.class +0 -0
  67. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventDataParser.class +0 -0
  68. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventType.class +0 -0
  69. package/android/build/intermediates/javac/debug/classes/com/selligent/BuildConfig.class +0 -0
  70. package/android/build/intermediates/javac/debug/classes/com/selligent/ButtonBroadcastEventDataParser.class +0 -0
  71. package/android/build/intermediates/javac/debug/classes/com/selligent/ClearCacheIntervalValue.class +0 -0
  72. package/android/build/intermediates/javac/debug/classes/com/selligent/Event.class +0 -0
  73. package/android/build/intermediates/javac/debug/classes/com/selligent/EventReceiver.class +0 -0
  74. package/android/build/intermediates/javac/debug/classes/com/selligent/EventType.class +0 -0
  75. package/android/build/intermediates/javac/debug/classes/com/selligent/GCMTokenBroadcastEventDataParser.class +0 -0
  76. package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageBroadcastEventDataParser.class +0 -0
  77. package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageRefreshType.class +0 -0
  78. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$1.class +0 -0
  79. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$2.class +0 -0
  80. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$3.class +0 -0
  81. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$4.class +0 -0
  82. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$5.class +0 -0
  83. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent.class +0 -0
  84. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligentPackage.class +0 -0
  85. package/android/build/intermediates/javac/debug/classes/com/selligent/RemoteMessageDisplayType.class +0 -0
  86. package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory$1.class +0 -0
  87. package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory.class +0 -0
  88. package/android/build/intermediates/javac/debug/classes/com/selligent/SMSettingsFactory.class +0 -0
  89. package/android/build/intermediates/javac/debug/classes/com/selligent/Settings.class +0 -0
  90. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  91. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -11
  92. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -9
  93. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  94. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  95. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  96. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -5100
  97. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
  98. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  99. package/android/libs/sdk-release.aar +0 -0
  100. package/documentation/add_json_file.png +0 -0
  101. package/documentation/add_lib_file.png +0 -0
  102. package/ios/BackgroundFetchResult.h +0 -5
  103. package/ios/ClearCacheInterval.h +0 -7
  104. package/ios/ClientSettings.h +0 -22
  105. package/ios/ClientSettings.m +0 -39
  106. package/ios/EnumMapper.h +0 -36
  107. package/ios/EnumMapper.m +0 -121
  108. package/ios/Event+SMEvent.h +0 -13
  109. package/ios/Event+SMEvent.m +0 -41
  110. package/ios/Event.h +0 -12
  111. package/ios/Event.m +0 -24
  112. package/ios/EventType.h +0 -7
  113. package/ios/InAppMessageRefreshType.h +0 -6
  114. package/ios/InAppMessageSettings.h +0 -9
  115. package/ios/InAppMessageSettings.m +0 -19
  116. package/ios/LocationAuthorisationStatus.h +0 -6
  117. package/ios/LocationAuthorisationType.h +0 -4
  118. package/ios/LogLevel.h +0 -9
  119. package/ios/NotificationButtonType.h +0 -15
  120. package/ios/ParsableObject.h +0 -5
  121. package/ios/RNSelligent.h +0 -22
  122. package/ios/RNSelligent.m +0 -347
  123. package/ios/RemoteMessageDisplayType.h +0 -5
  124. package/ios/SMManagerSetting+ClientSettings.h +0 -9
  125. package/ios/SMManagerSetting+ClientSettings.m +0 -73
  126. package/ios/SelligentLogger.h +0 -7
  127. package/ios/SelligentLogger.m +0 -9
  128. package/ios/SelligentReactNative.xcodeproj/project.pbxproj +0 -446
  129. package/ios/include/SMBaseMessage.h +0 -48
  130. package/ios/include/SMBlock.h +0 -21
  131. package/ios/include/SMClearCache.h +0 -34
  132. package/ios/include/SMContentAlignment.h +0 -27
  133. package/ios/include/SMDeviceInfos.h +0 -38
  134. package/ios/include/SMDisplayMode.h +0 -27
  135. package/ios/include/SMEvent.h +0 -69
  136. package/ios/include/SMEventUser.h +0 -20
  137. package/ios/include/SMEventUserLogin.h +0 -42
  138. package/ios/include/SMEventUserLogout.h +0 -42
  139. package/ios/include/SMEventUserRegistration.h +0 -42
  140. package/ios/include/SMEventUserUnregistration.h +0 -42
  141. package/ios/include/SMFailure.h +0 -19
  142. package/ios/include/SMHelper.h +0 -51
  143. package/ios/include/SMInAppContentHTMLViewController.h +0 -59
  144. package/ios/include/SMInAppContentImageViewController.h +0 -36
  145. package/ios/include/SMInAppContentMessage.h +0 -56
  146. package/ios/include/SMInAppContentStyleOptions.h +0 -511
  147. package/ios/include/SMInAppContentType.h +0 -35
  148. package/ios/include/SMInAppContentURLViewController.h +0 -36
  149. package/ios/include/SMInAppContentViewController.h +0 -31
  150. package/ios/include/SMInAppMessage.h +0 -51
  151. package/ios/include/SMInAppMessageType.h +0 -50
  152. package/ios/include/SMInAppRefreshType.h +0 -29
  153. package/ios/include/SMLink.h +0 -39
  154. package/ios/include/SMLog.h +0 -54
  155. package/ios/include/SMManager+DataTransaction.h +0 -33
  156. package/ios/include/SMManager+InAppContent.h +0 -170
  157. package/ios/include/SMManager+InAppMessage.h +0 -172
  158. package/ios/include/SMManager+Location.h +0 -41
  159. package/ios/include/SMManager+Log.h +0 -31
  160. package/ios/include/SMManager+RemoteNotification.h +0 -171
  161. package/ios/include/SMManager+SMEvent.h +0 -67
  162. package/ios/include/SMManager+SMLink.h +0 -44
  163. package/ios/include/SMManager+SilentPush.h +0 -53
  164. package/ios/include/SMManager+StyleOptions.h +0 -36
  165. package/ios/include/SMManager+UserNotification.h +0 -180
  166. package/ios/include/SMManager+ViewController.h +0 -45
  167. package/ios/include/SMManager.h +0 -69
  168. package/ios/include/SMManagerHelper.h +0 -18
  169. package/ios/include/SMManagerInAppMessageDelegate.h +0 -24
  170. package/ios/include/SMManagerSetting+Location.h +0 -27
  171. package/ios/include/SMManagerSetting.h +0 -180
  172. package/ios/include/SMManagerSettingIAC.h +0 -48
  173. package/ios/include/SMManagerSettingIAM.h +0 -49
  174. package/ios/include/SMManagerUniversalLinksDelegate.h +0 -23
  175. package/ios/include/SMMessage.h +0 -21
  176. package/ios/include/SMNSNotification.h +0 -81
  177. package/ios/include/SMNotificationAnnotationData.h +0 -33
  178. package/ios/include/SMNotificationButtonData.h +0 -20
  179. package/ios/include/SMNotificationButtonType.h +0 -90
  180. package/ios/include/SMNotificationMessage.h +0 -31
  181. package/ios/include/SMRemoteMessageDisplayType.h +0 -32
  182. package/ios/include/SMSuccess.h +0 -16
  183. package/ios/libSelligentMobile.a +0 -0
  184. package/trigger.yml +0 -9
package/README.md CHANGED
@@ -1,36 +1,22 @@
1
- # Selligent React Native Module (selligent-react-native)
1
+ # SelligentMobileSDK-ReactNative (selligent-react-native)
2
2
 
3
- This module provides an API for the usage of the Selligent SDK in React Native.
4
-
5
- ## Supported platforms
6
-
7
- - Android
8
- - iOS
9
-
10
- > _**IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version 4.2.0 or higher in order to build on Android. This is the default Android Gradle Plugin version since React Native version 0.64.0 but can be manually increased in older versions of React Native._
11
-
12
- > _**IMPORTANT** Since version 2.10.0 of this module, we support React Native v0.70, but NOT REACT NATIVE'S NEW ARCHITECTURE! The following library contains React native modules, that are tailored to and can only be used in React Native's legacy architecture, that will be deprecated in the future when the new architecture will be stable._
3
+ This module provides an API for the usage of the Selligent Mobile SDKs in React Native.
13
4
 
5
+ # SelligentMobileSDK-ReactNative Integration
14
6
  This module uses the native Selligent SDKs:
15
7
 
16
8
  | SDK | Version |
17
9
  | ----------------------------------------------------------------------- | ------- |
18
- | [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.0.3 |
19
- | [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 2.7.7 |
10
+ | [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.1.0 |
11
+ | [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.4.0 |
20
12
 
21
- ## ToC
22
13
 
23
- - [Installation](#installation)
24
- - [Android Specific Installation](#android-specific-installation)
25
- - [iOS Specific Installation](#ios-specific-installation)
26
- - [Using the API](#using-the-api)
27
- - [API Reference](#api-reference)
28
- - [Methods](#methods)
29
- - [Android Only/Specific Methods](#android-onlyspecific-methods)
30
- - [iOS Only/Specific Methods](#ios-onlyspecific-methods)
31
- - [Constants](#constants)
14
+ > **IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version 4.2.0 or higher in order to build on Android. This is the default Android Gradle Plugin version since React Native version 0.64.0 but can be manually increased in older versions of React Native.
15
+
16
+ > **IMPORTANT** Since version 2.10.0 of this module, we support React Native v0.70, but NOT REACT NATIVE'S NEW ARCHITECTURE! The following library contains React native modules, that are tailored to and can only be used in React Native's legacy architecture, that will be deprecated in the future when the new architecture will be stable.
32
17
 
33
18
  ## Installation
19
+ > Please refer to our <a href="documentation/#reactnative--using-the-sdk">SDK full documentation</a> for a step-by-step guide on how to use the SDK, after installation.
34
20
 
35
21
  1. Install the module
36
22
 
@@ -45,42 +31,16 @@ This module uses the native Selligent SDKs:
45
31
  "url": "someMobilePushUrl",
46
32
  "clientId": "someClientId",
47
33
  "privateKey": "somePrivateKey",
48
- "fullyQualifiedNotificationActivityClassName": "com.some.project.MainActivity"
34
+ "fullyQualifiedNotificationActivityClassName": "com.some.project.MainActivity",
35
+ "delayedPushAction": true
49
36
  }
50
37
  ```
51
38
 
52
- Note: The values should be relevant to your configuration. There are parameters that can only be used on a specific platform, but can be passed to either and will be ignored when possible.
53
-
54
- **Detailed overview:**
55
-
56
- | Property | Type | Required | Platform |
57
- | ------------------------------------------- | ------------------------------------------------------------------------------- | -------- | ------------ |
58
- | url | string | Yes | Both |
59
- | clientId | string | Yes | Both |
60
- | privateKey | string | Yes | Both |
61
- | clearCacheIntervalValue | enum [Selligent.ClearCacheIntervalValue](#selligentclearcacheintervalvalue) | No | Both |
62
- | configureLocationServices | boolean | No | Both |
63
- | inAppMessageRefreshType | enum [Selligent.InAppMessageRefreshType](#selligentinappmessagerefreshtype) | No | Both |
64
- | addInAppMessageFromPushToInAppMessageList | boolean | No | Both |
65
- | remoteMessageDisplayType | enum [Selligent.RemoteMessagesDisplayType](#selligentremotemessagesdisplaytype) | No | Both |
66
- | appGroupId | string | No | iOS Only |
67
- | shouldClearBadge | boolean | No | iOS Only |
68
- | shouldDisplayRemoteNotification | boolean | No | iOS Only |
69
- | shouldPerformBackgroundFetch | boolean | No | iOS Only |
70
- | doNotListenToThePush | boolean | No | Android Only |
71
- | doNotFetchTheToken | boolean | No | Android Only |
72
- | loadCacheAsynchronously | boolean | No | Android Only |
73
- | fullyQualifiedNotificationActivityClassName | string | No | Android Only |
74
- | notificationIconColor | string | No | Android Only |
75
- | notificationChannelId | string | No | Android Only |
76
- | notificationChannelName | string | No | Android Only |
77
- | notificationChannelDescription | string | No | Android Only |
78
-
79
-
39
+ > Check all the options that can be used in our <a href="documentation/#selligent_json">SDK full documentation</a>
80
40
 
81
41
  ### Android Specific Installation
82
42
 
83
- > ### **Atention for Huawei developers!**
43
+ > ### **Attention for Huawei developers!**
84
44
  >
85
45
  > In order to use this module on Huawei devices (without Goggle Play services), you should add the following dependencies in the `build.gradle` files of the Android project in your React Native project:
86
46
  >
@@ -122,7 +82,7 @@ This module uses the native Selligent SDKs:
122
82
  <details>
123
83
  <summary>Without autolinking (RN 0.59 and below)</summary>
124
84
 
125
- 1. Create a Google application following the section **Creating a Google application** of the **Android - Using the SDK** pdf, and place the `google-services.json` file in the `./android/app` folder.
85
+ 1. Create a Google application following the section [native documentation](https://github.com/SelligentMarketingCloud/MobileSDK-Android/tree/master/Documentation#creating_app), and place the `google-services.json` file in the `./android/app` folder.
126
86
 
127
87
  2. Add the following lines at the end of the `android/settings.gradle` file:
128
88
 
@@ -137,37 +97,18 @@ This module uses the native Selligent SDKs:
137
97
  // android/build.gradle
138
98
 
139
99
  buildscript {
140
- ...
141
100
  dependencies {
142
- ...
143
101
  // Make sure your Gradle plugin version is >= 4.2.0
144
102
  classpath("com.android.tools.build:gradle:4.2.0")
145
103
  // Add the following:
146
104
  classpath 'com.google.gms:google-services:4.3.3'
147
105
  }
148
106
  }
149
-
150
- allprojects {
151
- repositories {
152
- ...
153
- // Add the following:
154
- flatDir {
155
- dirs "$rootDir/../node_modules/@selligent-marketing-cloud/selligent-react-native/android/libs"
156
- }
157
-
158
- // Add the following:
159
- maven {
160
- url 'https://maven-repo.plotprojects.com'
161
- }
162
- }
163
- }
164
107
  ```
165
108
 
166
109
  ```groovy
167
- // android/gradle/wrapper/gradle-wrapper.properties
168
- ...
110
+ // android/gradle/wrapper/gradle-wrapper.properties
169
111
  distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
170
- ...
171
112
  ```
172
113
 
173
114
  4. Add the following in the `android/app/build.gradle` file:
@@ -176,9 +117,7 @@ This module uses the native Selligent SDKs:
176
117
  dependencies {
177
118
  // Add the following:
178
119
  compile project(path: ':selligent-react-native')
179
- ...
180
120
  }
181
- ...
182
121
  // Add the following:
183
122
  apply plugin: 'com.google.gms.google-services'
184
123
  ```
@@ -189,12 +128,10 @@ This module uses the native Selligent SDKs:
189
128
  // Add the following import statements:
190
129
  import com.selligent.RNSelligent;
191
130
  import com.selligent.RNSelligentPackage;
192
- ...
193
131
 
194
132
  public class MainApplication extends Application implements ReactApplication {
195
133
 
196
134
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
197
- ...
198
135
  @Override
199
136
  protected List<ReactPackage> getPackages() {
200
137
 
@@ -203,13 +140,12 @@ This module uses the native Selligent SDKs:
203
140
  packages.add(new RNSelligentPackage());
204
141
  return packages;
205
142
  }
206
- ...
207
143
  };
208
- ...
144
+
209
145
  @Override
210
146
  public void onCreate() {
211
147
  super.onCreate();
212
- ...
148
+
213
149
  // Add the following:
214
150
  RNSelligent.configure(this);
215
151
  }
@@ -236,37 +172,18 @@ This module uses the native Selligent SDKs:
236
172
  // android/build.gradle
237
173
 
238
174
  buildscript {
239
- ...
240
175
  dependencies {
241
- ...
242
176
  // Make sure your Gradle plugin version is >= 4.2.0
243
177
  classpath("com.android.tools.build:gradle:4.2.0")
244
178
  // Add the following:
245
179
  classpath 'com.google.gms:google-services:4.3.3'
246
180
  }
247
181
  }
248
-
249
- allprojects {
250
- repositories {
251
- ...
252
- // Add the following:
253
- flatDir {
254
- dirs "$rootDir/../node_modules/@selligent-marketing-cloud/selligent-react-native/android/libs"
255
- }
256
-
257
- // Add the following:
258
- maven {
259
- url 'https://maven-repo.plotprojects.com'
260
- }
261
- }
262
- }
263
182
  ```
264
183
 
265
184
  ```groovy
266
- // android/gradle/wrapper/gradle-wrapper.properties
267
- ...
185
+ // android/gradle/wrapper/gradle-wrapper.properties
268
186
  distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
269
- ...
270
187
  ```
271
188
 
272
189
  4. Add the following in the `android/app/build.gradle` file:
@@ -282,14 +199,12 @@ This module uses the native Selligent SDKs:
282
199
  // Add the following import statements:
283
200
  import com.selligent.RNSelligent;
284
201
  import com.selligent.RNSelligentPackage;
285
- ...
286
202
 
287
203
  public class MainApplication extends Application implements ReactApplication {
288
- ...
289
204
  @Override
290
205
  public void onCreate() {
291
206
  super.onCreate();
292
- ...
207
+
293
208
  // Add the following:
294
209
  RNSelligent.configure(this);
295
210
  }
@@ -298,59 +213,36 @@ This module uses the native Selligent SDKs:
298
213
 
299
214
  </details>
300
215
 
301
- #### Change default push notification icons
302
-
303
- Add the following properties to the `selligent.json` file:
304
-
305
- ```json
306
- "notificationSmallIcon": "ic_notification",
307
- "notificationLargeIcon": "ic_notification"
308
- ```
309
-
310
- > _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
311
-
312
216
  ### iOS Specific installation
313
217
 
314
218
  <details>
315
219
  <summary>Without autolinking (RN 0.59 and below)</summary>
316
220
 
317
- 1. Copy the `node_modules/@selligent-marketing-cloud/selligent-react-native/ios/SelligentReactNative.xcodeproj` file to the **Xcode project**. Drop it under the `Libraries` Folder. This will link the module to the iOS project. (See the image in the next step)
221
+ 1. Copy the `node_modules/@selligent-marketing-cloud/selligent-react-native/ios` folder to the **Xcode project**. Drop it under the `Libraries` Folder. This will link the module to the iOS project.
318
222
 
319
223
  2. Drag and drop the `selligent.json` you created from the root folder to the Xcode project inside the `Copy Bundle Resources` in `Build phases` of your target:
320
224
 
321
- > _Note: do not check the "copy if needed" option to make sure you only have to manage one selligent.json file_
322
-
323
- ![Add 'SelligentReactNative.xcodeproj' and 'selligent.json' file to 'Copy Bundle Resources'](/documentation/add_json_file.png)
324
-
325
- 3. Drag and drop the `libRNSelligent.a` to your `Linked Frameworks and Libraries`:
326
-
327
- ![Add 'libRNSelligent.a' file to your 'Linked Frameworks and Libraries'](/documentation/add_lib_file.png)
328
-
329
- 4. Add Selligent to `Header Search Paths` in `Build Settings` of your target:
330
-
331
- ```
332
- $(SRCROOT)/../node_modules/@selligent-marketing-cloud/selligent-react-native/ios/
333
- ```
334
-
335
- 5. Create a `Podfile` (if there isn't one already) in the `/ios` folder and add the following:
225
+ > Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
336
226
 
337
- > **IMPORTANT:** Since v2.7.5 of the iOS SDK, the minimum PlotPlugin version is 3.5.0!
227
+ 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.4.0"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
338
228
 
339
- ```ruby
340
- target 'REPLACEWITHYOURTARGETNAME'
341
- pod 'PlotPlugin', '3.5.0'
342
- ```
229
+ 4. Execute `pod install` in the `/ios` folder
343
230
 
344
- 6. Execute `pod install` in the `/ios` folder
231
+ 5. From now on, open the `.xcworkspace` file to make changes in Xcode
345
232
 
346
- 7. From now on open the `.xcworkspace` file to make changes in Xcode
233
+ 6. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
347
234
 
348
- 8. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
235
+ ```objective-c
236
+ @import RNSelligentMobileSDK;
237
+
238
+ // You can alternatively specify a different file name (without the extension) from where to load the Selligent configs (defaults to 'selligent')
239
+ // if (!launchOptions) {
240
+ // launchOptions = [NSMutableDictionary new];
241
+ // }
242
+ // [launchOptions setValue:@"alternativeFileName" forKey:@"RN_SELLIGENT_JSON"];
349
243
 
350
- ```objective-c
351
- #import <RNSelligent.h>
352
- [RNSelligent configureWithLaunchOptions:launchOptions];
353
- ```
244
+ [RNSelligent configureWithLaunchOptions:launchOptions];
245
+ ```
354
246
 
355
247
  </details>
356
248
  <br>
@@ -359,1418 +251,19 @@ Add the following properties to the `selligent.json` file:
359
251
 
360
252
  1. Drag and drop the `selligent.json` you created from the root folder to the Xcode project inside the `Copy Bundle Resources` in `Build phases` of your target:
361
253
 
362
- > _Note: do not check the "copy if needed" option to make sure you only have to manage one selligent.json file_
254
+ > Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
363
255
 
364
256
  2. Execute `pod install` in the `/ios` folder
365
257
 
366
- 3. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
367
-
368
- ```objc
369
- #import <RNSelligent.h>
370
- [RNSelligent configureWithLaunchOptions:launchOptions];
371
- ```
372
-
373
- </details>
374
-
375
- #### Push notifications
376
-
377
- 1. For push notifications you need to delegate some of the `AppDelegate.mm` methods to the SDK:
378
-
379
- ```objc
380
- #import "AppDelegate.h"
381
- #import <React/RCTBundleURLProvider.h>
382
- #import <React/RCTRootView.h>
383
-
384
- #import <React/RCTAppSetupUtils.h>
385
-
386
- #import <RNSelligent.h>
387
-
388
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
389
- @import UserNotifications;
390
- @interface AppDelegate () <UNUserNotificationCenterDelegate>
391
- @end
392
- #endif
393
-
394
- @implementation AppDelegate
395
-
396
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
397
- [self _prepareForPushNotifications];
398
- [RNSelligent configureWithLaunchOptions:launchOptions];
399
- // ...
400
- //react native setup code
401
- // ...
402
- return YES;
403
- }
404
-
405
- - (void)_prepareForPushNotifications {
406
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
407
- UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
408
- center.delegate = self;
409
- #endif
410
- }
411
-
412
- - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
413
- [RNSelligent performIAMFetchWithCompletionHandler:completionHandler];
414
- }
415
-
416
- - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
417
- [RNSelligent didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
418
- }
419
-
420
- - (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
421
- [RNSelligent didRegisterUserNotificationSettings:notificationSettings];
422
- }
423
-
424
- - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
425
- [RNSelligent didFailToRegisterForRemoteNotificationsWithError:error];
426
- }
427
-
428
- - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
429
- [RNSelligent didReceiveRemoteNotification:userInfo];
430
- }
431
-
432
- #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
433
- - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
434
- [RNSelligent willPresentNotification:notification withCompletionHandler:completionHandler];
435
- }
436
-
437
- - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
438
- [RNSelligent didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
439
- }
440
- #endif
441
-
442
- @end
443
- ```
444
-
445
- 2. Follow section [**Create an APNS Key**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#apns_key), of the native documentation.
446
-
447
- 3. If you want rich push notifications, follow section 6.9 **Notification Extensions** as well.
448
- Make sure you add your `appGroupId` to the `selligent.json`.
449
- > **IMPORTANT!** make sure your `appGroupId` has the following structure or it will not work: `group.{MAIN_APP_BUNDLE_ID}`
450
-
451
- > **IMPORTANT!** Since v2.9.0, `-(void)didReceiveNotification:(UNNotification *)notification` of `SMManager+RemoteNotification` has become deprecated. You will need to invoke `-(void)didReceiveNotification:(UNNotification *)notification withContext` instead. Consult [**the iOS documentation**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#start-the-sdk-from-inside-the-extension-1) for more details.
452
-
453
- 4. Starting from iOS 13, Apple split up the application lifecycle logic between `AppDelegate` and `SceneDelegate`.
454
- This was done in order to enable multi-window support that was introduced in iPad-OS. The `AppDelegate` is responsible for application lifecycle handling and setup of services, while `SceneDelegate` is responsible for updating the UI (windows and scenes).
455
-
456
- However, this split in responsibilites has given rise to issues with Sellgent's default push notification behavior __since iOS 15__, which shows an alert containing the notification's content, or its associated in-app content. Starting from iOS 15, you should add a separate `SceneDelegate`, that you connect to your `AppDelegate`, which handles the UI updating logic:
457
-
458
- ``` objc
459
- // SceneDelegate.h
460
-
461
- #ifndef SceneDelegate_h
462
- #define SceneDelegate_h
463
-
464
- #import <UIKit/UIKit.h>
465
- #import <React/RCTBridgeDelegate.h>
466
-
467
- @interface SceneDelegate : UIResponder <UIWindowSceneDelegate, RCTBridgeDelegate>
468
- @end
469
-
470
- #endif /* SceneDelegate_h */
471
- ```
472
-
473
- ``` objc
474
- // SceneDelegate.mm
258
+ 3. Import & bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.m` (put it at the end of the method)
475
259
 
476
- #import "SceneDelegate.h"
477
-
478
- #import <React/RCTBridge.h>
479
- #import <React/RCTBundleURLProvider.h>
480
- #import <React/RCTRootView.h>
481
-
482
- #import <React/RCTAppSetupUtils.h>
483
-
484
- @implementation SceneDelegate
485
-
486
- #if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
487
-
488
- @synthesize window = _window;
489
-
490
- - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions API_AVAILABLE(ios(13.0)){
491
- RCTAppSetupPrepareApp([ UIApplication sharedApplication]);
492
- // ...
493
- // other react native setup code
494
- // ...
495
- }
496
-
497
-
498
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
499
- {
500
- #if DEBUG
501
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
502
- #else
503
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
504
- #endif
505
- }
506
-
507
- #endif
508
-
509
- @end
260
+ ```objc
261
+ @import RNSelligentMobileSDK;
262
+ // OR
263
+ // #import <RNSelligentMobileSDK/RNSelligentMobileSDK-Swift.h>
510
264
 
511
- ```
512
-
513
- ``` objc
514
- // AppDelegate.mm
515
- // Other imports...
516
- #import "SceneDelegate.h"
517
-
518
- @implementation AppDelegate
519
-
520
- #if defined(__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
521
- - (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0)){
522
- UISceneConfiguration *configuration = [[UISceneConfiguration alloc] init];
523
- configuration.delegateClass = SceneDelegate.class;
524
-
525
- return configuration;
526
- }
527
- #endif
528
-
529
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
530
- [self _prepareForPushNotifications];
265
+ // At the end of application:didFinishLaunchingWithOptions:
531
266
  [RNSelligent configureWithLaunchOptions:launchOptions];
532
- //
533
-
534
- if (@available(iOS 13.0, *)) {
535
- return YES;
536
- }
537
- // ...
538
- //react native setup code
539
- // ...
540
-
541
- return YES;
542
- }
543
-
544
-
545
- // Other AppDelegate methods, as defined above...
546
-
547
- @end
548
-
549
267
  ```
550
268
 
551
- #### Geolocation
552
-
553
- For geolocation services, follow section [**Geolocation**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#geolocation), of the native documentation. You also need to configure several permissions described [**here**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#permission-for-geolocation).
554
-
555
- #### Deeplinking
556
-
557
- You can catch the deeplinks 2 ways:
558
-
559
- 1. Native in AppDelegate.mm, add the following (example code that logs the URL)
560
-
561
- ```
562
- -(BOOL)application:(UIApplication*) application openURL:(NSURL*) url sourceApplication:(NSString*) sourceApplication annotation:(id) annotation
563
- {
564
- NSLog(@"%@", [url absoluteString]);
565
- return YES;
566
- }
567
- ```
568
-
569
- 2. In your React Native codebase, https://facebook.github.io/react-native/docs/linking
570
-
571
- ## Using the API
572
-
573
- 1. In the `App.js` file:
574
-
575
- 1. Add the `Button` import statement:
576
-
577
- ```javascript
578
- import { Platform, StyleSheet, Text, View, Button } from "react-native"; // Add Button import
579
- ```
580
-
581
- 2. Add the `Selligent` import statement:
582
-
583
- ```javascript
584
- import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
585
- ```
586
-
587
- 3. Add a function to call the `Selligent.getVersionLib` function:
588
-
589
- ```javascript
590
- export default class App extends Component<Props> {
591
- ...
592
- // Add example function
593
- _getVersionLib() {
594
- Selligent.getVersionLib((versionLib) => {
595
- alert(versionLib);
596
- })
597
- }
598
- ...
599
- }
600
- ```
601
-
602
- 4. Add a `Button` component in the `render()` function calling the function of the previous step:
603
-
604
- ```javascript
605
- render() {
606
- return (
607
- <View style={styles.container}>
608
- ...
609
- // Add button
610
- <Button
611
- onPress={this._getVersionLib}
612
- title='getVersionLib'
613
- />
614
- </View>
615
- );
616
- }
617
- ```
618
-
619
- 5. Your `App.js` file should look something like this:
620
-
621
- ```javascript
622
- import React, { Component } from "react";
623
- import { Platform, StyleSheet, Text, View, Button } from "react-native"; // Add Button import
624
- import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
625
-
626
- const instructions = Platform.select({
627
- ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
628
- android:
629
- "Double tap R on your keyboard to reload,\n" +
630
- "Shake or press menu button for dev menu",
631
- });
632
-
633
- type Props = {};
634
- export default class App extends Component<Props> {
635
- // Add example function
636
- _getVersionLib() {
637
- Selligent.getVersionLib((versionLib) => {
638
- alert(versionLib);
639
- });
640
- }
641
-
642
- render() {
643
- return (
644
- <View style={styles.container}>
645
- <Text style={styles.welcome}>Welcome to React Native!</Text>
646
- <Text style={styles.instructions}>
647
- To get started, edit App.js
648
- </Text>
649
- <Text style={styles.instructions}>{instructions}</Text>
650
- // Add button
651
- <Button onPress={this._getVersionLib} title="getVersionLib" />
652
- </View>
653
- );
654
- }
655
- }
656
-
657
- const styles = StyleSheet.create({
658
- container: {
659
- flex: 1,
660
- justifyContent: "center",
661
- alignItems: "center",
662
- backgroundColor: "#F5FCFF",
663
- },
664
- welcome: {
665
- fontSize: 20,
666
- textAlign: "center",
667
- margin: 10,
668
- },
669
- instructions: {
670
- textAlign: "center",
671
- color: "#333333",
672
- marginBottom: 5,
673
- },
674
- });
675
- ```
676
-
677
- ## API Reference
678
-
679
- - [Methods](#methods)
680
-
681
- - [Selligent.getVersionLib(successCallback)](#selligentgetversionlibsuccesscallback)
682
- - [getVersionLib example](#getversionlib-example)
683
- - [Selligent.enableGeolocation(successCallback, errorCallback, enabled)](#selligentenablegeolocationsuccesscallback-errorcallback-enabled)
684
- - [enableGeolocation example](#enablegeolocation-example)
685
- - [Selligent.isGeolocationEnabled(successCallback)](#selligentisgeolocationenabledsuccesscallback)
686
- - [isGeolocationEnabled example](#isgeolocationenabled-example)
687
- - [Selligent.getDeviceId(successCallback)](#selligentgetdeviceidsuccesscallback)
688
- - [getDeviceId example](#getdeviceid-example)
689
- - [Selligent.enableNotifications(successCallback, errorCallback, enabled)](#selligentenablenotificationssuccesscallback-errorcallback-enabled)
690
- - [enableNotifications example](#enablenotifications-example)
691
- - [Selligent.displayLastReceivedRemotePushNotification(successCallback)](#selligentdisplaylastreceivedremotepushnotificationsuccesscallback)
692
- - [displayLastReceivedRemotePushNotification example](#displaylastreceivedremotepushnotification-example)
693
- - [Selligent.getLastRemotePushNotification(successCallback)](#selligentgetlastremotepushnotificationsuccesscallback)
694
- - [getLastRemotePushNotification Example](#getlastremotepushnotification-example)
695
- - [Selligent.enableInAppMessages(successCallback, errorCallback, enabled)](#selligentenableinappmessagessuccesscallback-errorcallback-enabled)
696
- - [enableInAppMessages example](#enableinappmessages-example)
697
- - [Selligent.getInAppMessages(successCallback)](#selligentgetinappmessagessuccesscallback)
698
- - [getInAppMessages example](#getinappmessages-example)
699
- - [Selligent.setInAppMessageAsSeen(successCallback, errorCallback, messageId)](#selligentsetinappmessageasseensuccesscallback-errorcallback-messageid)
700
- - [setInAppMessageAsSeen example](#setinappmessageasseen-example)
701
- - [Selligent.executeButtonAction(successCallback, errorCallback, buttonId, messageId)](#selligentexecutebuttonactionsuccesscallback-errorcallback-buttonid-messageid)
702
- - [executeButtonAction example](#executeButtonAction-example)
703
- - [Selligent.sendEvent(successCallback, errorCallback, event)](#selligentsendeventsuccesscallback-errorcallback-event)
704
- - [sendEvent example](#sendevent-example)
705
- - [Selligent.subscribeToEvents(successCallback, errorCallback, eventCallback)](#selligentsubscribetoeventssuccesscallback-errorcallback-eventcallback)
706
- - [subscribeToEvents example](#subscribetoevents-example)
707
-
708
- - [Android Only/Specific Methods](#android-onlyspecific-methods)
709
-
710
- - [Selligent.subscribeToEvent(eventCallback, eventName)](#selligentsubscribetoeventeventcallback-eventname)
711
- - [subscribeToEvent example](#subscribetoevent-example)
712
- - [Selligent.areInAppMessagesEnabled(successCallback)](#selligentareinappmessagesenabledsuccesscallback)
713
- - [areInAppMessagesEnabled example](#areinappmessagesenabled-example)
714
- - [Selligent.enableAndroidLogging(successCallback, errorCallback, enabled)](#selligentenableandroidloggingsuccesscallback-errorcallback-enabled)
715
- - [enableAndroidLogging example](#enableandroidlogging-example)
716
- - [Selligent.displayMessage(successCallback, errorCallback, messageId)](#selligentdisplaymessagesuccesscallback-errorcallback-messageid)
717
- - [displayMessage example](#displaymessage-example)
718
- - [Selligent.areNotificationsEnabled(successCallback)](#selligentarenotificationsenabledsuccesscallback)
719
- - [areNotificationsEnabled example](#arenotificationsenabled-example)
720
- - [Selligent.setNotificationSmallIcon(successCallback, errorCallback, iconName)](#selligentsetnotificationsmalliconsuccesscallback-errorcallback-iconname)
721
- - [setNotificationSmallIcon example](#setnotificationsmallicon-example)
722
- - [Selligent.setNotificationLargeIcon(successCallback, errorCallback, iconName)](#selligentsetnotificationlargeiconsuccesscallback-errorcallback-iconname)
723
- - [setNotificationLargeIcon example](#setnotificationlargeicon-example)
724
- - [Selligent.setNotificationIconColor(successCallback, errorCallback, color)](#selligentsetnotificationiconcolorsuccesscallback-errorcallback-color)
725
- - [setNotificationIconColor example](#setnotificationiconcolor-example)
726
- - [Selligent.getGCMToken(successCallback)](#selligentgetgcmtokensuccesscallback)
727
- - [getGCMToken Example](#getgcmtoken-example)
728
- - [Selligent.getRemoteMessagesDisplayType(successCallback, errorCallback)](#selligentgetremotemessagesdisplaytypesuccesscallback-errorcallback)
729
- - [getRemoteMessagesDisplayType Example](#getremotemessagesdisplaytype-example)
730
- - [Selligent.setFirebaseToken(successCallback, errorCallback, token)](#selligentsetfirebasetokensuccesscallback--errorcallback--token)
731
- - [setFirebaseToken Example](#setFirebaseToken-example)
732
-
733
- - [iOS Only/Specific Methods](#ios-onlyspecific-methods)
734
-
735
- - [Selligent.enableiOSLogging(successCallback, errorCallback, logLevels)](#selligentenableiosloggingsuccesscallback-errorcallback-loglevels)
736
- - [enableiOSLogging example](#enableioslogging-example)
737
- - [Selligent.displayNotification(successCallback, errorCallback, notificationId)](#selligentdisplaynotificationsuccesscallback-errorcallback-notificationid)
738
- - [displayNotification Example](#displaynotification-example)
739
- - [Selligent.registerForProvisionalRemoteNotification(successCallback)](#selligentregisterforprovisionalremotenotificationsuccesscallback)
740
- - [registerForProvisionalRemoteNotification example](#registerForProvisionalRemoteNotification-example)
741
- - [Selligent.registerRemoteNotificationFetchCompletionHandler(successCallback, errorCallback)](#selligentregisterremotenotificationfetchcompletionhandlersuccesscallback-errorcallback)
742
- - [registerRemoteNotificationFetchCompletionHandler example](#registerremotenotificationfetchcompletionhandler-example)
743
- - [Selligent.forceRemoteNotificationBackgroundFetchResult(successCallback, errorCallback, iOSBackgroundFetchResult)](#selligentforceremotenotificationbackgroundfetchresultsuccesscallback-errorcallback-iosbackgroundfetchresult)
744
- - [forceRemoteNotificationBackgroundFetchResult example](#forceremotenotificationbackgroundfetchresult-example)
745
-
746
- - [Constants](#constants)
747
- - [SelligentConstants.ClearCacheIntervalValue](#selligentconstantsclearcacheintervalvalue)
748
- - [SelligentConstants.InAppMessageType](#selligentconstantsinappmessagetype)
749
- - [SelligentConstants.InAppMessageRefreshType](#selligentconstantsinappmessagerefreshtype)
750
- - [SelligentConstants.RemoteMessagesDisplayType](#selligentconstantsremotemessagesdisplaytype)
751
- - [SelligentConstants.iOSLogLevel](#selligentconstantsiosloglevel)
752
- - [SelligentConstants.iOSBackgroundFetchResult](#selligentconstantsiosbackgroundfetchresult)
753
- - [SelligentConstants.iOSLocationAuthorisationStatus](#selligentconstantsioslocationauthorisationstatus)
754
- - [SelligentConstants.iOSLocationAuthorisationType](#selligentconstantsioslocationauthorisationtype)
755
- - [SelligentConstants.EventType](#selligentconstantseventtype)
756
- - [SelligentConstants.iOSNotificationButtonType](#selligentconstantsiosnotificationbuttontype)
757
- - [SelligentConstants.BroadcastEventType](#selligentconstantsbroadcasteventtype)
758
-
759
- ### Methods
760
-
761
- #### Selligent.getVersionLib(successCallback)
762
-
763
- Returns the version of the installed Selligent SDK.
764
-
765
- The response of the success callback is a string containing the version of the SDK.
766
-
767
- ##### getVersionLib example
768
-
769
- ```javascript
770
- Selligent.getVersionLib((versionLib) => {
771
- // success callback
772
- alert(versionLib);
773
- });
774
- ```
775
-
776
- <div align="right">
777
- <b><a href="#api-reference">back to API ToC</a></b>
778
- </div>
779
-
780
- #### Selligent.enableGeolocation(successCallback, errorCallback, enabled)
781
-
782
- Enable or disable geolocation services.
783
-
784
- The `enabled` parameter is a required boolean to enable or disable geolocation services.
785
-
786
- ##### enableGeolocation example
787
-
788
- ```javascript
789
- Selligent.enableGeolocation(
790
- (response) => { // success callback
791
- ...
792
- },
793
- (error) => { // error callback
794
- ...
795
- },
796
- true
797
- );
798
- ```
799
-
800
- <div align="right">
801
- <b><a href="#api-reference">back to API ToC</a></b>
802
- </div>
803
-
804
- #### Selligent.isGeolocationEnabled(successCallback)
805
-
806
- Check if geolocation services are enabled or disabled.
807
-
808
- The response of the success callback is a boolean stating geolocation services are enabled or disabled.
809
-
810
- ##### isGeolocationEnabled example
811
-
812
- ```javascript
813
- Selligent.isGeolocationEnabled(
814
- (response) => { // success callback
815
- ...
816
- }
817
- );
818
- ```
819
-
820
- <div align="right">
821
- <b><a href="#api-reference">back to API ToC</a></b>
822
- </div>
823
-
824
- #### Selligent.getDeviceId(successCallback)
825
-
826
- Returns the device id.
827
-
828
- The response of the success callback is a string containing the device id.
829
-
830
- ##### getDeviceId example
831
-
832
- ```javascript
833
- Selligent.getDeviceId((deviceId) => {
834
- // success callback
835
- alert(deviceId);
836
- });
837
- ```
838
-
839
- <div align="right">
840
- <b><a href="#api-reference">back to API ToC</a></b>
841
- </div>
842
-
843
- #### Selligent.enableNotifications(successCallback, errorCallback, enabled)
844
-
845
- Enable or disable the usage of notifications.
846
-
847
- The `enabled` parameter is a required boolean to enable or disable notifications.
848
-
849
- ##### enableNotifications example
850
-
851
- ```javascript
852
- Selligent.enableNotifications(
853
- (response) => { // success callback
854
- ...
855
- },
856
- (error) => { // error callback
857
- ...
858
- },
859
- true
860
- );
861
- ```
862
-
863
- <div align="right">
864
- <b><a href="#api-reference">back to API ToC</a></b>
865
- </div>
866
-
867
- #### Selligent.displayLastReceivedRemotePushNotification(successCallback)
868
-
869
- Display the last received remote notification.
870
-
871
- ##### displayLastReceivedRemotePushNotification example
872
-
873
- ```javascript
874
- Selligent.displayLastReceivedRemotePushNotification(
875
- (response) => { // success callback
876
- ...
877
- }
878
- );
879
- ```
880
-
881
- <div align="right">
882
- <b><a href="#api-reference">back to API ToC</a></b>
883
- </div>
884
-
885
- #### Selligent.getLastRemotePushNotification(successCallback)
886
-
887
- Get the id and the title of the last received remote push notification.
888
-
889
- The response of the success callback is an object containing the information about the last received remote push notification, or `null` if there is no last received remote push notification.
890
-
891
- **Detailed overview:**
892
-
893
- | Property | Type | Description |
894
- | -------- | ------ | ------------------------------------------ |
895
- | id | string | Id of the last remote push notification |
896
- | title | string | Title of the last remote push notification |
897
-
898
- ##### getLastRemotePushNotification Example
899
-
900
- ```javascript
901
- Selligent.getLastRemotePushNotification(
902
- (response) => { // success callback
903
- ...
904
- }
905
- );
906
- ```
907
-
908
- <div align="right">
909
- <b><a href="#api-reference">back to API ToC</a></b>
910
- </div>
911
-
912
- #### Selligent.enableInAppMessages(successCallback, errorCallback, enabled)
913
-
914
- This method enables or disables the management of in-app messages.
915
-
916
- The `enabled` parameter can be a boolean or a constant of the [InAppMessageRefreshType](#selligentinappmessagerefreshtype) enum.
917
-
918
- _Note: on iOS the `enabled` parameter must be a boolean._
919
-
920
- In the case of a boolean set to `false`, the in-app messages will be disabled.
921
- When the passed `enabled` parameter is an [InAppMessageRefreshType](#selligentinappmessagerefreshtype) constant, the in-app messages will be enabled and the refresh frequency will be set to the provided value.
922
- The method will return an error if the parsed boolean is set to `true`, as to enable the in-app messages a refresh type is expected.
923
-
924
- ##### enableInAppMessages example
925
-
926
- ```javascript
927
- // to enable in-app messages
928
- Selligent.enableInAppMessages(
929
- (response) => { // success callback
930
- ...
931
- },
932
- (error) => { // error callback
933
- ...
934
- },
935
- Selligent.InAppMessageRefreshType.DAY
936
- );
937
- // to disable in-app messages
938
- Selligent.enableInAppMessages(
939
- (response) => { // success callback
940
- ...
941
- },
942
- (error) => { // error callback
943
- ...
944
- },
945
- false
946
- );
947
- ```
948
-
949
- <div align="right">
950
- <b><a href="#api-reference">back to API ToC</a></b>
951
- </div>
952
-
953
- #### Selligent.getInAppMessages(successCallback)
954
-
955
- This method returns all the in app messages send to you.
956
-
957
- The response of the success callback is an array of objects which contain the in app message(s) information.
958
-
959
- **Detailed overview:**
960
-
961
- | Property | Type | Description | Platform |
962
- | -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- | -------- |
963
- | id | string | Id of the in app message | Both |
964
- | title | string | Title of the in app message | Both |
965
- | body | string | Body of the in app message | Both |
966
- | type | enum [SelligentConstants.InAppMessageType](#selligentconstantsinappmessagetype) | Type of the in app message | Both |
967
- | creationDate | number | Creation date of the in app message in unix time | Both |
968
- | expirationDate | number | Expiration date of the in app message in unix time | Both |
969
- | receptionDate | number | Reception date of the in app message in unix time | Both |
970
- | hasBeenSeen | boolean | Indication if the in app message is seen | Both |
971
- | buttons | array of objects | Contains the buttons that are linked to the in app message | Both |
972
-
973
- <br />
974
-
975
- The `buttons` property is an array of button-objects which contain the information of a button linked to the in app message:
976
-
977
- <br />
978
-
979
- | Property | Type | Description | Platform |
980
- | -------- | ------ | ------------------------------------------ | ------------ |
981
- | id | string | Id of the button of the in app message | Both |
982
- | label | string | Label of the button of the in app message | Both |
983
- | value | string | Value of the button of the in app message | Both |
984
- | type | number | Type of the button of the in app message | Both |
985
- | action | number | Action of the button of the in app message | Android only |
986
-
987
- <br />
988
-
989
- ##### getInAppMessages example
990
-
991
- ```javascript
992
- // Get all in app messages
993
- Selligent.getInAppMessages(
994
- (response) => { // success callback
995
- ...
996
- }
997
- );
998
- ```
999
-
1000
- <div align="right">
1001
- <b><a href="#api-reference">back to API ToC</a></b>
1002
- </div>
1003
-
1004
- #### Selligent.setInAppMessageAsSeen(successCallback, errorCallback, messageId)
1005
-
1006
- Possibility to mark an in app message as seen.
1007
-
1008
- This method requires beside the callbacks another property to indicate the current in app message. To accomplish this behavior,&nbsp; `messageId` is required.
1009
-
1010
- ##### setInAppMessageAsSeen example
1011
-
1012
- ```javascript
1013
- Selligent.setInAppMessageAsSeen(
1014
- (response) => { // success callback
1015
- ...
1016
- },
1017
- (error) => { // error callback
1018
- ...
1019
- },
1020
- "id-of-message"
1021
- );
1022
- ```
1023
-
1024
- <div align="right">
1025
- <b><a href="#api-reference">back to API ToC</a></b>
1026
- </div>
1027
-
1028
- #### Selligent.executeButtonAction(successCallback, errorCallback, buttonId, messageId)
1029
-
1030
- Execute the action linked to the button.
1031
-
1032
- This method requires beside the callbacks another property to execute the action behind the button of the in app message. To accomplish this behavior,&nbsp; `buttonId` and `messageId` are required.
1033
-
1034
- ##### executeButtonAction example
1035
-
1036
- ```javascript
1037
- Selligent.executeButtonAction(
1038
- (response) => { // success callback
1039
- ...
1040
- },
1041
- (error) => { // error callback
1042
- ...
1043
- },
1044
- "id-of-button",
1045
- "id-of-message"
1046
- );
1047
- ```
1048
-
1049
- <div align="right">
1050
- <b><a href="#api-reference">back to API ToC</a></b>
1051
- </div>
1052
-
1053
- #### Selligent.sendEvent(successCallback, errorCallback, event)
1054
-
1055
- This method provides the functionality to send a specific or custom event.
1056
-
1057
- The method accepts an `event` object which requires certain properties, depending on the type of the event.
1058
-
1059
- **Detailed overview:**
1060
-
1061
- | Property | Type | Required | Platform | Default value |
1062
- | ----------- | ------------------------------------- | ------------------------------------------------- | -------- | ------------- |
1063
- | type | enum [EventType](#selligenteventtype) | Yes | Both | N/A |
1064
- | email | string | Yes if event type is specific, ignored if custom | Both | N/A |
1065
- | data | object | Yes if event type is custom, optional if specific | Both | N/A |
1066
- | shouldCache | boolean | No | iOS Only | true |
1067
-
1068
- The `type` property is used to define the event as _custom_ or _specific_ event, using the [EventType](#selligenteventtype) constants.
1069
-
1070
- To define it as a custom event, one should use the `SelligentConstants.EventType.CUSTOM` constant. All other event types can be used to define the event as something specific.
1071
-
1072
- When an event is a _specific_ event type, the `event` object requires an `email` property containing a string, and has an optional property `data` which is an object that can contain other information.
1073
- When an event is a _custom_ event type, the `event` object requires a `data` property containing an object which contains other information, and ignores the `email` property.
1074
-
1075
- **iOS specific:**
1076
-
1077
- On iOS the `event` object can contain an additional optional `shouldCache` property, which is a boolean that can be used to cache and retry sending events in situations where the event could not be delivered.
1078
-
1079
- By default it is set to `true`, setting it to `false` will disable it.
1080
-
1081
- ##### sendEvent example
1082
-
1083
- ```javascript
1084
- // send specific event
1085
- Selligent.sendEvent(
1086
- (response) => { // success callback
1087
- ...
1088
- },
1089
- (error) => { // error callback
1090
- ...
1091
- },
1092
- {
1093
- type: SelligentConstants.EventType.BUTTON_CLICKED // specific event
1094
- data: { // optional
1095
- id: 1337,
1096
- randomFlag: true,
1097
- description: "this is some extra information concerning this event"
1098
- }
1099
- email: "someone@somedomain.com" // required
1100
- },
1101
- shouldCache: false // iOS only, optional
1102
- );
1103
- // send custom event
1104
- Selligent.sendEvent(
1105
- (response) => { // success callback
1106
- ...
1107
- },
1108
- (error) => { // error callback
1109
- ...
1110
- },
1111
- {
1112
- type: SelligentConstants.EventType.CUSTOM // custom event
1113
- data: { // required
1114
- id: 1337,
1115
- someFlag: true,
1116
- description: "this is some extra information concerning this event"
1117
- }
1118
- email: "someone@somedomain.com" // ignored
1119
- }
1120
- );
1121
- ```
1122
-
1123
- <div align="right">
1124
- <b><a href="#api-reference">back to API ToC</a></b>
1125
- </div>
1126
-
1127
- #### Selligent.subscribeToEvents(successCallback, errorCallback, eventCallback)
1128
-
1129
- This method is used to subscribe to events.
1130
-
1131
- The response of the success callback is an object which contains information on the type of broadcast event and the data attached to it.
1132
-
1133
- **Detailed overview:**
1134
-
1135
- | Property | Type | Description |
1136
- | ------------------ | ------------------------------------------------------- | ----------------------------------------------------------------- |
1137
- | broadcastEventType | enum [BroadcastEventType](#selligentbroadcasteventtype) | The type of broadcast event |
1138
- | data | object | Contains more information specific to the type of broadcast event |
1139
-
1140
- The `data` property is an object itself containing more information specific to the type of the broadcast event:
1141
-
1142
- In case of a broadcast event type _ButtonClicked_ the detailed overview for the `data` is as such:
1143
-
1144
- | Property | Type | Description |
1145
- | -------- | -------------------------------------------------------------------------- | --------------------------------------- |
1146
- | type | iOS: enum [iOSNotificationButtonType](#selligentiosnotificationbuttontype) | The type of notification button clicked |
1147
- | | Android: integer | |
1148
- | value | string | A certain value the broadcof ast event |
1149
- | id | string | A certain id of the event |
1150
- | label | string | A certain label of the event |
1151
- | data | object | Specific additional data of the event |
1152
- | action | integer | Specific action of the event |
1153
-
1154
- In case of a broadcast event type _ReceivedInAppMessage_ the detailed overview for the `data` is as such:
1155
-
1156
- | Property | Type | Description |
1157
- | -------- | ----- | ---------------- |
1158
- | messages | array | List of messages |
1159
-
1160
- And the detailed overview for items in the `messages` array is as such:
1161
-
1162
- | Property | Type | Description |
1163
- | -------- | ------ | ------------------ |
1164
- | id | string | Id of a message |
1165
- | title | string | Title of a message |
1166
-
1167
- In case of a broadcast event type _ReceivedDeviceId_ the detailed overview for the `data` is as such:
1168
-
1169
- | Property | Type | Description |
1170
- | -------- | ------ | ------------- |
1171
- | deviceId | string | The device id |
1172
-
1173
- In case of a broadcast event type _ReceivedGCMToken_ the detailed overview for the `data` is as such:
1174
-
1175
- | Property | Type | Description |
1176
- | -------- | ------ | ------------------------------- |
1177
- | token | string | The token attached to the event |
1178
-
1179
- In case of a broadcast event type _ReceivedRemoteNotification_ the detailed overview for the `data` is as such:
1180
-
1181
- | Property | Type | Description |
1182
- | -------- | ------ | ------------------------------------------ |
1183
- | pushId | string | The id of the remote push notification |
1184
- | name | string | The name attached to the push notification |
1185
-
1186
- In case of a broadcast event type _WillDisplayNotification_ or _WillDismissNotification_ the `data` prop is `null`.
1187
-
1188
- **Android specific:**
1189
-
1190
- On the Android platform you can subscribe to custom events, by parsing an array of strings of these custom events. See the example for more information.
1191
-
1192
- ##### subscribeToEvents example
1193
-
1194
- ```javascript
1195
- Selligent.subscribeToEvents(
1196
- (response) => { // success callback
1197
- ...
1198
- },
1199
- (error) => { // error callback
1200
- ...
1201
- },
1202
- (eventCallback) => {
1203
- ...
1204
- }
1205
- ["some custom event x", "navigated to page y", "accepted request z"] // optional, android only
1206
- );
1207
- ```
1208
-
1209
- <div align="right">
1210
- <b><a href="#api-reference">back to API ToC</a></b>
1211
- </div>
1212
-
1213
- ### Android Only/Specific Methods
1214
-
1215
- #### Selligent.subscribeToEvent(eventCallback, eventName)
1216
-
1217
- This method is used to subscribe to a single event on Android.
1218
-
1219
- The response of the event callback is an object which contains information on the type of broadcast event and the data attached to it.
1220
-
1221
- ##### subscribeToEvent example
1222
-
1223
- ```javascript
1224
- Selligent.subscribeToEvents(
1225
- (event) => { // event callback
1226
- ...
1227
- },
1228
- "some custom event x" // custom event name
1229
- );
1230
- ```
1231
-
1232
- <div align="right">
1233
- <b><a href="#api-reference">back to API ToC</a></b>
1234
- </div>
1235
-
1236
- #### Selligent.areInAppMessagesEnabled(successCallback)
1237
-
1238
- Check if in-app messages are enabled or disabled.
1239
-
1240
- The response of the success callback returns a boolean stating the in-app messages are enabled or disabled.
1241
-
1242
- ##### areInAppMessagesEnabled example
1243
-
1244
- ```javascript
1245
- Selligent.areInAppMessagesEnabled(
1246
- (response) => { // success callback
1247
- ...
1248
- }
1249
- );
1250
- ```
1251
-
1252
- <div align="right">
1253
- <b><a href="#api-reference">back to API ToC</a></b>
1254
- </div>
1255
-
1256
- #### Selligent.enableAndroidLogging(successCallback, errorCallback, enabled)
1257
-
1258
- Display different actions and information logged by the SDK in the Android Studio logcat.
1259
-
1260
- The `enabled` parameter is a boolean to effectively enable or disable logging.
1261
-
1262
- ##### enableAndroidLogging example
1263
-
1264
- ```javascript
1265
- Selligent.enableAndroidLogging(
1266
- (response) => { // success callback
1267
- ...
1268
- },
1269
- (error) => { // error callback
1270
- ...
1271
- },
1272
- true
1273
- );
1274
- ```
1275
-
1276
- <div align="right">
1277
- <b><a href="#api-reference">back to API ToC</a></b>
1278
- </div>
1279
-
1280
- #### Selligent.displayMessage(successCallback, errorCallback, messageId)
1281
-
1282
- Display a specific in-app message.
1283
- The method accepts a parameter `messageId` which is a string containing the id of the in-app message to display.
1284
-
1285
- ##### displayMessage example
1286
-
1287
- ```javascript
1288
- Selligent.displayMessage(
1289
- (response) => { // success callback
1290
- ...
1291
- },
1292
- (error) => { // error callback
1293
- ...
1294
- },
1295
- "some in-app message id"
1296
- );
1297
- ```
1298
-
1299
- <div align="right">
1300
- <b><a href="#api-reference">back to API ToC</a></b>
1301
- </div>
1302
-
1303
- #### Selligent.areNotificationsEnabled(successCallback)
1304
-
1305
- Check if notifications are enabled or disabled.
1306
-
1307
- The response of the success callback returns a boolean stating the notifications are enabled or disabled.
1308
-
1309
- ##### areNotificationsEnabled example
1310
-
1311
- ```javascript
1312
- Selligent.areNotificationsEnabled(
1313
- (response) => { // success callback
1314
- ...
1315
- }
1316
- );
1317
- ```
1318
-
1319
- <div align="right">
1320
- <b><a href="#api-reference">back to API ToC</a></b>
1321
- </div>
1322
-
1323
- #### Selligent.setNotificationSmallIcon(successCallback, errorCallback, iconName)
1324
-
1325
- Set the small icon of a notification on Android.
1326
-
1327
- The method accepts an `iconName` parameter which is a string containing the name of the small icon. When the application is closed it will default back to the icons specified in `selligent.json`.
1328
-
1329
- > _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
1330
-
1331
- ##### setNotificationSmallIcon example
1332
-
1333
- ```javascript
1334
- Selligent.setNotificationSmallIcon(
1335
- (response) => { // success callback
1336
- ...
1337
- },
1338
- (error) => { // error callback
1339
- ...
1340
- },
1341
- "smallNotificationIcon"
1342
- );
1343
- ```
1344
-
1345
- <div align="right">
1346
- <b><a href="#api-reference">back to API ToC</a></b>
1347
- </div>
1348
-
1349
- #### Selligent.setNotificationLargeIcon(successCallback, errorCallback, iconName)
1350
-
1351
- Set the large icon of a notification on Android.
1352
-
1353
- The method accepts an `iconName` parameter which is a string containing the name of the large icon. When the application is closed it will default back to the icons specified in `selligent.json`.
1354
-
1355
- > _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
1356
-
1357
- ##### setNotificationLargeIcon example
1358
-
1359
- ```javascript
1360
- Selligent.setNotificationLargeIcon(
1361
- (response) => { // success callback
1362
- ...
1363
- },
1364
- (error) => { // error callback
1365
- ...
1366
- },
1367
- "largeNotificationIcon"
1368
- );
1369
- ```
1370
-
1371
- <div align="right">
1372
- <b><a href="#api-reference">back to API ToC</a></b>
1373
- </div>
1374
-
1375
- #### Selligent.setNotificationIconColor(successCallback, errorCallback, color)
1376
-
1377
- Set the icon color of a notification on Android.
1378
-
1379
- The method accepts a `color` parameter which is a string containing the hex value of color.
1380
-
1381
- > _The notification color can also be set by setting the notificationIconColor parameter in `selligent.json` to the hex color value_
1382
-
1383
- ##### setNotificationIconColor example
1384
-
1385
- ```javascript
1386
- Selligent.setNotificationIconColor(
1387
- (response) => { // success callback
1388
- ...
1389
- },
1390
- (error) => { // error callback
1391
- ...
1392
- },
1393
- "#00b8fb"
1394
- );
1395
- ```
1396
-
1397
- <div align="right">
1398
- <b><a href="#api-reference">back to API ToC</a></b>
1399
- </div>
1400
-
1401
- #### Selligent.getGCMToken(successCallback)
1402
-
1403
- Get the GCM token being used.
1404
-
1405
- The response of the success callback is a string containing the GCM token.
1406
-
1407
- ##### getGCMToken Example
1408
-
1409
- ```javascript
1410
- Selligent.getGCMToken(
1411
- (response) => { // success callback
1412
- ...
1413
- }
1414
- );
1415
- ```
1416
-
1417
- <div align="right">
1418
- <b><a href="#api-reference">back to API ToC</a></b>
1419
- </div>
1420
-
1421
- #### Selligent.getRemoteMessagesDisplayType(successCallback, errorCallback)
1422
-
1423
- Get the type of the remote messages that are being displayed.
1424
-
1425
- The response of the success callback is a number corresponding with a constant of the [AndroidRemoteMessagesDisplayType](#selligentinappmessagerefreshtype) enum.
1426
-
1427
- ##### getRemoteMessagesDisplayType Example
1428
-
1429
- ```javascript
1430
- Selligent.getRemoteMessagesDisplayType(
1431
- (response) => { // success callback
1432
- ...
1433
- },
1434
- (error) => { // error callback
1435
- ...
1436
- }
1437
- );
1438
- ```
1439
-
1440
- #### Selligent.setFirebaseToken(successCallback, errorCallback, token)
1441
-
1442
- Set the firebase token manually.
1443
-
1444
- ##### setFirebaseToken example
1445
-
1446
- ```javascript
1447
- window.Selligent.setFirebaseToken(
1448
- function (response) { // success callback
1449
- ...
1450
- },
1451
- function (error) { // error callback
1452
- ...
1453
- },
1454
- '123xyz'
1455
- );
1456
- ```
1457
-
1458
- ### iOS Only/Specific Methods
1459
-
1460
- <div align="right">
1461
- <b><a href="#api-reference">back to API ToC</a></b>
1462
- </div>
1463
-
1464
- #### Selligent.enableiOSLogging(successCallback, errorCallback, logLevels)
1465
-
1466
- Display different actions and information logged by the SDK.
1467
-
1468
- The `logLevels` parameter is an array of logging levels that you want to enable, using the [Selligent.iOSLogLevel](#selligentiosloglevel) enum.
1469
-
1470
- To disable a certain level, the existing array of the enabled logging level(s), minus the one you want to disable, should be passed to the method.
1471
- To disable all log levels you need to use the iOSLogLevel.NONE constant.
1472
- To enable all log levels use the iOSLogLevel.ALL constant.
1473
-
1474
- ##### enableiOSLogging example
1475
-
1476
- ```javascript
1477
- // to enable logging of info, warning and error statements
1478
- Selligent.enableiOSLogging(
1479
- (response) => { // success callback
1480
- ...
1481
- },
1482
- (error) => { // error callback
1483
- ...
1484
- },
1485
- [Selligent.iOSLogLevel.INFO, Selligent.iOSLogLevel.WARNING, Selligent.iOSLogLevel.ERROR]
1486
- );
1487
- // to disable all logging
1488
- Selligent.enableiOSLogging(
1489
- (response) => { // success callback
1490
- ...
1491
- },
1492
- (error) => { // error callback
1493
- ...
1494
- },
1495
- [Selligent.iOSLogLevel.NONE]
1496
- );
1497
- ```
1498
-
1499
- <div align="right">
1500
- <b><a href="#api-reference">back to API ToC</a></b>
1501
- </div>
1502
-
1503
- #### Selligent.displayNotification(successCallback, errorCallback, notificationId)
1504
-
1505
- Display a notification based on its id, which is a string that needs to be parsed in the method with the `notificationId` parameter.
1506
-
1507
- ##### displayNotification Example
1508
-
1509
- ```javascript
1510
- Selligent.displayNotification(
1511
- (response) => { // success callback
1512
- ...
1513
- },
1514
- (error) => { // error callback
1515
- ...
1516
- },
1517
- "some notification id"
1518
- );
1519
- ```
1520
-
1521
- <div align="right">
1522
- <b><a href="#api-reference">back to API ToC</a></b>
1523
- </div>
1524
-
1525
- #### Selligent.registerForProvisionalRemoteNotification(successCallback)
1526
-
1527
- You can decide to first ask for the Provisional push authorization (which will provide a valid push token but will not show any prompt to the user) if you want to contact users that did not decide about the Push permission yet (you can call `enableNotifications` later and it will still display the push permission prompt to the user).
1528
-
1529
- ##### registerForProvisionalRemoteNotification example
1530
-
1531
- ```javascript
1532
- Selligent.registerForProvisionalRemoteNotification(
1533
- () => { // success callback
1534
- ...
1535
- }
1536
- );
1537
- ```
1538
-
1539
- <div align="right">
1540
- <b><a href="#api-reference">back to API ToC</a></b>
1541
- </div>
1542
-
1543
- #### Selligent.registerRemoteNotificationFetchCompletionHandler(successCallback, errorCallback)
1544
-
1545
- Register a completion handler for successfully fetching remote notifications.
1546
-
1547
- The success callback is completion handler to be set.
1548
-
1549
- ##### registerRemoteNotificationFetchCompletionHandler example
1550
-
1551
- ```javascript
1552
- Selligent.registerRemoteNotificationFetchCompletionHandler(
1553
- (response) => { // success callback
1554
- ...
1555
- },
1556
- (error) => { // error callback
1557
- ...
1558
- }
1559
- );
1560
- ```
1561
-
1562
- <div align="right">
1563
- <b><a href="#api-reference">back to API ToC</a></b>
1564
- </div>
1565
-
1566
- #### Selligent.forceRemoteNotificationBackgroundFetchResult(successCallback, errorCallback, iOSBackgroundFetchResult)
1567
-
1568
- Force the result of a remote notification fetch to be a specific value.
1569
-
1570
- ##### forceRemoteNotificationBackgroundFetchResult example
1571
-
1572
- ```javascript
1573
- Selligent.forceRemoteNotificationBackgroundFetchResult(
1574
- (response) => { // success callback
1575
- ...
1576
- },
1577
- (error) => { // error callback
1578
- ...
1579
- },
1580
- Selligent.iOSBackgroundFetchResult.NEW_DATA
1581
- );
1582
- ```
1583
-
1584
- <div align="right">
1585
- <b><a href="#api-reference">back to API ToC</a></b>
1586
- </div>
1587
-
1588
- ### Constants
1589
-
1590
- #### SelligentConstants.ClearCacheIntervalValue
1591
-
1592
- Defines the interval value to clear the cache.
1593
-
1594
- | Name | Type | Value | Description |
1595
- | ----------- | ------ | ----- | -------------------------------------------- |
1596
- | AUTO | number | 1 | Clear cache automatically (on startup?) |
1597
- | NONE | number | 2 | Don't clear cache |
1598
- | Android.DAY | number | 3 | Clear cache daily, only available on Android |
1599
- | WEEK | number | 4 | Clear cache weekly |
1600
- | MONTH | number | 5 | Clear cache monthly |
1601
- | QUARTER | number | 6 | Clear cache quarterly |
1602
-
1603
- _Note: `ClearCacheIntervalValue.Android.DAY` is only used on Android and can not be used on iOS._
1604
-
1605
- <div align="right">
1606
- <b><a href="#api-reference">back to API ToC</a></b>
1607
- </div>
1608
-
1609
- #### SelligentConstants.InAppMessageType
1610
-
1611
- Defines the type of the in-app messages.
1612
-
1613
- | Name | Type | Value | Description |
1614
- | -------- | ------ | ----- | ------------------------------- |
1615
- | UNKNOWN | number | -2 | In App message of unknown type |
1616
- | HIDDEN | number | -1 | In App message of hidden type |
1617
- | ALERT | number | 0 | In App message of alert type |
1618
- | HTML | number | 1 | In App message of html type |
1619
- | URL | number | 2 | In App message of url type |
1620
- | IMAGE | number | 3 | In App message of image type |
1621
- | MAP | number | 4 | In App message of map type |
1622
- | PASSBOOK | number | 5 | In App message of passbook type |
1623
-
1624
- <div align="right">
1625
- <b><a href="#api-reference">back to API ToC</a></b>
1626
- </div>
1627
-
1628
- #### SelligentConstants.InAppMessageRefreshType
1629
-
1630
- Defines how often the SDK must retrieve the in-app messages.
1631
-
1632
- | Name | Type | Value | Description |
1633
- | -------------- | ------ | ----- | ---------------------------------- |
1634
- | NONE | number | 10 | Don't refresh the in-app messages |
1635
- | Android.MINUTE | number | 11 | Refresh minutely (only on Android) |
1636
- | HOUR | number | 12 | Refresh hourly |
1637
- | DAY | number | 13 | Refresh weekly |
1638
-
1639
- _Note: `InAppMessageRefreshType.Android.MINUTE` is only used on Android and can not be used on iOS._
1640
-
1641
- <div align="right">
1642
- <b><a href="#api-reference">back to API ToC</a></b>
1643
- </div>
1644
-
1645
- #### SelligentConstants.RemoteMessagesDisplayType
1646
-
1647
- Defines if and how remote messages can be displayed on Android.
1648
-
1649
- | Name | Type | Value | Description |
1650
- | ------------ | ------ | ----- | --------------------------------------- |
1651
- | AUTOMATIC | number | 20 | Display remote messages automatically |
1652
- | NONE | number | 21 | Don't display remote messages |
1653
- | NOTIFICATION | number | 22 | Display remote messages as notification |
1654
-
1655
- <div align="right">
1656
- <b><a href="#api-reference">back to API ToC</a></b>
1657
- </div>
1658
-
1659
- #### SelligentConstants.iOSLogLevel
1660
-
1661
- Defines the level of output of logging messages on iOS.
1662
-
1663
- | Name | Type | Value | Description |
1664
- | --------- | ------ | ----- | ----------------- |
1665
- | NONE | number | 50 | Output nothing |
1666
- | INFO | number | 51 | Output info |
1667
- | WARNING | number | 52 | Output warning |
1668
- | ERROR | number | 52 | Output error |
1669
- | HTTP_CALL | number | 52 | Output http calls |
1670
- | LOCATION | number | 52 | Output location |
1671
- | ALL | number | 52 | Output all |
1672
-
1673
- <div align="right">
1674
- <b><a href="#api-reference">back to API ToC</a></b>
1675
- </div>
1676
-
1677
- #### SelligentConstants.iOSBackgroundFetchResult
1678
-
1679
- Description of the possible results of a background fetch on iOS.
1680
-
1681
- | Name | Type | Value | Description |
1682
- | -------- | ------ | ----- | ---------------------------------------- |
1683
- | NEW_DATA | number | 60 | Background fetch resulted in new data |
1684
- | NO_DATA | number | 61 | Background fetch resulted in no new data |
1685
- | FAILED | number | 62 | Background fetch failed |
1686
-
1687
- <div align="right">
1688
- <b><a href="#api-reference">back to API ToC</a></b>
1689
- </div>
1690
-
1691
- #### SelligentConstants.iOSLocationAuthorisationStatus
1692
-
1693
- Description of the possible status of use of location services on a device.
1694
-
1695
- | Name | Type | Value | Description |
1696
- | -------------- | ------ | ----- | ----------------------------------------------- |
1697
- | UNKNOWN | number | 70 | Status of use of location services is unknown |
1698
- | REFUSED | number | 71 | Use of location services is refused |
1699
- | GRANTED_IN_USE | number | 72 | Use of location services is granted when in use |
1700
- | GRANTED_ALWAYS | number | 72 | Use of location services is always granted |
1701
-
1702
- <div align="right">
1703
- <b><a href="#api-reference">back to API ToC</a></b>
1704
- </div>
1705
-
1706
- #### SelligentConstants.iOSLocationAuthorisationType
1707
-
1708
- Defines the level of request for the authorisation of usage of location services on a device.
1709
-
1710
- | Name | Type | Value | Description |
1711
- | ------ | ------ | ----- | --------------------------------------------------------- |
1712
- | IN_USE | number | 80 | Request authorisation when location services are in use |
1713
- | ALWAYS | number | 81 | Always request the authorisation of the location services |
1714
-
1715
- <div align="right">
1716
- <b><a href="#api-reference">back to API ToC</a></b>
1717
- </div>
1718
-
1719
- #### SelligentConstants.EventType
1720
-
1721
- Defines the type of an event.
1722
-
1723
- | Name | Type | Value | Description |
1724
- | --------------- | ------ | ----- | ----------------- |
1725
- | USER_REGISTER | number | 90 | User registered |
1726
- | USER_UNREGISTER | number | 91 | User unregistered |
1727
- | USER_LOGIN | number | 92 | User logged in |
1728
- | USER_LOGOUT | number | 93 | User logged out |
1729
- | CUSTOM | number | 94 | Custom event |
1730
-
1731
- <div align="right">
1732
- <b><a href="#api-reference">back to API ToC</a></b>
1733
- </div>
1734
-
1735
- #### SelligentConstants.iOSNotificationButtonType
1736
-
1737
- Defines the type of button for notifications on iOS.
1738
-
1739
- | Name | Type | Value | Description |
1740
- | ----------------------------- | ------ | ----- | ----------------------------------------- |
1741
- | UNKNOWN | number | 100 | Unknown button type |
1742
- | SIMPLE_OPEN_PHONE_CALL | number | 101 | Simple open phone call button type |
1743
- | OPEN_SMS | number | 102 | Open sms button type |
1744
- | OPEN_MAIL | number | 103 | Open mail button type |
1745
- | OPEN_BROWSER | number | 104 | Open browser button type |
1746
- | OPEN_APPLICATION | number | 105 | Open application button type |
1747
- | RATE_APPLICATION | number | 105 | Rate application button type |
1748
- | CUSTOM_ACTION_BROADCAST_EVENT | number | 105 | Custom action broadcast event button type |
1749
- | RETURN_TEXT | number | 105 | Return text button type |
1750
- | RETURN_PHOTO | number | 105 | Return photo button type |
1751
- | RETURN_TEXT_AND_PHOTO | number | 105 | Return text and photo button type |
1752
- | PASSBOOK | number | 105 | Passbook button type |
1753
-
1754
- <div align="right">
1755
- <b><a href="#api-reference">back to API ToC</a></b>
1756
- </div>
1757
-
1758
- #### SelligentConstants.BroadcastEventType
1759
-
1760
- Defines the type of a broadcast event.
1761
-
1762
- | Name | Type | Value | Description |
1763
- | -------------------------------- | ------ | ---------------------------- | ----------------------------------------------------- |
1764
- | BUTTON_CLICKED | string | "ButtonClicked" | A button was clicked |
1765
- | RECEIVED_IN_APP_MESSAGE | string | "ReceivedInAppMessage" | An in-app message has been received |
1766
- | WILL_DISPLAY_NOTIFICATION | string | "WillDisplayNotification" | A notification will be displayed |
1767
- | WILL_DISMISS_NOTIFICATION | string | "WillDismissNotification" | A notification will be dismissed |
1768
- | RECEIVED_DEVICE_ID | string | "ReceivedDeviceId" | A device id has been received |
1769
- | Android.RECEIVED_GCM_TOKEN | string | "ReceivedGCMToken" | A GCM token has been received (only on Android) |
1770
- | iOS.RECEIVED_REMOTE_NOTIFICATION | string | "ReceivedRemoteNotification" | A remote notification has been received (only on iOS) |
1771
-
1772
- _Notes: `BroadcastEventType.Android.RECEIVED_GCM_TOKEN` is only used on Android and can not be used on iOS. `BroadcastEventType.iOS.RECEIVED_REMOTE_NOTIFICATION` is only used on iOS and can not be used on Android._
1773
-
1774
- <div align="right">
1775
- <b><a href="#api-reference">back to API ToC</a></b>
1776
- </div>
269
+ </details>