@selligent-marketing-cloud/selligent-react-native 3.2.7 → 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 (31) hide show
  1. package/README.md +14 -13
  2. package/RNSelligentMapper.podspec +22 -0
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/selligent/RNSelligent.java +5 -1
  5. package/android/src/main/java/com/selligent/Settings.java +13 -1
  6. package/documentation/README.md +51 -10
  7. package/package.json +2 -3
  8. package/RNSelligent.podspec +0 -21
  9. package/ios/RNSelligentMobileSDK.xcframework/Info.plist +0 -40
  10. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +0 -352
  11. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Info.plist +0 -0
  12. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.abi.json +0 -2634
  13. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -60
  14. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  15. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftinterface +0 -60
  16. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/module.modulemap +0 -4
  17. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  18. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +0 -179
  19. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +0 -700
  20. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Info.plist +0 -0
  21. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -2634
  22. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -60
  23. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  24. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -60
  25. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -2634
  26. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -60
  27. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -60
  29. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/module.modulemap +0 -4
  30. package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
  31. 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.2.0 |
11
- | [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.5.1 |
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
 
@@ -153,7 +153,7 @@ 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
 
@@ -172,14 +172,14 @@ This module uses the native Selligent SDKs:
172
172
  }
173
173
  ```
174
174
 
175
- 4. Add the following in the `android/app/build.gradle` file (at the bottom):
175
+ 3. Add the following in the `android/app/build.gradle` file (at the bottom):
176
176
 
177
177
  ```groovy
178
178
  // Add the following:
179
179
  apply plugin: 'com.google.gms.google-services'
180
180
  ```
181
181
 
182
- 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:
183
183
 
184
184
  ```java
185
185
  // Add the following import statements:
@@ -196,6 +196,7 @@ This module uses the native Selligent SDKs:
196
196
  }
197
197
  }
198
198
  ```
199
+
199
200
  </details>
200
201
 
201
202
  ### iOS Specific installation
@@ -209,7 +210,7 @@ This module uses the native Selligent SDKs:
209
210
 
210
211
  > Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
211
212
 
212
- 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.5.1"` 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**.
213
214
 
214
215
  4. Execute `pod install` in the `/ios` folder
215
216
 
@@ -230,7 +231,7 @@ This module uses the native Selligent SDKs:
230
231
  ```
231
232
 
232
233
  </details>
233
- <br>
234
+
234
235
  <details open>
235
236
  <summary>With autolinking (RN 0.60 and above)</summary>
236
237
 
@@ -251,4 +252,4 @@ This module uses the native Selligent SDKs:
251
252
  [RNSelligent configureWithLaunchOptions:launchOptions];
252
253
  ```
253
254
 
254
- </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
+
@@ -53,7 +53,7 @@ dependencies {
53
53
  exclude group:'com.facebook.fbjni'
54
54
  exclude group:'com.facebook.yoga'
55
55
  }
56
- implementation 'com.selligent.sdk:selligent_mobile_sdk:4.2.0'
56
+ implementation 'com.selligent.sdk:selligent_mobile_sdk:4.3.0'
57
57
  implementation 'com.google.code.gson:gson:2.9.0'
58
58
  implementation 'com.google.firebase:firebase-messaging:23.0.8'
59
59
  implementation 'androidx.work:work-runtime:2.8.1'
@@ -101,7 +101,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
101
101
  inAppMessageRefreshType = settings.getInAppMessageRefreshType().getSmInAppRefreshType();
102
102
 
103
103
  final SMManager smManager = getSMManager();
104
- SMManager.DEBUG = BuildConfig.BUILD_TYPE.equals("debug");
104
+ SMManager.DEBUG = BuildConfig.BUILD_TYPE.equals("debug") || settings.getEnableAndroidLogging();
105
105
  smManager.start(smSettings, application);
106
106
 
107
107
  final Resources resources = application.getResources();
@@ -346,6 +346,10 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
346
346
  }
347
347
  }
348
348
 
349
+ public static void enableNotifications() {
350
+ SMManager.getInstance().enableNotifications();
351
+ }
352
+
349
353
  @ReactMethod
350
354
  public void displayLastReceivedRemotePushNotification(String templateId) {
351
355
  final Activity currentActivity = getCurrentActivity();
@@ -22,6 +22,7 @@ class Settings {
22
22
  private String notificationChannelId = "SMChannel001";
23
23
  private String notificationChannelName = "SMDefaultChannel";
24
24
  private String notificationChannelDescription = "";
25
+ private Boolean enableAndroidLogging = false;
25
26
 
26
27
  private Settings() { }
27
28
 
@@ -85,6 +86,8 @@ class Settings {
85
86
  return notificationChannelDescription;
86
87
  }
87
88
 
89
+ public Boolean getEnableAndroidLogging() { return enableAndroidLogging; }
90
+
88
91
  public static Settings fromHashMap(Map<String, Object> settingsHashMap) {
89
92
  final Settings settings = new Settings();
90
93
 
@@ -101,7 +104,7 @@ class Settings {
101
104
  settings.notificationLargeIcon = (String) settingsHashMap.get("notificationLargeIcon");
102
105
  }
103
106
 
104
- if(settingsHashMap.containsKey("notificationIconColor")) {
107
+ if (settingsHashMap.containsKey("notificationIconColor")) {
105
108
  settings.notificationIconColor = (String) settingsHashMap.get("notificationIconColor");
106
109
  }
107
110
 
@@ -120,24 +123,33 @@ class Settings {
120
123
  if (settingsHashMap.containsKey("loadCacheAsynchronously")) {
121
124
  settings.loadCacheAsynchronously = (Boolean) settingsHashMap.get("loadCacheAsynchronously");
122
125
  }
126
+
123
127
  if (settingsHashMap.containsKey("notificationChannelId")) {
124
128
  settings.notificationChannelId = (String) settingsHashMap.get("notificationChannelId");
125
129
  }
130
+
126
131
  if (settingsHashMap.containsKey("notificationChannelName")) {
127
132
  settings.notificationChannelName = (String) settingsHashMap.get("notificationChannelName");
128
133
  }
134
+
129
135
  if (settingsHashMap.containsKey("notificationChannelDescription")) {
130
136
  settings.notificationChannelDescription = (String) settingsHashMap.get("notificationChannelDescription");
131
137
  }
132
138
 
139
+ if (settingsHashMap.containsKey("enableAndroidLogging")) {
140
+ settings.enableAndroidLogging = (Boolean) settingsHashMap.get("enableAndroidLogging");
141
+ }
142
+
133
143
  final Double clearCacheIndex = (Double) settingsHashMap.get("clearCacheIntervalValue");
134
144
  if (clearCacheIndex != null) {
135
145
  settings.clearCacheIntervalValue = ClearCacheIntervalValue.valueOf(clearCacheIndex.intValue());
136
146
  }
147
+
137
148
  final Double inAppMsgRefreshIndex = (Double) settingsHashMap.get("inAppMessageRefreshType");
138
149
  if (inAppMsgRefreshIndex != null) {
139
150
  settings.inAppMessageRefreshType = InAppMessageRefreshType.valueOf(inAppMsgRefreshIndex.intValue());
140
151
  }
152
+
141
153
  final Double remoteMsgRefreshIndex = (Double) settingsHashMap.get("remoteMessageDisplayType");
142
154
  if (remoteMsgRefreshIndex != null) {
143
155
  settings.remoteMessageDisplayType = RemoteMessageDisplayType.valueOf(remoteMsgRefreshIndex.intValue());
@@ -73,7 +73,9 @@ The following properties can be used in the `selligent.json` to further configur
73
73
  | remoteMessageDisplayType | [enum](#remotemessagesdisplaytype) | The behaviour when receiving a push notification with the app in foreground |
74
74
  | appGroupId | string |(iOS Only) The appgroup id necessary for the correct communication between the app and the app extensions |
75
75
  | shouldClearBadge | boolean | (iOS Only) Whether or not, clicking a push notification should reset the badge number |
76
- | shouldDisplayRemoteNotification | boolean | (iOS Only) Whether or not, the SDK should try to display the content linked to a push message (usually, inapp messages) or it will be handled customly |
76
+ | shouldDisplayRemoteNotification | boolean | (iOS Only) Whether or not, the SDK should try to display the content linked to a push message (usually, inapp messages) or it will be handled customly
77
+ | enableiOSLogging | [enum](#iosloglevel) | Log level used since the app launch |
78
+ | enableAndroidLogging | boolean | (Android Only) Whether or not, the SDK logging will be enabled since the app launch |
77
79
  | doNotListenToThePush | boolean | (Android Only) Whether or not, the SDK will listen for pushs from google |
78
80
  | doNotFetchTheToken | boolean | (Android Only) Whether or not, the SDK will listen for push tokens from google |
79
81
  | loadCacheAsynchronously | boolean | (Android Only) Whether or not, the SDK load the cache asynchronously |
@@ -89,7 +91,44 @@ The following properties can be used in the `selligent.json` to further configur
89
91
 
90
92
  Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#create-an-apns-key) & [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android/tree/master/Documentation#creating-an-application) native SDKs guides in order to optin for push notifications in Apple & Google.
91
93
 
92
- **For iOS**, there are some extra steps you need to follow in the native part of the ReactNative project:
94
+ **For Android**, if targeting API level 33 and above:
95
+ 1. Add this to request the push permission and let the SDK know when it is accepted, in the activity where you want to:
96
+ ```java
97
+ import com.selligent.RNSelligent;
98
+
99
+ public class MainActivity extends ReactActivity {
100
+ final int NOTIFICATION_PERMISSION_REQUEST_CODE = 1111;
101
+
102
+ @Override
103
+ public void onStart()
104
+ {
105
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.S_V2)
106
+ {
107
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED)
108
+ {
109
+ ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.POST_NOTIFICATIONS}, NOTIFICATION_PERMISSION_REQUEST_CODE);
110
+ }
111
+ }
112
+
113
+ super.onStart();
114
+ }
115
+
116
+ @Override
117
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
118
+ {
119
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
120
+
121
+ if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE)
122
+ {
123
+ if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
124
+ {
125
+ RNSelligent.enableNotifications();
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ **For iOS**:
93
132
 
94
133
  1. For push notifications you need to delegate some of the `AppDelegate.m` methods to the SDK:
95
134
 
@@ -158,14 +197,16 @@ Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/m
158
197
  ```javascript
159
198
  import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
160
199
 
161
- Selligent.enableNotifications(
162
- (response) => { // success callback
163
- },
164
- (error) => { // error callback
165
- },
166
- true
167
- )
168
-
200
+ if (Platform.OS === 'ios') {
201
+ Selligent.enableNotifications(
202
+ (response) => { // success callback
203
+ },
204
+ (error) => { // error callback
205
+ },
206
+ true
207
+ )
208
+ }
209
+
169
210
  Selligent.registerForProvisionalRemoteNotification(
170
211
  () => { // success callback
171
212
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  },
5
5
  "name": "@selligent-marketing-cloud/selligent-react-native",
6
6
  "title": "Selligent React Native",
7
- "version": "3.2.7",
7
+ "version": "3.3.0",
8
8
  "description": "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs",
9
9
  "main": "index.js",
10
10
  "repository": {
@@ -38,10 +38,9 @@
38
38
  "test": "jest"
39
39
  },
40
40
  "files": [
41
- "/RNSelligent.podspec",
41
+ "/RNSelligentMapper.podspec",
42
42
  "/*.js",
43
43
  "/*.ts",
44
- "/ios/RNSelligentMobileSDK.xcframework",
45
44
  "/ios/*.h",
46
45
  "/ios/*.m",
47
46
  "/android/src/main",
@@ -1,21 +0,0 @@
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 = "RNSelligent"
7
- s.authors = package['author']
8
- s.version = package["version"]
9
- s.summary = package["description"]
10
- s.description = "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs"
11
- s.homepage = package['homepage']
12
- s.license = "MIT"
13
- s.platform = :ios, "11.0"
14
- s.source = { :git => "https://github.com/SelligentMarketingCloud/MobileSDK-ReactNative.git", :tag => "#{s.version}" }
15
-
16
- s.vendored_frameworks = "ios/RNSelligentMobileSDK.xcframework"
17
- s.source_files = "ios/*.{h,m}"
18
-
19
- s.dependency "React-Core"
20
- s.dependency "SelligentMobileSDK/Framework", "3.5.1"
21
- end
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>AvailableLibraries</key>
6
- <array>
7
- <dict>
8
- <key>LibraryIdentifier</key>
9
- <string>ios-arm64</string>
10
- <key>LibraryPath</key>
11
- <string>RNSelligentMobileSDK.framework</string>
12
- <key>SupportedArchitectures</key>
13
- <array>
14
- <string>arm64</string>
15
- </array>
16
- <key>SupportedPlatform</key>
17
- <string>ios</string>
18
- </dict>
19
- <dict>
20
- <key>LibraryIdentifier</key>
21
- <string>ios-arm64_x86_64-simulator</string>
22
- <key>LibraryPath</key>
23
- <string>RNSelligentMobileSDK.framework</string>
24
- <key>SupportedArchitectures</key>
25
- <array>
26
- <string>arm64</string>
27
- <string>x86_64</string>
28
- </array>
29
- <key>SupportedPlatform</key>
30
- <string>ios</string>
31
- <key>SupportedPlatformVariant</key>
32
- <string>simulator</string>
33
- </dict>
34
- </array>
35
- <key>CFBundlePackageType</key>
36
- <string>XFWK</string>
37
- <key>XCFrameworkFormatVersion</key>
38
- <string>1.0</string>
39
- </dict>
40
- </plist>