@selligent-marketing-cloud/selligent-react-native 3.2.6 → 3.3.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 (41) hide show
  1. package/README.md +28 -42
  2. package/RNSelligentMapper.podspec +22 -0
  3. package/android/build.gradle +6 -4
  4. package/android/src/main/java/com/selligent/BroadcastDataFactory.java +12 -6
  5. package/android/src/main/java/com/selligent/ButtonAction.java +2 -1
  6. package/android/src/main/java/com/selligent/ButtonBroadcastEventDataParser.java +9 -1
  7. package/android/src/main/java/com/selligent/Event.java +3 -3
  8. package/android/src/main/java/com/selligent/InAppMessageBroadcastEventDataParser.java +9 -1
  9. package/android/src/main/java/com/selligent/RNSelligent.java +96 -75
  10. package/android/src/main/java/com/selligent/SMEventFactory.java +2 -1
  11. package/android/src/main/java/com/selligent/SMSettingsFactory.java +3 -0
  12. package/android/src/main/java/com/selligent/Settings.java +15 -3
  13. package/documentation/README.md +52 -11
  14. package/index.android.js +0 -9
  15. package/index.js +9 -0
  16. package/ios/RNSelligentMapper.m +8 -4
  17. package/package.json +2 -3
  18. package/RNSelligent.podspec +0 -21
  19. package/ios/RNSelligentMobileSDK.xcframework/Info.plist +0 -40
  20. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +0 -350
  21. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Info.plist +0 -0
  22. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.abi.json +0 -2603
  23. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -59
  24. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  25. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftinterface +0 -59
  26. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/module.modulemap +0 -4
  27. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  28. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +0 -179
  29. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +0 -696
  30. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Info.plist +0 -0
  31. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -2603
  32. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -59
  33. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  34. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -59
  35. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -2603
  36. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -59
  37. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  38. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -59
  39. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/module.modulemap +0 -4
  40. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  41. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +0 -234
package/README.md CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  This module provides an API for the usage of the Selligent Mobile SDKs in React Native.
4
4
 
5
- # SelligentMobileSDK-ReactNative Integration
5
+ ## SelligentMobileSDK-ReactNative Integration
6
+
6
7
  This module uses the native Selligent SDKs:
7
8
 
8
9
  | SDK | Version |
9
10
  | ----------------------------------------------------------------------- | ------- |
10
- | [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.1.0 |
11
- | [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.4.0 |
12
-
11
+ | [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.3.0 |
12
+ | [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.6.0 |
13
13
 
14
14
  > **IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version 4.2.0 or higher in order to build on Android. This is the default Android Gradle Plugin version since React Native version 0.64.0 but can be manually increased in older versions of React Native.
15
-
16
15
  > **IMPORTANT** Since version 2.10.0 of this module, we support React Native v0.70, but NOT REACT NATIVE'S NEW ARCHITECTURE! The following library contains React native modules, that are tailored to and can only be used in React Native's legacy architecture, that will be deprecated in the future when the new architecture will be stable.
17
16
 
18
17
  ## Installation
19
- > Please refer to our <a href="documentation/#reactnative--using-the-sdk">SDK full documentation</a> for a step-by-step guide on how to use the SDK, after installation.
18
+
19
+ > Please refer to our [SDK full documentation](documentation/#reactnative--using-the-sdk) for a step-by-step guide on how to use the SDK, after installation.
20
20
 
21
21
  1. Install the module
22
22
 
@@ -36,7 +36,7 @@ This module uses the native Selligent SDKs:
36
36
  }
37
37
  ```
38
38
 
39
- > Check all the options that can be used in our <a href="documentation/#selligent_json">SDK full documentation</a>
39
+ > Check all the options that can be used in our [SDK full documentation](documentation/#working-with-the-selligentjson)
40
40
 
41
41
  ### Android Specific Installation
42
42
 
@@ -91,7 +91,7 @@ This module uses the native Selligent SDKs:
91
91
  project(':selligent-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@selligent-marketing-cloud/selligent-react-native/android')
92
92
  ```
93
93
 
94
- 3. Add the following in the `android/build.gradle` file, and make sure the the the Gradle version in `android/gradle/wrapper/gradle-wrapper.properties` is >= 6.7.1:
94
+ 3. Add the following in the `android/build.gradle` file, and make sure that the Gradle version in `android/gradle/wrapper/gradle-wrapper.properties` is >= 6.7.1:
95
95
 
96
96
  ```groovy
97
97
  // android/build.gradle
@@ -153,63 +153,49 @@ This module uses the native Selligent SDKs:
153
153
  ```
154
154
 
155
155
  </details>
156
- <br>
156
+
157
157
  <details open>
158
158
  <summary>With autolinking (RN 0.60 and above)</summary>
159
159
 
160
160
  1. Create a Google application following the section **Creating a Google application** of the **Android - Using the SDK** pdf, and place the `google-services.json` file in the `./android/app` folder.
161
161
 
162
- 2. Add the following lines at the end of the `android/settings.gradle` file:
163
-
164
- ```groovy
165
- include ':selligent-react-native'
166
- project(':selligent-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@selligent-marketing-cloud/selligent-react-native/android')
167
- ```
168
-
169
- 3. Add the following in the `android/build.gradle` file, and make sure the the the Gradle version in `android/gradle/wrapper/gradle-wrapper.properties` is >= 6.7.1:
162
+ 2. Add the following in the `android/build.gradle` file, and make sure that the Gradle version in `android/gradle/wrapper/gradle-wrapper.properties` is >= 6.7.1:
170
163
 
171
164
  ```groovy
172
165
  // android/build.gradle
173
166
 
174
167
  buildscript {
175
168
  dependencies {
176
- // Make sure your Gradle plugin version is >= 4.2.0
177
- classpath("com.android.tools.build:gradle:4.2.0")
178
169
  // Add the following:
179
170
  classpath 'com.google.gms:google-services:4.3.3'
180
171
  }
181
172
  }
182
173
  ```
183
174
 
184
- ```groovy
185
- // android/gradle/wrapper/gradle-wrapper.properties
186
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
187
- ```
188
-
189
- 4. Add the following in the `android/app/build.gradle` file:
175
+ 3. Add the following in the `android/app/build.gradle` file (at the bottom):
190
176
 
191
177
  ```groovy
192
178
  // Add the following:
193
179
  apply plugin: 'com.google.gms.google-services'
194
180
  ```
195
181
 
196
- 5. Add the following in the `android/app/src/../MainApplication.java` file:
182
+ 4. Add the following in the `android/app/src/../MainApplication.java` file:
197
183
 
198
- ```java
199
- // Add the following import statements:
200
- import com.selligent.RNSelligent;
201
- import com.selligent.RNSelligentPackage;
184
+ ```java
185
+ // Add the following import statements:
186
+ import com.selligent.RNSelligent;
187
+ import com.selligent.RNSelligentPackage;
202
188
 
203
- public class MainApplication extends Application implements ReactApplication {
204
- @Override
205
- public void onCreate() {
206
- super.onCreate();
189
+ public class MainApplication extends Application implements ReactApplication {
190
+ @Override
191
+ public void onCreate() {
192
+ super.onCreate();
207
193
 
208
- // Add the following:
209
- RNSelligent.configure(this);
210
- }
211
- }
212
- ```
194
+ // Add the following:
195
+ RNSelligent.configure(this);
196
+ }
197
+ }
198
+ ```
213
199
 
214
200
  </details>
215
201
 
@@ -224,7 +210,7 @@ This module uses the native Selligent SDKs:
224
210
 
225
211
  > Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
226
212
 
227
- 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.4.0"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
213
+ 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.6.0"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
228
214
 
229
215
  4. Execute `pod install` in the `/ios` folder
230
216
 
@@ -245,7 +231,7 @@ This module uses the native Selligent SDKs:
245
231
  ```
246
232
 
247
233
  </details>
248
- <br>
234
+
249
235
  <details open>
250
236
  <summary>With autolinking (RN 0.60 and above)</summary>
251
237
 
@@ -266,4 +252,4 @@ This module uses the native Selligent SDKs:
266
252
  [RNSelligent configureWithLaunchOptions:launchOptions];
267
253
  ```
268
254
 
269
- </details>
255
+ </details>
@@ -0,0 +1,22 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "RNSelligentMapper"
7
+ s.authors = package['author']
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.description = "React Native wrapper mapper for the Selligent Marketing Cloud Android and iOS SDKs"
11
+ s.homepage = package['homepage']
12
+ s.license = "MIT"
13
+ s.platform = :ios, "12.0"
14
+ s.source = { :git => "https://github.com/SelligentMarketingCloud/MobileSDK-ReactNative.git", :tag => "v" + s.version.to_s }
15
+ s.swift_version = "5.0"
16
+
17
+ s.source_files = "ios/*.{h,m}"
18
+
19
+ s.dependency "React-Core"
20
+ s.dependency "RNSelligent"
21
+ end
22
+
@@ -1,8 +1,6 @@
1
1
  import com.android.build.api.variant.BuildConfigField
2
2
  import java.util.regex.*
3
3
 
4
- apply plugin: 'com.android.library'
5
-
6
4
  buildscript {
7
5
  repositories {
8
6
  google()
@@ -14,6 +12,9 @@ buildscript {
14
12
  }
15
13
  }
16
14
 
15
+ apply plugin: 'com.android.library'
16
+
17
+
17
18
  android {
18
19
  compileSdkVersion 33
19
20
 
@@ -44,6 +45,7 @@ repositories {
44
45
  url "$projectDir/../node_modules/react-native/android"
45
46
  }
46
47
  google()
48
+ maven { url 'https://developer.huawei.com/repo/' }
47
49
  }
48
50
 
49
51
  dependencies {
@@ -51,7 +53,7 @@ dependencies {
51
53
  exclude group:'com.facebook.fbjni'
52
54
  exclude group:'com.facebook.yoga'
53
55
  }
54
- implementation 'com.selligent.sdk:selligent_mobile_sdk:4.1.0'
56
+ implementation 'com.selligent.sdk:selligent_mobile_sdk:4.3.0'
55
57
  implementation 'com.google.code.gson:gson:2.9.0'
56
58
  implementation 'com.google.firebase:firebase-messaging:23.0.8'
57
59
  implementation 'androidx.work:work-runtime:2.8.1'
@@ -110,4 +112,4 @@ def getCurrentFlavor() {
110
112
  else {
111
113
  return ""
112
114
  }
113
- }
115
+ }
@@ -10,12 +10,18 @@ import java.util.HashMap;
10
10
  import java.util.Map;
11
11
 
12
12
  class BroadcastDataFactory {
13
+ private BroadcastDataFactory(){}
13
14
 
14
- private static Map<String, BroadcastEventDataParser> broadcastDataParserMap = new HashMap<String, BroadcastEventDataParser>() {{
15
- put(SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE, new InAppMessageBroadcastEventDataParser());
16
- put(SMManager.BROADCAST_EVENT_BUTTON_CLICKED, new ButtonBroadcastEventDataParser());
17
- put(SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN, new GCMTokenBroadcastEventDataParser());
18
- }};
15
+ private static Map<String, BroadcastEventDataParser> getBroadcastDataParserMap()
16
+ {
17
+ HashMap<String, BroadcastEventDataParser> parser = new HashMap<>();
18
+
19
+ parser.put(SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE, new InAppMessageBroadcastEventDataParser());
20
+ parser.put(SMManager.BROADCAST_EVENT_BUTTON_CLICKED, new ButtonBroadcastEventDataParser());
21
+ parser.put(SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN, new GCMTokenBroadcastEventDataParser());
22
+
23
+ return parser;
24
+ }
19
25
 
20
26
  public static WritableMap getBroadcastData(String smBroadcastEventType, Intent intent) {
21
27
  final WritableMap broadcastData = new WritableNativeMap();
@@ -27,7 +33,7 @@ class BroadcastDataFactory {
27
33
  }
28
34
  broadcastData.putString("broadcastEventType", resultingBroadcastEventType);
29
35
 
30
- final BroadcastEventDataParser broadcastEventDataParser = broadcastDataParserMap.get(smBroadcastEventType);
36
+ final BroadcastEventDataParser broadcastEventDataParser = getBroadcastDataParserMap().get(smBroadcastEventType);
31
37
 
32
38
  if (broadcastEventDataParser != null) {
33
39
  final WritableMap resultingData = broadcastEventDataParser.parse(intent);
@@ -43,8 +43,9 @@ public enum ButtonAction
43
43
  return deeplink;
44
44
  case 113:
45
45
  return simple;
46
+ default:
47
+ return unknown;
46
48
  }
47
- return unknown;
48
49
  }
49
50
 
50
51
  public static ButtonAction valueOf(SMLinkAction linkAction)
@@ -10,7 +10,15 @@ import com.selligent.sdk.SMNotificationButton;
10
10
  class ButtonBroadcastEventDataParser implements BroadcastEventDataParser {
11
11
  @Override
12
12
  public WritableMap parse(Intent intent) {
13
- SMNotificationButton button = (SMNotificationButton)intent.getSerializableExtra(SMManager.BROADCAST_DATA_BUTTON);
13
+ SMNotificationButton button;
14
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU)
15
+ {
16
+ button = intent.getSerializableExtra(SMManager.BROADCAST_DATA_BUTTON, SMNotificationButton.class);
17
+ }
18
+ else
19
+ {
20
+ button = (SMNotificationButton)intent.getSerializableExtra(SMManager.BROADCAST_DATA_BUTTON);
21
+ }
14
22
 
15
23
  return wrap(button);
16
24
  }
@@ -2,6 +2,7 @@ package com.selligent;
2
2
 
3
3
  import java.util.HashMap;
4
4
  import java.util.Hashtable;
5
+ import java.util.Map;
5
6
 
6
7
  class Event {
7
8
 
@@ -35,9 +36,8 @@ class Event {
35
36
  if (eventHashMap.containsKey("data")) {
36
37
  final HashMap<String, String> dataHashMap = (HashMap<String, String>) eventHashMap.get("data");
37
38
  data = new Hashtable<>();
38
- for (String key : dataHashMap.keySet()) {
39
- final String value = dataHashMap.get(key);
40
- data.put(key, value);
39
+ for (Map.Entry<String, String> entry : dataHashMap.entrySet()) {
40
+ data.put(entry.getKey(), entry.getValue());
41
41
  }
42
42
  }
43
43
 
@@ -12,7 +12,15 @@ import com.selligent.sdk.SMManager;
12
12
  class InAppMessageBroadcastEventDataParser implements BroadcastEventDataParser {
13
13
  @Override
14
14
  public WritableMap parse(Intent intent) {
15
- SMInAppMessage[] messages = (SMInAppMessage[])intent.getSerializableExtra(SMManager.BROADCAST_DATA_IN_APP_MESSAGES);
15
+ SMInAppMessage[] messages;
16
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU)
17
+ {
18
+ messages = intent.getSerializableExtra(SMManager.BROADCAST_DATA_IN_APP_MESSAGES, SMInAppMessage[].class);
19
+ }
20
+ else
21
+ {
22
+ messages = (SMInAppMessage[])intent.getSerializableExtra(SMManager.BROADCAST_DATA_IN_APP_MESSAGES);
23
+ }
16
24
 
17
25
  return wrap(messages);
18
26
  }