@selligent-marketing-cloud/selligent-react-native 2.7.0 → 2.10.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +241 -16
  3. package/RNSelligent.podspec +1 -0
  4. package/android/build/generated/source/buildConfig/debug/com/selligent/BuildConfig.java +12 -0
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +9 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
  7. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +4 -0
  8. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
  9. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  10. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  11. package/android/build/intermediates/compile_symbol_list/debug/R.txt +6535 -0
  12. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  13. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  14. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  16. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  17. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory$1.class +0 -0
  18. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory.class +0 -0
  19. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventDataParser.class +0 -0
  20. package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventType.class +0 -0
  21. package/android/build/intermediates/javac/debug/classes/com/selligent/BuildConfig.class +0 -0
  22. package/android/build/intermediates/javac/debug/classes/com/selligent/ButtonBroadcastEventDataParser.class +0 -0
  23. package/android/build/intermediates/javac/debug/classes/com/selligent/ClearCacheIntervalValue.class +0 -0
  24. package/android/build/intermediates/javac/debug/classes/com/selligent/Event.class +0 -0
  25. package/android/build/intermediates/javac/debug/classes/com/selligent/EventReceiver.class +0 -0
  26. package/android/build/intermediates/javac/debug/classes/com/selligent/EventType.class +0 -0
  27. package/android/build/intermediates/javac/debug/classes/com/selligent/GCMTokenBroadcastEventDataParser.class +0 -0
  28. package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageBroadcastEventDataParser.class +0 -0
  29. package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageRefreshType.class +0 -0
  30. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$1.class +0 -0
  31. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$2.class +0 -0
  32. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$3.class +0 -0
  33. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$4.class +0 -0
  34. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$5.class +0 -0
  35. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent.class +0 -0
  36. package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligentPackage.class +0 -0
  37. package/android/build/intermediates/javac/debug/classes/com/selligent/RemoteMessageDisplayType.class +0 -0
  38. package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory$1.class +0 -0
  39. package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory.class +0 -0
  40. package/android/build/intermediates/javac/debug/classes/com/selligent/SMSettingsFactory.class +0 -0
  41. package/android/build/intermediates/javac/debug/classes/com/selligent/Settings.class +0 -0
  42. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
  43. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +11 -0
  44. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +9 -0
  45. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  46. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +18 -0
  47. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  48. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +4893 -0
  49. package/android/build/outputs/logs/manifest-merger-debug-report.txt +25 -0
  50. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  51. package/android/build.gradle +35 -43
  52. package/android/libs/sdk-release.aar +0 -0
  53. package/android/src/main/java/com/selligent/RNSelligent.java +15 -0
  54. package/android/src/main/java/com/selligent/SMSettingsFactory.java +4 -0
  55. package/android/src/main/java/com/selligent/Settings.java +33 -0
  56. package/constants.d.ts +12 -0
  57. package/constants.js +24 -0
  58. package/index.d.ts +6 -0
  59. package/index.js +32 -0
  60. package/ios/ClientSettings.h +1 -0
  61. package/ios/ClientSettings.m +2 -0
  62. package/ios/EnumMapper.h +2 -0
  63. package/ios/EnumMapper.m +2 -0
  64. package/ios/LocationAuthorisationStatus.h +6 -0
  65. package/ios/LocationAuthorisationType.h +4 -0
  66. package/ios/RNSelligent.m +14 -0
  67. package/ios/SMManagerSetting+ClientSettings.m +5 -0
  68. package/ios/include/SMEvent.h +1 -1
  69. package/ios/include/SMHelper.h +6 -3
  70. package/ios/include/SMManager+InAppMessage.h +2 -2
  71. package/ios/include/SMManager+Location.h +41 -0
  72. package/ios/include/SMManager+UserNotification.h +16 -3
  73. package/ios/include/SMManager.h +1 -1
  74. package/ios/include/SMManagerInAppMessageDelegate.h +2 -2
  75. package/ios/include/SMManagerSetting+Location.h +27 -0
  76. package/ios/include/SMManagerSetting.h +2 -2
  77. package/ios/include/SMNSNotification.h +4 -10
  78. package/ios/include/SMRemoteMessageDisplayType.h +2 -2
  79. package/ios/libSelligentMobile.a +0 -0
  80. package/package.json +3 -3
@@ -0,0 +1,25 @@
1
+ -- Merging decision tree log ---
2
+ manifest
3
+ ADDED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml:2:1-5:12
4
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml:2:1-5:12
5
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml:2:1-5:12
6
+ package
7
+ ADDED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml:3:11-34
8
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
9
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
10
+ xmlns:android
11
+ ADDED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml:2:11-69
12
+ uses-sdk
13
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
14
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
15
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
16
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
17
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
18
+ android:targetSdkVersion
19
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
20
+ ADDED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
21
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
22
+ android:minSdkVersion
23
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
24
+ ADDED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
25
+ INJECTED from /Users/ben/Documents/code/appfoundry/selligent/af-selligent-react-native-module-dev-env/node_modules/selligent-react-native/android/src/main/AndroidManifest.xml
@@ -1,3 +1,8 @@
1
+ import com.android.build.api.variant.BuildConfigField
2
+
3
+ apply plugin: 'com.android.library'
4
+ apply plugin: 'maven-publish'
5
+
1
6
  buildscript {
2
7
  repositories {
3
8
  google()
@@ -5,20 +10,31 @@ buildscript {
5
10
  }
6
11
 
7
12
  dependencies {
8
- classpath 'com.android.tools.build:gradle:4.2.2'
13
+ classpath 'com.android.tools.build:gradle:7.2.2'
9
14
  }
10
15
  }
11
16
 
12
- apply plugin: 'com.android.library'
13
- apply plugin: 'maven'
17
+ def buildTypeAttr = Attribute.of("com.android.build.api.attributes.BuildTypeAttr", String)
18
+
19
+ dependencies.attributesSchema {
20
+ // registers this attribute to the attributes schema
21
+ attribute(buildTypeAttr)
22
+ }
23
+
24
+ configurations {
25
+ implementation {
26
+ attributes {
27
+ attribute(buildTypeAttr, "release")
28
+ }
29
+ }
30
+ }
14
31
 
15
32
  android {
16
- compileSdkVersion 30
17
- buildToolsVersion "30.0.2"
33
+ compileSdkVersion 32
18
34
 
19
35
  defaultConfig {
20
36
  minSdkVersion 21
21
- targetSdkVersion 30
37
+ targetSdkVersion 32
22
38
  ndkVersion = "21.4.7075529"
23
39
  versionCode 1
24
40
  versionName "1.0"
@@ -34,7 +50,7 @@ androidComponents {
34
50
  def selligentSettings = loadSelligentSettings(variant)
35
51
  if (selligentSettings != null) {
36
52
  try {
37
- variant.addBuildConfigField("SELLIGENT_SETTINGS", "\"" + selligentSettings + "\"", "Selligent settings")
53
+ variant.buildConfigFields.put("SELLIGENT_SETTINGS", new BuildConfigField("String", "\"" + selligentSettings + "\"", "Selligent settings"))
38
54
  } catch (MissingMethodException ignored) {
39
55
  throw new Exception("Selligent requires Android Gradle plugin version 4.2.0 or higher.")
40
56
  }
@@ -54,45 +70,26 @@ dependencies {
54
70
 
55
71
  implementation 'com.facebook.react:react-native:+'
56
72
  implementation 'com.android.support:cardview-v7:27.1.1'
57
- implementation 'com.google.code.gson:gson:2.8.5'
73
+ implementation 'com.plotprojects:plot-android:3.13.1'
74
+ implementation 'com.google.code.gson:gson:2.8.9'
58
75
  implementation 'com.google.firebase:firebase-messaging:21.0.0'
59
- implementation 'androidx.work:work-runtime:2.4.0'
76
+ implementation 'androidx.work:work-runtime:2.7.1'
60
77
  implementation 'androidx.concurrent:concurrent-futures:1.1.0'
61
78
  implementation 'androidx.cardview:cardview:1.0.0'
62
79
  }
63
80
 
64
- def configureReactNativePom(def pom) {
65
- def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
66
-
67
- pom.project {
68
- name packageJson.title
69
- artifactId packageJson.name
70
- version = packageJson.version
71
- group = "com.selligent"
72
- description packageJson.description
73
- url packageJson.repository.baseUrl
74
-
75
- licenses {
76
- license {
77
- name packageJson.license
78
- url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
79
- distribution 'repo'
80
- }
81
- }
82
- }
83
- }
84
-
85
81
  afterEvaluate { project ->
86
82
 
87
83
  task androidJavadoc(type: Javadoc) {
88
84
  source = android.sourceSets.main.java.srcDirs
89
85
  classpath += files(android.bootClasspath)
90
- classpath += files(project.getConfigurations().getByName('compile').asList())
86
+ project.getConfigurations().getByName('implementation').setCanBeResolved(true)
87
+ classpath += files(project.getConfigurations().getByName('implementation').asList())
91
88
  include '**/*.java'
92
89
  }
93
90
 
94
91
  task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
95
- classifier = 'javadoc'
92
+ archiveClassifier = 'javadoc'
96
93
  from androidJavadoc.destinationDir
97
94
  }
98
95
 
@@ -109,17 +106,12 @@ afterEvaluate { project ->
109
106
  }
110
107
  }
111
108
 
112
- artifacts {
113
- archives androidSourcesJar
114
- archives androidJavadocJar
115
- }
116
-
117
- task installArchives(type: Upload) {
118
- configuration = configurations.archives
119
- repositories.mavenDeployer {
120
- repository url: "file://${projectDir}/../android/maven"
121
-
122
- configureReactNativePom pom
109
+ publishing {
110
+ publications {
111
+ maven(MavenPublication) {
112
+ artifact androidSourcesJar
113
+ artifact androidJavadocJar
114
+ }
123
115
  }
124
116
  }
125
117
  }
Binary file
@@ -249,6 +249,21 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
249
249
  SMManager.DEBUG = enable;
250
250
  }
251
251
 
252
+ @ReactMethod
253
+ public void enableGeolocation(Boolean enable) {
254
+ if (enable) {
255
+ smManager.enableGeolocation();
256
+ } else {
257
+ smManager.disableGeolocation();
258
+ }
259
+ }
260
+
261
+ @ReactMethod
262
+ public void isGeolocationEnabled(Callback successCallback) {
263
+ final Boolean isGeolocationEnabled = smManager.isGeolocationEnabled();
264
+ successCallback.invoke(isGeolocationEnabled);
265
+ }
266
+
252
267
  @ReactMethod
253
268
  public void sendEvent(ReadableMap eventMap, final Callback successCallback, final Callback errorCallback) {
254
269
  final Event event = Event.fromHashMap(eventMap.toHashMap());
@@ -10,10 +10,14 @@ class SMSettingsFactory {
10
10
  smSettings.ClientId = settings.getClientId();
11
11
  smSettings.PrivateKey = settings.getPrivateKey();
12
12
  smSettings.GoogleApplicationId = settings.getGoogleApplicationId();
13
+ smSettings.ConfigureGeolocation = settings.getConfigureLocationServices();
13
14
  smSettings.AddInAppMessageFromPushToInAppMessageList = settings.getAddInAppMessageFromPushToInAppMessageList();
14
15
  smSettings.DoNotFetchTheToken = settings.getDoNotFetchTheToken();
15
16
  smSettings.DoNotListenToThePush = settings.getDoNotListenToThePush();
16
17
  smSettings.LoadCacheAsynchronously = settings.getLoadCacheAsynchronously();
18
+ smSettings.NotificationChannelId = settings.getNotificationChannelId();
19
+ smSettings.NotificationChannelName = settings.getNotificationChannelName();
20
+ smSettings.NotificationChannelDescription = settings.getNotificationChannelDescription();
17
21
 
18
22
  final ClearCacheIntervalValue clearCacheIntervalValue = settings.getClearCacheIntervalValue();
19
23
  if (clearCacheIntervalValue != null) {
@@ -17,9 +17,13 @@ class Settings {
17
17
  private Boolean doNotFetchTheToken = false;
18
18
  private Boolean doNotListenToThePush = false;
19
19
  private Boolean loadCacheAsynchronously = false;
20
+ private Boolean configureLocationServices = false;
20
21
  private ClearCacheIntervalValue clearCacheIntervalValue;
21
22
  private InAppMessageRefreshType inAppMessageRefreshType;
22
23
  private RemoteMessageDisplayType remoteMessageDisplayType;
24
+ private String notificationChannelId = "SMChannel001";
25
+ private String notificationChannelName = "SMDefaultChannel";
26
+ private String notificationChannelDescription = "";
23
27
 
24
28
  private Settings() { }
25
29
 
@@ -55,6 +59,10 @@ class Settings {
55
59
  return notificationIconColor;
56
60
  }
57
61
 
62
+ public Boolean getConfigureLocationServices() {
63
+ return configureLocationServices;
64
+ }
65
+
58
66
  public Boolean getDoNotListenToThePush() { return doNotListenToThePush; }
59
67
 
60
68
  public Boolean getAddInAppMessageFromPushToInAppMessageList() { return addInAppMessageFromPushToInAppMessageList; }
@@ -75,6 +83,18 @@ class Settings {
75
83
  return remoteMessageDisplayType;
76
84
  }
77
85
 
86
+ public String getNotificationChannelId() {
87
+ return notificationChannelId;
88
+ }
89
+
90
+ public String getNotificationChannelName() {
91
+ return notificationChannelName;
92
+ }
93
+
94
+ public String getNotificationChannelDescription() {
95
+ return notificationChannelDescription;
96
+ }
97
+
78
98
  public static Settings fromHashMap(HashMap<String, Object> settingsHashMap) {
79
99
  final Settings settings = new Settings();
80
100
 
@@ -84,6 +104,10 @@ class Settings {
84
104
  if (settingsHashMap.containsKey("googleApplicationId")) {
85
105
  settings.googleApplicationId = (String) settingsHashMap.get("googleApplicationId");
86
106
  }
107
+ if (settingsHashMap.containsKey("configureLocationServices")) {
108
+ settings.configureLocationServices = (Boolean) settingsHashMap.get("configureLocationServices");
109
+
110
+ }
87
111
  settings.activityName = (String) settingsHashMap.get("fullyQualifiedNotificationActivityClassName");
88
112
 
89
113
  if (settingsHashMap.containsKey("notificationSmallIcon")) {
@@ -113,6 +137,15 @@ class Settings {
113
137
  if (settingsHashMap.containsKey("loadCacheAsynchronously")) {
114
138
  settings.loadCacheAsynchronously = (Boolean) settingsHashMap.get("loadCacheAsynchronously");
115
139
  }
140
+ if (settingsHashMap.containsKey("notificationChannelId")) {
141
+ settings.notificationChannelId = (String) settingsHashMap.get("notificationChannelId");
142
+ }
143
+ if (settingsHashMap.containsKey("notificationChannelName")) {
144
+ settings.notificationChannelName = (String) settingsHashMap.get("notificationChannelName");
145
+ }
146
+ if (settingsHashMap.containsKey("notificationChannelDescription")) {
147
+ settings.notificationChannelDescription = (String) settingsHashMap.get("notificationChannelDescription");
148
+ }
116
149
 
117
150
  final Double clearCacheIndex = (Double) settingsHashMap.get("clearCacheIntervalValue");
118
151
  if (clearCacheIndex != null) {
package/constants.d.ts CHANGED
@@ -53,6 +53,18 @@ export namespace iOSBackgroundFetchResult {
53
53
  const FAILED = 62;
54
54
  }
55
55
 
56
+ export namespace iOSLocationAuthorisationStatus {
57
+ const UNKNOWN = 70;
58
+ const REFUSED = 71;
59
+ const GRANTED_IN_USE = 72;
60
+ const GRANTED_ALWAYS = 73;
61
+ }
62
+
63
+ export namespace iOSLocationAuthorisationType {
64
+ const IN_USE = 80;
65
+ const ALWAYS = 81;
66
+ }
67
+
56
68
  export namespace EventType {
57
69
  const USER_REGISTER = 90;
58
70
  const USER_UNREGISTER = 91;
package/constants.js CHANGED
@@ -102,6 +102,30 @@ var SelligentConstants = {
102
102
  /** Background fetch failed */
103
103
  FAILED: 62
104
104
  },
105
+ /**
106
+ * @description
107
+ * Description of the possible status of use of location services on a device.
108
+ */
109
+ iOSLocationAuthorisationStatus: {
110
+ /** Status of use of location services is unknown */
111
+ UNKNOWN: 70,
112
+ /** Use of location services is refused */
113
+ REFUSED: 71,
114
+ /** Use of location services is granted when in use */
115
+ GRANTED_IN_USE: 72,
116
+ /** Use of location services is always granted */
117
+ GRANTED_ALWAYS: 73
118
+ },
119
+ /**
120
+ * @description
121
+ * Defines the level of request for the authorisation of usage of location services on a device.
122
+ */
123
+ iOSLocationAuthorisationType: {
124
+ /** Request authorisation when in location services are in use */
125
+ IN_USE: 80,
126
+ /** Always request the authorisation of the location services */
127
+ ALWAYS: 81
128
+ },
105
129
  /**
106
130
  * @description
107
131
  * Defines the type of an event.
package/index.d.ts CHANGED
@@ -11,6 +11,12 @@ export function executeButtonAction(
11
11
  buttonId: string,
12
12
  messageId: string
13
13
  ): void;
14
+ export function enableGeolocation(
15
+ successCallback: Function,
16
+ errorCallback: Function,
17
+ enabled: boolean
18
+ ): void;
19
+ export function isGeolocationEnabled(successCallback: Function): void;
14
20
  export function sendEvent(
15
21
  successCallback: Function,
16
22
  errorCallback: Function,
package/index.js CHANGED
@@ -98,6 +98,38 @@ export default Object.assign(
98
98
  return
99
99
  },
100
100
 
101
+ // Location
102
+
103
+ /**
104
+ * Enable/disable geolocation.
105
+ *
106
+ * @param {function} successCallback Callback function on success.
107
+ * @param {function} errorCallback Callback function on error.
108
+ * @param {boolean} enabled Boolean to enable or disable geolocation.
109
+ */
110
+ enableGeolocation: function (successCallback, errorCallback, enabled) {
111
+ // check if required options are valid
112
+ if (!SelligentHelpers.typeMatches(enabled, 'boolean')) {
113
+ errorCallback(SelligentHelpers.wrongArgumentError('Expected a boolean.'))
114
+ return
115
+ }
116
+
117
+ // continue if options are valid
118
+ successCallback(SelligentHelpers.SUCCESS)
119
+ RNSelligent.enableGeolocation(enabled)
120
+ return
121
+ },
122
+
123
+ /**
124
+ * Check if geolocation is enabled or disabled.
125
+ *
126
+ * @param {function} successCallback Callback function on success.
127
+ */
128
+ isGeolocationEnabled: function (successCallback) {
129
+ RNSelligent.isGeolocationEnabled(successCallback)
130
+ return
131
+ },
132
+
101
133
  // Event
102
134
 
103
135
  /**
@@ -11,6 +11,7 @@
11
11
  @property (nonatomic, strong, readonly) NSNumber *shouldAddInAppMessageFromPushToInAppMessageList;
12
12
  @property (nonatomic, strong, readonly) NSNumber *shouldClearBadge;
13
13
  @property (nonatomic, strong, readonly) NSNumber *shouldDisplayRemoteNotification;
14
+ @property (nonatomic, strong, readonly) NSNumber *configureLocationServices;
14
15
  @property (nonatomic, strong, readonly) NSNumber *clearCacheIntervalValue;
15
16
  @property (nonatomic, strong, readonly) NSNumber *remoteMessageDisplayType;
16
17
  @property (nonatomic, strong, readonly) InAppMessageSettings *inAppMessageSettings;
@@ -11,6 +11,7 @@
11
11
  @property (nonatomic, strong) NSNumber *shouldAddInAppMessageFromPushToInAppMessageList;
12
12
  @property (nonatomic, strong) NSNumber *shouldClearBadge;
13
13
  @property (nonatomic, strong) NSNumber *shouldDisplayRemoteNotification;
14
+ @property (nonatomic, strong) NSNumber *configureLocationServices;
14
15
  @property (nonatomic, strong) NSNumber *clearCacheIntervalValue;
15
16
  @property (nonatomic, strong) NSNumber *remoteMessageDisplayType;
16
17
  @property (nonatomic, strong) InAppMessageSettings *inAppMessageSettings;
@@ -28,6 +29,7 @@
28
29
  clientSettings.shouldAddInAppMessageFromPushToInAppMessageList = dictionary[@"addInAppMessageFromPushToInAppMessageList"];
29
30
  clientSettings.shouldClearBadge = dictionary[@"shouldClearBadge"];
30
31
  clientSettings.shouldDisplayRemoteNotification = dictionary[@"shouldDisplayRemoteNotification"];
32
+ clientSettings.configureLocationServices = dictionary[@"configureLocationServices"];
31
33
  clientSettings.clearCacheIntervalValue = dictionary[@"clearCacheIntervalValue"];
32
34
  clientSettings.remoteMessageDisplayType = dictionary[@"remoteMessageDisplayType"];
33
35
  clientSettings.inAppMessageSettings = [InAppMessageSettings fromDictionary:dictionary];
package/ios/EnumMapper.h CHANGED
@@ -2,6 +2,8 @@
2
2
  #import "LogLevel.h"
3
3
  #import "InAppMessageRefreshType.h"
4
4
  #import "RemoteMessageDisplayType.h"
5
+ #import "LocationAuthorisationStatus.h"
6
+ #import "LocationAuthorisationType.h"
5
7
  #import "ClearCacheInterval.h"
6
8
  #import "SMLog.h"
7
9
  #import "SMClearCache.h"
package/ios/EnumMapper.m CHANGED
@@ -5,6 +5,8 @@
5
5
  NSDictionary *_clearCacheIntervalEnumMapping;
6
6
  NSDictionary *_inAppRefreshTypeEnumMapping;
7
7
  NSDictionary *_remoteMessageDisplayTypeEnumMapping;
8
+ NSDictionary *_locationAuthorisationStatusMapping;
9
+ NSDictionary *_locationAuthorisationTypeMapping;
8
10
  NSDictionary *_backgroundFetchResult;
9
11
  NSDictionary *_notificationButtonTypeMapping;
10
12
  }
@@ -0,0 +1,6 @@
1
+ typedef enum LocationAuthorisationStatus : NSInteger {
2
+ ilasUnknown = 70,
3
+ ilasRefused = 71,
4
+ ilasGrantedInUse = 72,
5
+ ilasGrantedAlways = 73
6
+ } LocationAuthorisationStatus;
@@ -0,0 +1,4 @@
1
+ typedef enum LocationAuthorisationType : NSInteger {
2
+ ilatInUse = 80,
3
+ ilatAlways = 81
4
+ } LocationAuthorisationType;
package/ios/RNSelligent.m CHANGED
@@ -3,6 +3,7 @@
3
3
  #import "SMNSNotification.h"
4
4
  #import "SMManager+DataTransaction.h"
5
5
  #import "SMManagerSetting+ClientSettings.h"
6
+ #import "SMManager+Location.h"
6
7
  #import "SMManager+Log.h"
7
8
  #import "SMManager+SMEvent.h"
8
9
  #import "SMManager+RemoteNotification.h"
@@ -188,6 +189,11 @@ RCT_EXPORT_METHOD(applyLogLevel:(NSArray<NSNumber *> *)logLevels) {
188
189
  [[SMManager sharedInstance] applyLogLevel:(SMLogLevel) requestedBitShiftedLogLevel];
189
190
  }
190
191
 
192
+ RCT_EXPORT_METHOD(isGeolocationEnabled:(RCTResponseSenderBlock)callback) {
193
+ BOOL enabled = [[SMManager sharedInstance] isGeoLocationEnabled];
194
+ callback(@[@(enabled), [NSNull null]]);
195
+ }
196
+
191
197
  RCT_EXPORT_METHOD(sendEvent:(NSDictionary *)data successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback) {
192
198
  Event *event = [Event fromDictionary:data];
193
199
  SMEvent *smEvent = [event smEventWithBlockSuccess:^(SMSuccess *success) {
@@ -198,6 +204,14 @@ RCT_EXPORT_METHOD(sendEvent:(NSDictionary *)data successCallback:(RCTResponseSen
198
204
  [[SMManager sharedInstance] sendSMEvent:smEvent];
199
205
  }
200
206
 
207
+ RCT_EXPORT_METHOD(enableGeolocation:(BOOL)enable) {
208
+ if (enable) {
209
+ [[SMManager sharedInstance] enableGeoLocation];
210
+ } else {
211
+ [[SMManager sharedInstance] disableGeoLocation];
212
+ }
213
+ }
214
+
201
215
  RCT_EXPORT_METHOD(forceRemoteNotificationBackgroundFetchResult:(nonnull NSNumber *)remoteNotificationBackgroundFetchResult) {
202
216
  self.requestedForcedRemoteNotificationBackgroundFetchResult = @([[EnumMapper sharedEnumMapper] uiBackgroundFetchResultForBackgroundFetchResult:remoteNotificationBackgroundFetchResult.integerValue]);
203
217
  }
@@ -1,4 +1,5 @@
1
1
  #import "SMManagerSetting+ClientSettings.h"
2
+ #import "SMManagerSetting+Location.h"
2
3
  #import "SMManagerSettingIAM.h"
3
4
  #import "ClientSettings.h"
4
5
  #import "EnumMapper.h"
@@ -34,6 +35,10 @@
34
35
  if(shouldClearBadgeAsNumber) {
35
36
  settings.shouldClearBadge = shouldClearBadgeAsNumber.boolValue;
36
37
  }
38
+
39
+ if(clientSettings.configureLocationServices.boolValue) {
40
+ [settings configureLocationService];
41
+ }
37
42
 
38
43
  NSNumber *shouldDisplayRemoteNotificationAsNumber = clientSettings.shouldDisplayRemoteNotification;
39
44
  if(shouldDisplayRemoteNotificationAsNumber) {
@@ -34,7 +34,7 @@
34
34
  + (instancetype _Nonnull) eventWithDictionary:(NSDictionary* _Nullable)dict;
35
35
 
36
36
  /*!
37
- * Allow to initialise a success block and/or a failure block that will be triggered after an event is sent to the platform
37
+ * Allow to initialize a success block and/or a failure block that will be triggered after an event is sent to the platform
38
38
  *
39
39
  * @param blockSuccess An SMCompletionBlockSuccess block that will be triggered if the send to the platform is successfull
40
40
  * @param blockFailure An SMCompletionBlockFailure block that will be triggered if the send to the platform has failed
@@ -1,11 +1,14 @@
1
1
  //
2
- // SMHelper.h
2
+ // SMHelper+Location.h
3
3
  // MobileSDK
4
4
  //
5
- // Created by Samy Ziat on 29/09/15.
6
- // Copyright (c) 2015 Selligent. All rights reserved.
5
+ // Created by Marc Biosca on 6/29/21.
6
+ // Copyright © 2021 Selligent. All rights reserved.
7
7
  //
8
8
 
9
+ #import "SMManager+Location.h"
10
+ #import "SMManagerSetting+Location.h"
11
+
9
12
  #import "SMManagerHelper.h"
10
13
 
11
14
  #import "SMNSNotification.h"
@@ -161,8 +161,8 @@
161
161
  - (void) removeViewController;
162
162
 
163
163
  /**
164
- * Used to let the app display the inapp message linked to a remote notification
165
- * @abstract this setting will allow you to manage on app side the display of the inapp message linked to a push remote notification
164
+ * Used to let the app display the in-app message linked to a remote notification
165
+ * @abstract this setting will allow you to manage on app side the display of the in-app message linked to a push remote notification
166
166
  * In order to display it in your side the delegate object should implement [SMManagerInAppMessageDelegate displayInAppMessage:] method it will provide tha app with a SMInAppMessage object
167
167
  * @param delegate an object implementing SMManagerInAppMessageDelegate methods
168
168
  * @see SMManagerInAppMessageDelegate
@@ -0,0 +1,41 @@
1
+ //
2
+ // SMManager+Location.h
3
+ // MobileSDK
4
+ //
5
+ // Created by Samy Ziat on 02/12/15.
6
+ // Copyright © 2015 Selligent. All rights reserved.
7
+ //
8
+
9
+ #import "SMManager.h"
10
+
11
+ /*!
12
+ * In order to use the location services features provided by the sdk you will mandatory need to use the lsdk library supporting the plotproject framework .
13
+ * Otherwise calling the method in this SMManager category will have no effect and no ios api related to geofencing will be called (as this is all done by the plot project framework)
14
+ */
15
+ @interface SMManager (Location)
16
+
17
+ /**
18
+ * Enable geolocation services
19
+ *
20
+ * @discussion This optional call will enable geolocation services at sdk level. it is independent of iOS location authorisation
21
+ * If you use plotproject for geolocation it will be mandatory to call it if you have set enableOnFirstRun to false in the plotconfig.json
22
+ * Call this API according to your application's need.
23
+ */
24
+ - (void) enableGeoLocation;
25
+
26
+ /**
27
+ * Disable geolocation services
28
+ *
29
+ * @discussion This optional call will disable geolocation services at sdk level. it is independent of iOS location authorisation
30
+ * Call this API according to your application's need.
31
+ */
32
+ - (void) disableGeoLocation;
33
+
34
+ /**
35
+ * Check the geolocation services status
36
+ *
37
+ * @discussion This optional call will inform you if geolocation services at sdk level are enabled. it is independent of iOS location authorisation
38
+ */
39
+ - (BOOL) isGeoLocationEnabled;
40
+
41
+ @end
@@ -103,9 +103,9 @@
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
- * @param setting mandatory SMManagerSetting instance to start-up the library - this setting mus tbe initialised with only url, clienID and privateKet provided by selligent
106
+ * @param setting mandatory SMManagerSetting instance to start-up the library - this setting mus tbe initialized with only url, clienID and privateKet provided by selligent
107
107
  * @see SMManagerSetting
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
108
+ * @discussion This method is mandatory in order to start / initialize 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
109
  * @see SMManagerSetting
110
110
  */
111
111
  - (void) startExtensionWithSetting:(SMManagerSetting*_Nonnull)setting;
@@ -120,7 +120,20 @@
120
120
  *
121
121
  * @param notification A UNNotification that contains information about the notification.
122
122
  */
123
- - (void) didReceiveNotification:(UNNotification*_Nonnull)notification;
123
+ - (void) didReceiveNotification:(UNNotification*_Nonnull)notification __deprecated_msg("Method deprecated. Use `didReceiveNotification:withContext:`");
124
+
125
+ /*!
126
+ * Optional API, when building against iOS 10+ and using a Notification Content Extension target, to be included in NotificationViewController didReceiveNotification:
127
+ * Handle the push action buttons that may be present in the selligent notification payload
128
+ *
129
+ * This allows the SDK to display the action buttons in the push notification outside of the app.
130
+ *
131
+ * The category that must be added to Info.plist of the Notification Content Extension target is mandatory and must be SELLIGENT_BUTTON.
132
+ *
133
+ * @param notification A UNNotification that contains information about the notification.
134
+ * @param context A NSExtensionContext that contains the context information of the extension.
135
+ */
136
+ - (void) didReceiveNotification:(UNNotification*_Nonnull)notification withContext:(NSExtensionContext*_Nullable)context;
124
137
 
125
138
  /*!
126
139
  * Optional API, when building against iOS 10+ and using a Notification Service Extension target, to be included in NotificationService didReceiveNotificationRequest:withContentHandler:
@@ -46,7 +46,7 @@
46
46
  * @param launchOptions NSDictionary instance indicating the reason the app was launched (if any). This dictionary is provided by application:didFinishLaunchingWithOptions
47
47
  * @param setting mandatory SMManagerSetting instance to start-up the library
48
48
  * @see SMManagerSetting
49
- * @discussion This method is mandatory in order to start / initialise the library and should be called in application:didFinishLaunchingWithOptions:
49
+ * @discussion This method is mandatory in order to start / initialize the library and should be called in application:didFinishLaunchingWithOptions:
50
50
  */
51
51
  - (void) startWithLaunchOptions:(NSDictionary* _Nullable)launchOptions Setting:(SMManagerSetting* _Null_unspecified)setting;
52
52
 
@@ -10,13 +10,13 @@
10
10
  #import "SMInAppMessage.h"
11
11
 
12
12
  /**
13
- * This protocol will help you intercept the inapp messages and allow you to display them your own way or store them somewhere to be shown later.
13
+ * This protocol will help you intercept the in-app messages and allow you to display them your own way or store them somewhere to be shown later.
14
14
  */
15
15
  @protocol SMManagerInAppMessageDelegate <NSObject>
16
16
  @optional
17
17
 
18
18
  /*!
19
- * @abstract Invoked when an inapp message linked to a remote notification is received by sdk.
19
+ * @abstract Invoked when an in-app message linked to a remote notification is received by sdk.
20
20
  * @param inAppMessage The inAppMessage object containing all necessary datas for you to display content of the message
21
21
  */
22
22
  - (void) displayInAppMessage:(SMInAppMessage*_Nonnull)inAppMessage;