@selligent-marketing-cloud/selligent-react-native 2.3.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +311 -315
  2. package/RNSelligent.podspec +3 -4
  3. package/android/build.gradle +39 -31
  4. package/android/libs/sdk-release.aar +0 -0
  5. package/android/src/main/java/com/selligent/RNSelligent.java +41 -18
  6. package/android/src/main/java/com/selligent/SMSettingsFactory.java +1 -1
  7. package/android/src/main/java/com/selligent/Settings.java +14 -7
  8. package/constants.d.ts +18 -12
  9. package/constants.js +29 -25
  10. package/index.android.js +42 -0
  11. package/index.d.ts +14 -12
  12. package/index.ios.js +12 -29
  13. package/index.js +11 -31
  14. package/ios/ClientSettings.h +2 -1
  15. package/ios/ClientSettings.m +4 -2
  16. package/ios/EnumMapper.h +3 -8
  17. package/ios/EnumMapper.m +8 -26
  18. package/ios/RNSelligent.m +25 -27
  19. package/ios/RemoteMessageDisplayType.h +5 -0
  20. package/ios/SMManagerSetting+ClientSettings.m +10 -4
  21. package/ios/SelligentReactNative.xcodeproj/project.pbxproj +4 -12
  22. package/ios/include/SMBaseMessage.h +8 -12
  23. package/ios/include/SMBlock.h +2 -2
  24. package/ios/include/SMClearCache.h +0 -2
  25. package/ios/include/SMContentAlignment.h +1 -2
  26. package/ios/include/SMDeviceInfos.h +10 -8
  27. package/ios/include/SMDisplayMode.h +1 -2
  28. package/ios/include/SMEvent.h +20 -16
  29. package/ios/include/SMEventUser.h +0 -1
  30. package/ios/include/SMEventUserLogin.h +11 -16
  31. package/ios/include/SMEventUserLogout.h +12 -16
  32. package/ios/include/SMEventUserRegistration.h +12 -17
  33. package/ios/include/SMEventUserUnregistration.h +12 -16
  34. package/ios/include/SMFailure.h +1 -6
  35. package/ios/include/SMHelper.h +7 -2
  36. package/ios/include/SMInAppContentHTMLViewController.h +11 -9
  37. package/ios/include/SMInAppContentImageViewController.h +6 -6
  38. package/ios/include/SMInAppContentMessage.h +12 -12
  39. package/ios/include/SMInAppContentStyleOptions.h +91 -79
  40. package/ios/include/SMInAppContentType.h +2 -3
  41. package/ios/include/SMInAppContentURLViewController.h +10 -9
  42. package/ios/include/SMInAppContentViewController.h +3 -6
  43. package/ios/include/SMInAppMessage.h +22 -14
  44. package/ios/include/SMInAppMessageType.h +2 -6
  45. package/ios/include/SMInAppRefreshType.h +1 -1
  46. package/ios/include/SMLink.h +7 -11
  47. package/ios/include/SMLog.h +1 -1
  48. package/ios/include/SMManager+DataTransaction.h +6 -13
  49. package/ios/include/SMManager+InAppContent.h +20 -23
  50. package/ios/include/SMManager+InAppMessage.h +65 -42
  51. package/ios/include/SMManager+Log.h +3 -14
  52. package/ios/include/SMManager+RemoteNotification.h +38 -34
  53. package/ios/include/SMManager+SMEvent.h +10 -10
  54. package/ios/include/SMManager+SMLink.h +44 -0
  55. package/ios/include/SMManager+SilentPush.h +5 -22
  56. package/ios/include/SMManager+StyleOptions.h +5 -8
  57. package/ios/include/SMManager+UserNotification.h +45 -33
  58. package/ios/include/SMManager+ViewController.h +45 -0
  59. package/ios/include/SMManager.h +14 -23
  60. package/ios/include/SMManagerInAppMessageDelegate.h +24 -0
  61. package/ios/include/SMManagerSetting.h +61 -33
  62. package/ios/include/SMManagerSettingIAC.h +6 -17
  63. package/ios/include/SMManagerSettingIAM.h +7 -16
  64. package/ios/include/SMManagerUniversalLinksDelegate.h +23 -0
  65. package/ios/include/SMMessage.h +1 -3
  66. package/ios/include/SMNSNotification.h +19 -5
  67. package/ios/include/SMNotificationAnnotationData.h +4 -8
  68. package/ios/include/SMNotificationButtonData.h +1 -6
  69. package/ios/include/SMNotificationButtonType.h +1 -14
  70. package/ios/include/SMNotificationMessage.h +31 -0
  71. package/ios/include/SMRemoteMessageDisplayType.h +32 -0
  72. package/ios/include/SMSuccess.h +1 -4
  73. package/ios/{libSelligentMobile2.5.2.a → libSelligentMobile.a} +0 -0
  74. package/package.json +3 -3
  75. package/trigger.yml +9 -0
  76. package/ios/LocationAuthorisationStatus.h +0 -6
  77. package/ios/LocationAuthorisationType.h +0 -4
  78. package/ios/include/SMLocationAuthorisationType.h +0 -57
  79. package/ios/include/SMManager+Location.h +0 -97
@@ -12,17 +12,16 @@ Pod::Spec.new do |s|
12
12
  DESC
13
13
  s.homepage = "https://github.com/SelligentMarketingCloud/MobileSDK-ReactNative"
14
14
  s.license = "MIT"
15
- s.platform = :ios, "7.0"
15
+ s.platform = :ios, "11.0"
16
16
  s.source = { :git => "https://github.com/SelligentMarketingCloud/MobileSDK-ReactNative.git", :tag => "#{s.version}" }
17
17
 
18
18
  s.source_files = "ios/**/*.{h,m}"
19
19
  s.requires_arc = true
20
20
 
21
- s.vendored_libraries = "ios/libSelligentMobile2.5.2.a"
22
- s.libraries = "SelligentMobile2.5.2"
21
+ s.vendored_libraries = "ios/libSelligentMobile.a"
22
+ s.libraries = "SelligentMobile"
23
23
 
24
24
  s.dependency "React"
25
- s.dependency 'PlotPlugin'
26
25
  end
27
26
 
28
27
 
@@ -1,12 +1,11 @@
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
 
@@ -14,20 +13,35 @@ apply plugin: 'com.android.library'
14
13
  apply plugin: 'maven'
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
  }
26
+
26
27
  lintOptions {
27
28
  abortOnError false
28
29
  }
29
30
  }
30
31
 
32
+ androidComponents {
33
+ onVariants(selector(), { variant ->
34
+ def selligentSettings = loadSelligentSettings(variant)
35
+ if (selligentSettings != null) {
36
+ try {
37
+ variant.addBuildConfigField("SELLIGENT_SETTINGS", "\"" + selligentSettings + "\"", "Selligent settings")
38
+ } catch (MissingMethodException ignored) {
39
+ throw new Exception("Selligent requires Android Gradle plugin version 4.2.0 or higher.")
40
+ }
41
+ }
42
+ })
43
+ }
44
+
31
45
  repositories {
32
46
  maven {
33
47
  url "$projectDir/../node_modules/react-native/android"
@@ -36,13 +50,11 @@ repositories {
36
50
  }
37
51
 
38
52
  dependencies {
39
- implementation(name:'sdk-release', ext:'aar')
53
+ implementation(name: 'sdk-release', ext: 'aar')
40
54
 
41
55
  implementation 'com.facebook.react:react-native:+'
42
56
  implementation 'com.android.support:cardview-v7:27.1.1'
43
- implementation 'com.plotprojects:plot-android:3.13.1'
44
57
  implementation 'com.google.code.gson:gson:2.8.5'
45
- implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
46
58
  implementation 'com.google.firebase:firebase-messaging:21.0.0'
47
59
  implementation 'androidx.work:work-runtime:2.4.0'
48
60
  implementation 'androidx.concurrent:concurrent-futures:1.1.0'
@@ -112,16 +124,26 @@ afterEvaluate { project ->
112
124
  }
113
125
  }
114
126
 
115
- def loadSelligentSettings() {
116
- def selligentFileName = "selligent.json"
117
- println("Reading Selligent settings from: $selligentFileName")
127
+ def loadSelligentSettings(variant) {
128
+ println(variant.flavorName)
129
+
130
+ def defaultSelligentFileName = "selligent.json"
131
+ File defaultFile = new File("$project.rootDir/../$defaultSelligentFileName")
118
132
 
119
- File f = new File("$project.rootDir/../$selligentFileName");
133
+ def variantSelligentFileName = "selligent.${variant.getName()}.json"
134
+ File variantFile = new File("$project.rootDir/../$variantSelligentFileName");
120
135
 
121
136
  def resultingSettings = null
122
- if (f.exists()) {
137
+ if (variantFile.exists()) {
138
+ println("Reading Selligent properties for variant ${variant.getName()} using $variantSelligentFileName")
123
139
  resultingSettings = ""
124
- f.eachLine { String line ->
140
+ variantFile.eachLine { String line ->
141
+ resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
142
+ }
143
+ } else if (defaultFile.exists()) {
144
+ println("Reading Selligent properties from default $defaultSelligentFileName (no variant specific $variantSelligentFileName was found)")
145
+ resultingSettings = ""
146
+ defaultFile.eachLine { String line ->
125
147
  resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
126
148
  }
127
149
  } else {
@@ -129,18 +151,4 @@ def loadSelligentSettings() {
129
151
  }
130
152
 
131
153
  return resultingSettings
132
- }
133
-
134
- tasks.whenTaskAdded { task ->
135
- task.doFirst() {
136
- android.libraryVariants.all { variant ->
137
- if (task.name.toLowerCase() == "pre${variant.name}build") {
138
- def selligentSettings = loadSelligentSettings()
139
- if (selligentSettings != null) {
140
- variant.buildConfigField "String", "SELLIGENT_SETTINGS", "\"$selligentSettings\""
141
- }
142
- }
143
-
144
- }
145
- }
146
- }
154
+ }
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
 
@@ -237,21 +249,6 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
237
249
  SMManager.DEBUG = enable;
238
250
  }
239
251
 
240
- @ReactMethod
241
- public void enableGeolocation(Boolean enable) {
242
- if (enable) {
243
- smManager.enableGeolocation();
244
- } else {
245
- smManager.disableGeolocation();
246
- }
247
- }
248
-
249
- @ReactMethod
250
- public void isGeolocationEnabled(Callback successCallback) {
251
- final Boolean isGeolocationEnabled = smManager.isGeolocationEnabled();
252
- successCallback.invoke(isGeolocationEnabled);
253
- }
254
-
255
252
  @ReactMethod
256
253
  public void sendEvent(ReadableMap eventMap, final Callback successCallback, final Callback errorCallback) {
257
254
  final Event event = Event.fromHashMap(eventMap.toHashMap());
@@ -270,6 +267,12 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
270
267
  smManager.sendSMEvent(smEvent);
271
268
  }
272
269
 
270
+ @ReactMethod
271
+ public void getDeviceId(Callback successCallback) {
272
+ final String deviceId = smManager.getDeviceId();
273
+ successCallback.invoke(deviceId);
274
+ }
275
+
273
276
  @ReactMethod
274
277
  public void enableNotifications(Boolean enable) {
275
278
  if (enable) {
@@ -328,6 +331,27 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
328
331
  return resourceId;
329
332
  }
330
333
 
334
+ @ReactMethod
335
+ public void setNotificationIconColor(final String colorString, final Callback successCallback, final Callback errorCallback) {
336
+ try {
337
+ final int color = Color.parseColor(colorString);
338
+ smManager.setNotificationIconColor(color);
339
+ successCallback.invoke();
340
+ } catch (IllegalArgumentException e) {
341
+ errorCallback.invoke("color must be a color hex string.");
342
+ }
343
+ }
344
+
345
+ @ReactMethod
346
+ public void setNotificationActivity(final String activityName, final Callback successCallback, final Callback errorCallback) {
347
+ try {
348
+ SMManager.NOTIFICATION_ACTIVITY = (Class<? extends Activity>) Class.forName(activityName);
349
+ successCallback.invoke();
350
+ } catch (ClassNotFoundException e) {
351
+ errorCallback.invoke(String.format("Activity %s not found.", activityName));
352
+ }
353
+ }
354
+
331
355
  @ReactMethod
332
356
  public void getGCMToken(Callback callback) {
333
357
  final String gcmToken = smManager.getGCMToken();
@@ -395,8 +419,6 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
395
419
  }
396
420
  currentActivity.registerReceiver(receiver, receiver.getIntentFilter());
397
421
 
398
- smManager.registerDevice(currentActivity);
399
-
400
422
  smManager.checkAndDisplayMessage(currentActivity.getIntent(), currentActivity);
401
423
  }
402
424
  }
@@ -418,6 +440,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
418
440
  final Activity currentActivity = getCurrentActivity();
419
441
 
420
442
  if (currentActivity != null) {
443
+ currentActivity.setIntent(intent);
421
444
  smManager.checkAndDisplayMessage(intent, currentActivity);
422
445
  }
423
446
  }
@@ -10,7 +10,7 @@ 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
+ smSettings.AddInAppMessageFromPushToInAppMessageList = settings.getAddInAppMessageFromPushToInAppMessageList();
14
14
  smSettings.DoNotFetchTheToken = settings.getDoNotFetchTheToken();
15
15
  smSettings.DoNotListenToThePush = settings.getDoNotListenToThePush();
16
16
  smSettings.LoadCacheAsynchronously = settings.getLoadCacheAsynchronously();
@@ -12,10 +12,11 @@ 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;
18
- private Boolean configureLocationServices = false;
19
20
  private ClearCacheIntervalValue clearCacheIntervalValue;
20
21
  private InAppMessageRefreshType inAppMessageRefreshType;
21
22
  private RemoteMessageDisplayType remoteMessageDisplayType;
@@ -50,12 +51,14 @@ class Settings {
50
51
  return notificationLargeIcon;
51
52
  }
52
53
 
53
- public Boolean getConfigureLocationServices() {
54
- return configureLocationServices;
54
+ public String getNotificationIconColor() {
55
+ return notificationIconColor;
55
56
  }
56
57
 
57
58
  public Boolean getDoNotListenToThePush() { return doNotListenToThePush; }
58
59
 
60
+ public Boolean getAddInAppMessageFromPushToInAppMessageList() { return addInAppMessageFromPushToInAppMessageList; }
61
+
59
62
  public Boolean getDoNotFetchTheToken() { return doNotFetchTheToken; }
60
63
 
61
64
  public Boolean getLoadCacheAsynchronously() { return loadCacheAsynchronously; }
@@ -81,10 +84,6 @@ class Settings {
81
84
  if (settingsHashMap.containsKey("googleApplicationId")) {
82
85
  settings.googleApplicationId = (String) settingsHashMap.get("googleApplicationId");
83
86
  }
84
- if (settingsHashMap.containsKey("configureLocationServices")) {
85
- settings.configureLocationServices = (Boolean) settingsHashMap.get("configureLocationServices");
86
-
87
- }
88
87
  settings.activityName = (String) settingsHashMap.get("fullyQualifiedNotificationActivityClassName");
89
88
 
90
89
  if (settingsHashMap.containsKey("notificationSmallIcon")) {
@@ -95,6 +94,14 @@ class Settings {
95
94
  settings.notificationLargeIcon = (String) settingsHashMap.get("notificationLargeIcon");
96
95
  }
97
96
 
97
+ if(settingsHashMap.containsKey("notificationIconColor")) {
98
+ settings.notificationIconColor = (String) settingsHashMap.get("notificationIconColor");
99
+ }
100
+
101
+ if (settingsHashMap.containsKey("addInAppMessageFromPushToInAppMessageList")) {
102
+ settings.addInAppMessageFromPushToInAppMessageList = (Boolean) settingsHashMap.get("addInAppMessageFromPushToInAppMessageList");
103
+ }
104
+
98
105
  if (settingsHashMap.containsKey("doNotFetchTheToken")) {
99
106
  settings.doNotFetchTheToken = (Boolean) settingsHashMap.get("doNotFetchTheToken");
100
107
  }
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;
@@ -36,18 +53,6 @@ export namespace iOSBackgroundFetchResult {
36
53
  const FAILED = 62;
37
54
  }
38
55
 
39
- export namespace iOSLocationAuthorisationStatus {
40
- const UNKNOWN = 70;
41
- const REFUSED = 71;
42
- const GRANTED_IN_USE = 72;
43
- const GRANTED_ALWAYS = 73;
44
- }
45
-
46
- export namespace iOSLocationAuthorisationType {
47
- const IN_USE = 80;
48
- const ALWAYS = 81;
49
- }
50
-
51
56
  export namespace EventType {
52
57
  const USER_REGISTER = 90;
53
58
  const USER_UNREGISTER = 91;
@@ -77,6 +82,7 @@ export namespace BroadcastEventType {
77
82
  const WILL_DISPLAY_NOTIFICATION = "WillDisplayNotification";
78
83
  const WILL_DISMISS_NOTIFICATION = "WillDismissNotification";
79
84
  const RECEIVED_GCM_TOKEN = "ReceivedGCMToken";
85
+ const RECEIVED_DEVICE_ID = "ReceivedDeviceId";
80
86
  const RECEIVED_REMOTE_NOTIFICATION = "ReceivedRemoteNotification";
81
87
  }
82
88
 
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.
@@ -76,30 +102,6 @@ var SelligentConstants = {
76
102
  /** Background fetch failed */
77
103
  FAILED: 62
78
104
  },
79
- /**
80
- * @description
81
- * Description of the possible status of use of location services on a device.
82
- */
83
- iOSLocationAuthorisationStatus: {
84
- /** Status of use of location services is unknown */
85
- UNKNOWN: 70,
86
- /** Use of location services is refused */
87
- REFUSED: 71,
88
- /** Use of location services is granted when in use */
89
- GRANTED_IN_USE: 72,
90
- /** Use of location services is always granted */
91
- GRANTED_ALWAYS: 73
92
- },
93
- /**
94
- * @description
95
- * Defines the level of request for the authorisation of usage of location services on a device.
96
- */
97
- iOSLocationAuthorisationType: {
98
- /** Request authorisation when in location services are in use */
99
- IN_USE: 80,
100
- /** Always request the authorisation of the location services */
101
- ALWAYS: 81
102
- },
103
105
  /**
104
106
  * @description
105
107
  * Defines the type of an event.
@@ -159,6 +161,8 @@ var SelligentConstants = {
159
161
  WILL_DISPLAY_NOTIFICATION: "WillDisplayNotification",
160
162
  /** A notification will be dismissed */
161
163
  WILL_DISMISS_NOTIFICATION: "WillDismissNotification",
164
+ /** A device id has been received */
165
+ RECEIVED_DEVICE_ID: "ReceivedDeviceId"
162
166
  },
163
167
  /**
164
168
  * @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
@@ -11,22 +11,20 @@ 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;
20
14
  export function sendEvent(
21
15
  successCallback: Function,
22
16
  errorCallback: Function,
23
17
  event: any
24
18
  ): void;
19
+ export function getDeviceId(successCallback: Function): void;
25
20
  export function enableNotifications(
26
21
  successCallback: Function,
27
22
  errorCallback: Function,
28
23
  enabled: boolean
29
24
  ): void;
25
+ export function registerForProvisionalRemoteNotification(
26
+ successCallback: Function
27
+ ): void;
30
28
  export function displayLastReceivedRemotePushNotification(
31
29
  successCallback: Function
32
30
  ): void;
@@ -43,12 +41,6 @@ export function enableiOSLogging(
43
41
  errorCallback: Function,
44
42
  logLevels: any[]
45
43
  ): void;
46
- export function currentAuthorisationStatus(successCallback: Function): void;
47
- export function requestLocationAuthorisation(
48
- successCallback: Function,
49
- errorCallback: Function,
50
- iOSLocationAuthorisationType: any
51
- ): void;
52
44
  export function displayNotification(
53
45
  successCallback: Function,
54
46
  errorCallback: Function,
@@ -97,6 +89,16 @@ export function setNotificationLargeIcon(
97
89
  errorCallback: Function,
98
90
  iconName: string
99
91
  ): void;
92
+ export function setNotificationIconColor(
93
+ successCallback: Function,
94
+ errorCallback: Function,
95
+ color: string
96
+ ): void;
97
+ export function setNotificationActivity(
98
+ successCallback: Function,
99
+ errorCallback: Function,
100
+ activityName: string
101
+ ): void;
100
102
  export function getGCMToken(successCallback: Function): void;
101
103
  export function getRemoteMessagesDisplayType(successCallback: Function): void;
102
104
  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
@@ -98,37 +98,6 @@ 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
  // Event
133
102
 
134
103
  /**
@@ -174,6 +143,17 @@ export default Object.assign(
174
143
  RNSelligent.sendEvent(event, successCallback, errorCallback)
175
144
  return
176
145
  },
146
+ // Device Id
147
+ /**
148
+ * Returns the device id.
149
+ *
150
+ * @param {function} successCallback Callback function on success.
151
+ */
152
+ getDeviceId: function (successCallback) {
153
+ RNSelligent.getDeviceId(successCallback)
154
+ return
155
+ },
156
+
177
157
  // Remote Notifications
178
158
 
179
159
  /**
@@ -8,10 +8,11 @@
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
- @property (nonatomic, strong, readonly) NSNumber *configureLocationServices;
14
14
  @property (nonatomic, strong, readonly) NSNumber *clearCacheIntervalValue;
15
+ @property (nonatomic, strong, readonly) NSNumber *remoteMessageDisplayType;
15
16
  @property (nonatomic, strong, readonly) InAppMessageSettings *inAppMessageSettings;
16
17
 
17
18
  @end