@selligent-marketing-cloud/selligent-react-native 2.4.0 → 2.8.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 (127) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +354 -245
  3. package/RNSelligent.podspec +4 -4
  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 +16 -0
  7. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -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 +6408 -0
  12. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  13. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  14. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -0
  16. package/android/build/intermediates/incremental/packageDebugResources/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 +16 -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 +4798 -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/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +43 -0
  52. package/android/build.gradle +38 -32
  53. package/android/libs/sdk-release.aar +0 -0
  54. package/android/src/main/java/com/selligent/RNSelligent.java +41 -3
  55. package/android/src/main/java/com/selligent/SMSettingsFactory.java +1 -0
  56. package/android/src/main/java/com/selligent/Settings.java +16 -0
  57. package/constants.d.ts +18 -0
  58. package/constants.js +30 -2
  59. package/index.android.js +42 -0
  60. package/index.d.ts +14 -6
  61. package/index.ios.js +12 -29
  62. package/index.js +13 -1
  63. package/ios/ClientSettings.h +2 -0
  64. package/ios/ClientSettings.m +4 -0
  65. package/ios/EnumMapper.h +3 -6
  66. package/ios/EnumMapper.m +8 -24
  67. package/ios/RNSelligent.m +25 -13
  68. package/ios/RemoteMessageDisplayType.h +5 -0
  69. package/ios/SMManagerSetting+ClientSettings.m +15 -4
  70. package/ios/SelligentReactNative.xcodeproj/project.pbxproj +4 -12
  71. package/ios/include/SMBaseMessage.h +8 -12
  72. package/ios/include/SMBlock.h +2 -2
  73. package/ios/include/SMClearCache.h +0 -2
  74. package/ios/include/SMContentAlignment.h +1 -2
  75. package/ios/include/SMDeviceInfos.h +10 -8
  76. package/ios/include/SMDisplayMode.h +1 -2
  77. package/ios/include/SMEvent.h +21 -17
  78. package/ios/include/SMEventUser.h +0 -1
  79. package/ios/include/SMEventUserLogin.h +11 -16
  80. package/ios/include/SMEventUserLogout.h +12 -16
  81. package/ios/include/SMEventUserRegistration.h +12 -17
  82. package/ios/include/SMEventUserUnregistration.h +12 -16
  83. package/ios/include/SMFailure.h +1 -6
  84. package/ios/include/SMHelper.h +12 -4
  85. package/ios/include/SMInAppContentHTMLViewController.h +11 -9
  86. package/ios/include/SMInAppContentImageViewController.h +6 -6
  87. package/ios/include/SMInAppContentMessage.h +12 -12
  88. package/ios/include/SMInAppContentStyleOptions.h +91 -79
  89. package/ios/include/SMInAppContentType.h +2 -3
  90. package/ios/include/SMInAppContentURLViewController.h +10 -9
  91. package/ios/include/SMInAppContentViewController.h +3 -6
  92. package/ios/include/SMInAppMessage.h +22 -14
  93. package/ios/include/SMInAppMessageType.h +2 -6
  94. package/ios/include/SMInAppRefreshType.h +1 -1
  95. package/ios/include/SMLink.h +7 -11
  96. package/ios/include/SMLog.h +1 -1
  97. package/ios/include/SMManager+DataTransaction.h +6 -13
  98. package/ios/include/SMManager+InAppContent.h +20 -23
  99. package/ios/include/SMManager+InAppMessage.h +65 -42
  100. package/ios/include/SMManager+Location.h +7 -63
  101. package/ios/include/SMManager+Log.h +3 -14
  102. package/ios/include/SMManager+RemoteNotification.h +38 -34
  103. package/ios/include/SMManager+SMEvent.h +10 -10
  104. package/ios/include/SMManager+SMLink.h +44 -0
  105. package/ios/include/SMManager+SilentPush.h +5 -22
  106. package/ios/include/SMManager+StyleOptions.h +5 -8
  107. package/ios/include/SMManager+UserNotification.h +47 -35
  108. package/ios/include/SMManager+ViewController.h +45 -0
  109. package/ios/include/SMManager.h +15 -24
  110. package/ios/include/SMManagerInAppMessageDelegate.h +24 -0
  111. package/ios/include/SMManagerSetting+Location.h +27 -0
  112. package/ios/include/SMManagerSetting.h +61 -33
  113. package/ios/include/SMManagerSettingIAC.h +6 -17
  114. package/ios/include/SMManagerSettingIAM.h +7 -16
  115. package/ios/include/SMManagerUniversalLinksDelegate.h +23 -0
  116. package/ios/include/SMMessage.h +1 -3
  117. package/ios/include/SMNSNotification.h +21 -13
  118. package/ios/include/SMNotificationAnnotationData.h +4 -8
  119. package/ios/include/SMNotificationButtonData.h +1 -6
  120. package/ios/include/SMNotificationButtonType.h +1 -14
  121. package/ios/include/SMNotificationMessage.h +31 -0
  122. package/ios/include/SMRemoteMessageDisplayType.h +32 -0
  123. package/ios/include/SMSuccess.h +1 -4
  124. package/ios/{libSelligentMobile2.5.2.a → libSelligentMobile.a} +0 -0
  125. package/package.json +3 -3
  126. package/trigger.yml +9 -0
  127. package/ios/include/SMLocationAuthorisationType.h +0 -57
@@ -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
@@ -0,0 +1,43 @@
1
+ com/selligent/EventReceiver.java
2
+ com.selligent.EventReceiver
3
+ com/selligent/RemoteMessageDisplayType.java
4
+ com.selligent.RemoteMessageDisplayType
5
+ com/selligent/SMEventFactory.java
6
+ com.selligent.SMEventFactory
7
+ com.selligent.SMEventFactory$1
8
+ com/selligent/BroadcastEventType.java
9
+ com.selligent.BroadcastEventType
10
+ com/selligent/RNSelligentPackage.java
11
+ com.selligent.RNSelligentPackage
12
+ com/selligent/ButtonBroadcastEventDataParser.java
13
+ com.selligent.ButtonBroadcastEventDataParser
14
+ com/selligent/GCMTokenBroadcastEventDataParser.java
15
+ com.selligent.GCMTokenBroadcastEventDataParser
16
+ com/selligent/InAppMessageRefreshType.java
17
+ com.selligent.InAppMessageRefreshType
18
+ com/selligent/EventType.java
19
+ com.selligent.EventType
20
+ com/selligent/RNSelligent.java
21
+ com.selligent.RNSelligent
22
+ com.selligent.RNSelligent$1
23
+ com.selligent.RNSelligent$2
24
+ com.selligent.RNSelligent$3
25
+ com.selligent.RNSelligent$4
26
+ com.selligent.RNSelligent$5
27
+ com/selligent/BuildConfig.java
28
+ com.selligent.BuildConfig
29
+ com/selligent/InAppMessageBroadcastEventDataParser.java
30
+ com.selligent.InAppMessageBroadcastEventDataParser
31
+ com/selligent/Event.java
32
+ com.selligent.Event
33
+ com/selligent/BroadcastEventDataParser.java
34
+ com.selligent.BroadcastEventDataParser
35
+ com/selligent/ClearCacheIntervalValue.java
36
+ com.selligent.ClearCacheIntervalValue
37
+ com/selligent/SMSettingsFactory.java
38
+ com.selligent.SMSettingsFactory
39
+ com/selligent/BroadcastDataFactory.java
40
+ com.selligent.BroadcastDataFactory
41
+ com.selligent.BroadcastDataFactory$1
42
+ com/selligent/Settings.java
43
+ com.selligent.Settings
@@ -1,25 +1,25 @@
1
-
2
1
  buildscript {
3
2
  repositories {
4
- jcenter()
5
3
  google()
4
+ mavenCentral()
6
5
  }
7
6
 
8
7
  dependencies {
9
- classpath 'com.android.tools.build:gradle:3.5.3'
8
+ classpath 'com.android.tools.build:gradle:4.2.2'
10
9
  }
11
10
  }
12
11
 
13
12
  apply plugin: 'com.android.library'
14
- apply plugin: 'maven'
13
+ apply plugin: 'maven-publish'
15
14
 
16
15
  android {
17
- compileSdkVersion 27
18
- buildToolsVersion "29.0.2"
16
+ compileSdkVersion 30
17
+ buildToolsVersion "30.0.2"
19
18
 
20
19
  defaultConfig {
21
- minSdkVersion 16
22
- targetSdkVersion 27
20
+ minSdkVersion 21
21
+ targetSdkVersion 30
22
+ ndkVersion = "21.4.7075529"
23
23
  versionCode 1
24
24
  versionName "1.0"
25
25
  }
@@ -27,17 +27,19 @@ android {
27
27
  lintOptions {
28
28
  abortOnError false
29
29
  }
30
+ }
30
31
 
31
- onVariantProperties { variant ->
32
- def selligentSettings = loadSelligentSettings()
32
+ androidComponents {
33
+ onVariants(selector(), { variant ->
34
+ def selligentSettings = loadSelligentSettings(variant)
33
35
  if (selligentSettings != null) {
34
36
  try {
35
37
  variant.addBuildConfigField("SELLIGENT_SETTINGS", "\"" + selligentSettings + "\"", "Selligent settings")
36
38
  } catch (MissingMethodException ignored) {
37
- throw new Exception("Selligent requires Android Gradle plugin version 4.1.0 or higher.")
39
+ throw new Exception("Selligent requires Android Gradle plugin version 4.2.0 or higher.")
38
40
  }
39
41
  }
40
- }
42
+ })
41
43
  }
42
44
 
43
45
  repositories {
@@ -48,13 +50,12 @@ repositories {
48
50
  }
49
51
 
50
52
  dependencies {
51
- implementation(name:'sdk-release', ext:'aar')
53
+ implementation(name: 'sdk-release', ext: 'aar')
52
54
 
53
55
  implementation 'com.facebook.react:react-native:+'
54
56
  implementation 'com.android.support:cardview-v7:27.1.1'
55
57
  implementation 'com.plotprojects:plot-android:3.13.1'
56
58
  implementation 'com.google.code.gson:gson:2.8.5'
57
- implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
58
59
  implementation 'com.google.firebase:firebase-messaging:21.0.0'
59
60
  implementation 'androidx.work:work-runtime:2.4.0'
60
61
  implementation 'androidx.concurrent:concurrent-futures:1.1.0'
@@ -92,7 +93,7 @@ afterEvaluate { project ->
92
93
  }
93
94
 
94
95
  task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
95
- classifier = 'javadoc'
96
+ archiveClassifier = 'javadoc'
96
97
  from androidJavadoc.destinationDir
97
98
  }
98
99
 
@@ -109,31 +110,36 @@ afterEvaluate { project ->
109
110
  }
110
111
  }
111
112
 
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
113
+ publishing {
114
+ publications {
115
+ maven(MavenPublication) {
116
+ artifact androidSourcesJar
117
+ artifact androidJavadocJar
118
+ }
123
119
  }
124
120
  }
125
121
  }
126
122
 
127
- def loadSelligentSettings() {
128
- def selligentFileName = "selligent.json"
129
- println("Reading Selligent settings from: $selligentFileName")
123
+ def loadSelligentSettings(variant) {
124
+ println(variant.flavorName)
125
+
126
+ def defaultSelligentFileName = "selligent.json"
127
+ File defaultFile = new File("$project.rootDir/../$defaultSelligentFileName")
130
128
 
131
- File f = new File("$project.rootDir/../$selligentFileName");
129
+ def variantSelligentFileName = "selligent.${variant.getName()}.json"
130
+ File variantFile = new File("$project.rootDir/../$variantSelligentFileName");
132
131
 
133
132
  def resultingSettings = null
134
- if (f.exists()) {
133
+ if (variantFile.exists()) {
134
+ println("Reading Selligent properties for variant ${variant.getName()} using $variantSelligentFileName")
135
+ resultingSettings = ""
136
+ variantFile.eachLine { String line ->
137
+ resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
138
+ }
139
+ } else if (defaultFile.exists()) {
140
+ println("Reading Selligent properties from default $defaultSelligentFileName (no variant specific $variantSelligentFileName was found)")
135
141
  resultingSettings = ""
136
- f.eachLine { String line ->
142
+ defaultFile.eachLine { String line ->
137
143
  resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
138
144
  }
139
145
  } else {
Binary file
@@ -7,6 +7,8 @@ import android.content.Intent;
7
7
  import android.content.IntentFilter;
8
8
  import android.content.res.Resources;
9
9
  import androidx.localbroadcastmanager.content.LocalBroadcastManager;
10
+
11
+ import android.graphics.Color;
10
12
  import android.util.Log;
11
13
 
12
14
  import com.facebook.react.bridge.ActivityEventListener;
@@ -72,7 +74,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
72
74
  final SMSettings smSettings = SMSettingsFactory.getSMSettings(settings);
73
75
  final String notificationActivityName = settings.getActivityName();
74
76
 
75
- SMManager.NOTIFICATION_ACTIVITY = Class.forName(notificationActivityName);
77
+ SMManager.NOTIFICATION_ACTIVITY = (Class<? extends Activity>) Class.forName(notificationActivityName);
76
78
 
77
79
  final SMManager smManager = SMManager.getInstance();
78
80
  smManager.start(smSettings, application);
@@ -93,6 +95,15 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
93
95
  }
94
96
  }
95
97
 
98
+ if (settings.getNotificationIconColor() != null && !settings.getNotificationIconColor().isEmpty()) {
99
+ try {
100
+ final int color = Color.parseColor(settings.getNotificationIconColor());
101
+ smManager.setNotificationIconColor(color);
102
+ } catch (IllegalArgumentException e) {
103
+ Log.e("RNSelligent", "notificationIconColor must be a color hex string.");
104
+ }
105
+ }
106
+
96
107
  } catch (ClassNotFoundException e) {
97
108
  Log.e("RNSelligent", "SMManager start failed: an error occurred while setting the NotificationActivity", e);
98
109
  }
@@ -163,6 +174,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
163
174
  messageMap.putDouble("expirationDate", message.getExpirationDate());
164
175
  messageMap.putDouble("receptionDate", message.getReceptionDate());
165
176
  messageMap.putBoolean("hasBeenSeen", message.hasBeenSeen());
177
+ messageMap.putDouble("type", message.getType().getValue());
166
178
 
167
179
  WritableArray buttonsArray = new WritableNativeArray();
168
180
 
@@ -270,6 +282,12 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
270
282
  smManager.sendSMEvent(smEvent);
271
283
  }
272
284
 
285
+ @ReactMethod
286
+ public void getDeviceId(Callback successCallback) {
287
+ final String deviceId = smManager.getDeviceId();
288
+ successCallback.invoke(deviceId);
289
+ }
290
+
273
291
  @ReactMethod
274
292
  public void enableNotifications(Boolean enable) {
275
293
  if (enable) {
@@ -328,6 +346,27 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
328
346
  return resourceId;
329
347
  }
330
348
 
349
+ @ReactMethod
350
+ public void setNotificationIconColor(final String colorString, final Callback successCallback, final Callback errorCallback) {
351
+ try {
352
+ final int color = Color.parseColor(colorString);
353
+ smManager.setNotificationIconColor(color);
354
+ successCallback.invoke();
355
+ } catch (IllegalArgumentException e) {
356
+ errorCallback.invoke("color must be a color hex string.");
357
+ }
358
+ }
359
+
360
+ @ReactMethod
361
+ public void setNotificationActivity(final String activityName, final Callback successCallback, final Callback errorCallback) {
362
+ try {
363
+ SMManager.NOTIFICATION_ACTIVITY = (Class<? extends Activity>) Class.forName(activityName);
364
+ successCallback.invoke();
365
+ } catch (ClassNotFoundException e) {
366
+ errorCallback.invoke(String.format("Activity %s not found.", activityName));
367
+ }
368
+ }
369
+
331
370
  @ReactMethod
332
371
  public void getGCMToken(Callback callback) {
333
372
  final String gcmToken = smManager.getGCMToken();
@@ -395,8 +434,6 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
395
434
  }
396
435
  currentActivity.registerReceiver(receiver, receiver.getIntentFilter());
397
436
 
398
- smManager.registerDevice(currentActivity);
399
-
400
437
  smManager.checkAndDisplayMessage(currentActivity.getIntent(), currentActivity);
401
438
  }
402
439
  }
@@ -418,6 +455,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
418
455
  final Activity currentActivity = getCurrentActivity();
419
456
 
420
457
  if (currentActivity != null) {
458
+ currentActivity.setIntent(intent);
421
459
  smManager.checkAndDisplayMessage(intent, currentActivity);
422
460
  }
423
461
  }
@@ -11,6 +11,7 @@ class SMSettingsFactory {
11
11
  smSettings.PrivateKey = settings.getPrivateKey();
12
12
  smSettings.GoogleApplicationId = settings.getGoogleApplicationId();
13
13
  smSettings.ConfigureGeolocation = settings.getConfigureLocationServices();
14
+ smSettings.AddInAppMessageFromPushToInAppMessageList = settings.getAddInAppMessageFromPushToInAppMessageList();
14
15
  smSettings.DoNotFetchTheToken = settings.getDoNotFetchTheToken();
15
16
  smSettings.DoNotListenToThePush = settings.getDoNotListenToThePush();
16
17
  smSettings.LoadCacheAsynchronously = settings.getLoadCacheAsynchronously();
@@ -12,6 +12,8 @@ class Settings {
12
12
  private String activityName;
13
13
  private String notificationSmallIcon;
14
14
  private String notificationLargeIcon;
15
+ private String notificationIconColor;
16
+ private boolean addInAppMessageFromPushToInAppMessageList = false;
15
17
  private Boolean doNotFetchTheToken = false;
16
18
  private Boolean doNotListenToThePush = false;
17
19
  private Boolean loadCacheAsynchronously = false;
@@ -50,12 +52,18 @@ class Settings {
50
52
  return notificationLargeIcon;
51
53
  }
52
54
 
55
+ public String getNotificationIconColor() {
56
+ return notificationIconColor;
57
+ }
58
+
53
59
  public Boolean getConfigureLocationServices() {
54
60
  return configureLocationServices;
55
61
  }
56
62
 
57
63
  public Boolean getDoNotListenToThePush() { return doNotListenToThePush; }
58
64
 
65
+ public Boolean getAddInAppMessageFromPushToInAppMessageList() { return addInAppMessageFromPushToInAppMessageList; }
66
+
59
67
  public Boolean getDoNotFetchTheToken() { return doNotFetchTheToken; }
60
68
 
61
69
  public Boolean getLoadCacheAsynchronously() { return loadCacheAsynchronously; }
@@ -95,6 +103,14 @@ class Settings {
95
103
  settings.notificationLargeIcon = (String) settingsHashMap.get("notificationLargeIcon");
96
104
  }
97
105
 
106
+ if(settingsHashMap.containsKey("notificationIconColor")) {
107
+ settings.notificationIconColor = (String) settingsHashMap.get("notificationIconColor");
108
+ }
109
+
110
+ if (settingsHashMap.containsKey("addInAppMessageFromPushToInAppMessageList")) {
111
+ settings.addInAppMessageFromPushToInAppMessageList = (Boolean) settingsHashMap.get("addInAppMessageFromPushToInAppMessageList");
112
+ }
113
+
98
114
  if (settingsHashMap.containsKey("doNotFetchTheToken")) {
99
115
  settings.doNotFetchTheToken = (Boolean) settingsHashMap.get("doNotFetchTheToken");
100
116
  }
package/constants.d.ts CHANGED
@@ -14,6 +14,23 @@ export namespace InAppMessageRefreshType {
14
14
  const DAY = 13;
15
15
  }
16
16
 
17
+ export namespace InAppMessageType {
18
+ const UNKNOWN: -2;
19
+ const HIDDEN: -1;
20
+ const ALERT: 0;
21
+ const HTML: 1;
22
+ const URL: 2;
23
+ const IMAGE: 3;
24
+ const MAP: 4;
25
+ const PASSBOOK: 5;
26
+ }
27
+
28
+ export namespace RemoteMessagesDisplayType {
29
+ const AUTOMATIC = 20;
30
+ const NONE = 21;
31
+ const NOTIFICATION = 22;
32
+ }
33
+
17
34
  export namespace AndroidRemoteMessagesDisplayType {
18
35
  const AUTOMATIC = 20;
19
36
  const NONE = 21;
@@ -77,6 +94,7 @@ export namespace BroadcastEventType {
77
94
  const WILL_DISPLAY_NOTIFICATION = "WillDisplayNotification";
78
95
  const WILL_DISMISS_NOTIFICATION = "WillDismissNotification";
79
96
  const RECEIVED_GCM_TOKEN = "ReceivedGCMToken";
97
+ const RECEIVED_DEVICE_ID = "ReceivedDeviceId";
80
98
  const RECEIVED_REMOTE_NOTIFICATION = "ReceivedRemoteNotification";
81
99
  }
82
100
 
package/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import {Platform} from 'react-native'
1
+ import { Platform } from 'react-native'
2
2
 
3
3
  /**
4
4
  * @module SelligentConstants
@@ -32,6 +32,32 @@ var SelligentConstants = {
32
32
  /** Refresh in-app messages daily */
33
33
  DAY: 13,
34
34
  },
35
+ /**
36
+ * @description
37
+ * Defines the in-app messages type.
38
+ */
39
+ InAppMessageType: {
40
+ UNKNOWN: -2,
41
+ HIDDEN: -1,
42
+ ALERT: 0,
43
+ HTML: 1,
44
+ URL: 2,
45
+ IMAGE: 3,
46
+ MAP: 4,
47
+ PASSBOOK: 5,
48
+ },
49
+ /**
50
+ * @description
51
+ * Defines if and how remote messages can be displayed.
52
+ */
53
+ RemoteMessagesDisplayType: {
54
+ /** Display remote messages automatically */
55
+ AUTOMATIC: 20,
56
+ /** Don't display remote messages */
57
+ NONE: 21,
58
+ /** Display remote messages as notification */
59
+ NOTIFICATION: 22
60
+ },
35
61
  /**
36
62
  * @description
37
63
  * Defines if and how remote messages can be displayed on Android.
@@ -80,7 +106,7 @@ var SelligentConstants = {
80
106
  * @description
81
107
  * Description of the possible status of use of location services on a device.
82
108
  */
83
- iOSLocationAuthorisationStatus: {
109
+ iOSLocationAuthorisationStatus: {
84
110
  /** Status of use of location services is unknown */
85
111
  UNKNOWN: 70,
86
112
  /** Use of location services is refused */
@@ -159,6 +185,8 @@ var SelligentConstants = {
159
185
  WILL_DISPLAY_NOTIFICATION: "WillDisplayNotification",
160
186
  /** A notification will be dismissed */
161
187
  WILL_DISMISS_NOTIFICATION: "WillDismissNotification",
188
+ /** A device id has been received */
189
+ RECEIVED_DEVICE_ID: "ReceivedDeviceId"
162
190
  },
163
191
  /**
164
192
  * @description
package/index.android.js CHANGED
@@ -124,6 +124,48 @@ export default {
124
124
  return
125
125
  },
126
126
 
127
+ /**
128
+ * Set the color for the icon for notifications on Android.
129
+ *
130
+ * @param {function} successCallback Callback function on success.
131
+ * @param {function} errorCallback Callback function on error.
132
+ * @param {string} color The color for the notification.
133
+ */
134
+ setNotificationIconColor: function (successCallback, errorCallback, color) {
135
+ if (!SelligentHelpers.typeMatches(color, 'string') || color.length === 0) {
136
+ errorCallback(SelligentHelpers.wrongArgumentError('Expected a string (not empty).'))
137
+ return
138
+ }
139
+
140
+ const _successCallback = () => {
141
+ successCallback(SelligentHelpers.SUCCESS)
142
+ }
143
+
144
+ RNSelligent.setNotificationIconColor(color, _successCallback, errorCallback)
145
+ return
146
+ },
147
+
148
+ /**
149
+ * Set the notification activity on Android.
150
+ *
151
+ * @param {function} successCallback Callback function on success.
152
+ * @param {function} errorCallback Callback function on error.
153
+ * @param {string} activityName The name of the activity.
154
+ */
155
+ setNotificationActivity: function (successCallback, errorCallback, activityName) {
156
+ if (!SelligentHelpers.typeMatches(activityName, 'string') || activityName.length === 0) {
157
+ errorCallback(SelligentHelpers.wrongArgumentError('Expected a string (not empty).'))
158
+ return
159
+ }
160
+
161
+ const _successCallback = () => {
162
+ successCallback(SelligentHelpers.SUCCESS)
163
+ }
164
+
165
+ RNSelligent.setNotificationActivity(activityName, _successCallback, errorCallback)
166
+ return
167
+ },
168
+
127
169
  /**
128
170
  * Get GCM Token
129
171
  *
package/index.d.ts CHANGED
@@ -22,11 +22,15 @@ export function sendEvent(
22
22
  errorCallback: Function,
23
23
  event: any
24
24
  ): void;
25
+ export function getDeviceId(successCallback: Function): void;
25
26
  export function enableNotifications(
26
27
  successCallback: Function,
27
28
  errorCallback: Function,
28
29
  enabled: boolean
29
30
  ): void;
31
+ export function registerForProvisionalRemoteNotification(
32
+ successCallback: Function
33
+ ): void;
30
34
  export function displayLastReceivedRemotePushNotification(
31
35
  successCallback: Function
32
36
  ): void;
@@ -43,12 +47,6 @@ export function enableiOSLogging(
43
47
  errorCallback: Function,
44
48
  logLevels: any[]
45
49
  ): void;
46
- export function currentAuthorisationStatus(successCallback: Function): void;
47
- export function requestLocationAuthorisation(
48
- successCallback: Function,
49
- errorCallback: Function,
50
- iOSLocationAuthorisationType: any
51
- ): void;
52
50
  export function displayNotification(
53
51
  successCallback: Function,
54
52
  errorCallback: Function,
@@ -97,6 +95,16 @@ export function setNotificationLargeIcon(
97
95
  errorCallback: Function,
98
96
  iconName: string
99
97
  ): void;
98
+ export function setNotificationIconColor(
99
+ successCallback: Function,
100
+ errorCallback: Function,
101
+ color: string
102
+ ): void;
103
+ export function setNotificationActivity(
104
+ successCallback: Function,
105
+ errorCallback: Function,
106
+ activityName: string
107
+ ): void;
100
108
  export function getGCMToken(successCallback: Function): void;
101
109
  export function getRemoteMessagesDisplayType(successCallback: Function): void;
102
110
  export function subscribeToEvents(
package/index.ios.js CHANGED
@@ -62,35 +62,6 @@ export default {
62
62
  RNSelligent.applyLogLevel(logLevels)
63
63
  return
64
64
  },
65
- // Location
66
-
67
- /**
68
- * Get Current AuthorisationStatus.
69
- *
70
- * @param {function} successCallback Callback passing iOSLocationAuthorisationStatus.
71
- */
72
- currentAuthorisationStatus: function (successCallback) {
73
- RNSelligent.currentAuthorisationStatus(successCallback)
74
- return
75
- },
76
-
77
- /**
78
- * Request Location Authorisation.
79
- *
80
- * @param {function} successCallback Callback function on success.
81
- * @param {function} errorCallback Callback function on error.
82
- * @param {iOSLocationAuthorisationType} iOSLocationAuthorisationType Requested authorisation type.
83
- */
84
- requestLocationAuthorisation: function (successCallback, errorCallback, iOSLocationAuthorisationType) {
85
- if (!SelligentHelpers.constantIsValid(SelligentConstants.iOSLocationAuthorisationType, iOSLocationAuthorisationType)) {
86
- errorCallback(SelligentHelpers.createTypeErrorMessage('iOSLocationAuthorisationType', iOSLocationAuthorisationType, 'number'))
87
- return
88
- }
89
-
90
- successCallback(SelligentHelpers.SUCCESS)
91
- RNSelligent.requestLocationAuthorisation(iOSLocationAuthorisationType)
92
- return
93
- },
94
65
  // Remote Notification
95
66
 
96
67
  /**
@@ -140,6 +111,18 @@ export default {
140
111
  RNSelligent.forceRemoteNotificationBackgroundFetchResult(iOSBackgroundFetchResult)
141
112
  return
142
113
  },
114
+
115
+ /**
116
+ * Register for Provisional Push Notifications.
117
+ *
118
+ * @param {function} successCallback Callback function on success.
119
+ */
120
+ registerForProvisionalRemoteNotification: function (successCallback) {
121
+ successCallback(SelligentHelpers.SUCCESS)
122
+ RNSelligent.registerForProvisionalRemoteNotification()
123
+ return
124
+ },
125
+
143
126
  // Broadcasts Events
144
127
 
145
128
  /**
package/index.js CHANGED
@@ -107,7 +107,7 @@ export default Object.assign(
107
107
  * @param {function} errorCallback Callback function on error.
108
108
  * @param {boolean} enabled Boolean to enable or disable geolocation.
109
109
  */
110
- enableGeolocation: function (successCallback, errorCallback, enabled) {
110
+ enableGeolocation: function (successCallback, errorCallback, enabled) {
111
111
  // check if required options are valid
112
112
  if (!SelligentHelpers.typeMatches(enabled, 'boolean')) {
113
113
  errorCallback(SelligentHelpers.wrongArgumentError('Expected a boolean.'))
@@ -129,6 +129,7 @@ export default Object.assign(
129
129
  RNSelligent.isGeolocationEnabled(successCallback)
130
130
  return
131
131
  },
132
+
132
133
  // Event
133
134
 
134
135
  /**
@@ -174,6 +175,17 @@ export default Object.assign(
174
175
  RNSelligent.sendEvent(event, successCallback, errorCallback)
175
176
  return
176
177
  },
178
+ // Device Id
179
+ /**
180
+ * Returns the device id.
181
+ *
182
+ * @param {function} successCallback Callback function on success.
183
+ */
184
+ getDeviceId: function (successCallback) {
185
+ RNSelligent.getDeviceId(successCallback)
186
+ return
187
+ },
188
+
177
189
  // Remote Notifications
178
190
 
179
191
  /**
@@ -8,10 +8,12 @@
8
8
  @property (nonatomic, strong, readonly) NSString *clientId;
9
9
  @property (nonatomic, strong, readonly) NSString *privateKey;
10
10
  @property (nonatomic, strong, readonly) NSString *appGroupId;
11
+ @property (nonatomic, strong, readonly) NSNumber *shouldAddInAppMessageFromPushToInAppMessageList;
11
12
  @property (nonatomic, strong, readonly) NSNumber *shouldClearBadge;
12
13
  @property (nonatomic, strong, readonly) NSNumber *shouldDisplayRemoteNotification;
13
14
  @property (nonatomic, strong, readonly) NSNumber *configureLocationServices;
14
15
  @property (nonatomic, strong, readonly) NSNumber *clearCacheIntervalValue;
16
+ @property (nonatomic, strong, readonly) NSNumber *remoteMessageDisplayType;
15
17
  @property (nonatomic, strong, readonly) InAppMessageSettings *inAppMessageSettings;
16
18
 
17
19
  @end
@@ -8,10 +8,12 @@
8
8
  @property (nonatomic, strong) NSString *clientId;
9
9
  @property (nonatomic, strong) NSString *privateKey;
10
10
  @property (nonatomic, strong) NSString *appGroupId;
11
+ @property (nonatomic, strong) NSNumber *shouldAddInAppMessageFromPushToInAppMessageList;
11
12
  @property (nonatomic, strong) NSNumber *shouldClearBadge;
12
13
  @property (nonatomic, strong) NSNumber *shouldDisplayRemoteNotification;
13
14
  @property (nonatomic, strong) NSNumber *configureLocationServices;
14
15
  @property (nonatomic, strong) NSNumber *clearCacheIntervalValue;
16
+ @property (nonatomic, strong) NSNumber *remoteMessageDisplayType;
15
17
  @property (nonatomic, strong) InAppMessageSettings *inAppMessageSettings;
16
18
 
17
19
  @end
@@ -24,10 +26,12 @@
24
26
  clientSettings.clientId = dictionary[@"clientId"];
25
27
  clientSettings.privateKey = dictionary[@"privateKey"];
26
28
  clientSettings.appGroupId = dictionary[@"appGroupId"];
29
+ clientSettings.shouldAddInAppMessageFromPushToInAppMessageList = dictionary[@"addInAppMessageFromPushToInAppMessageList"];
27
30
  clientSettings.shouldClearBadge = dictionary[@"shouldClearBadge"];
28
31
  clientSettings.shouldDisplayRemoteNotification = dictionary[@"shouldDisplayRemoteNotification"];
29
32
  clientSettings.configureLocationServices = dictionary[@"configureLocationServices"];
30
33
  clientSettings.clearCacheIntervalValue = dictionary[@"clearCacheIntervalValue"];
34
+ clientSettings.remoteMessageDisplayType = dictionary[@"remoteMessageDisplayType"];
31
35
  clientSettings.inAppMessageSettings = [InAppMessageSettings fromDictionary:dictionary];
32
36
  return clientSettings;
33
37
  }