@selligent-marketing-cloud/selligent-react-native 3.3.0 → 3.3.1
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.
- package/README.md +11 -8
- package/documentation/README.md +43 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,15 +4,16 @@ This module provides an API for the usage of the Selligent Mobile SDKs in React
|
|
|
4
4
|
|
|
5
5
|
## SelligentMobileSDK-ReactNative Integration
|
|
6
6
|
|
|
7
|
-
This module
|
|
7
|
+
This module supports the following SDK and tools:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
| ----------------------------------------------------------------------- | ------- |
|
|
11
|
-
| [Android](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.3.0 |
|
|
12
|
-
| [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.6.0 |
|
|
9
|
+
> **IMPORTANT** This module doesn't currently support 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.
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
| SDK | Version |
|
|
12
|
+
| ------------------------------------------------------------------------------ | ------- |
|
|
13
|
+
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.3.0 |
|
|
14
|
+
| [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.6.1 |
|
|
15
|
+
| ReactNative | 0.71.8 |
|
|
16
|
+
| Expo SDK | 48 |
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
18
19
|
|
|
@@ -40,6 +41,8 @@ This module uses the native Selligent SDKs:
|
|
|
40
41
|
|
|
41
42
|
### Android Specific Installation
|
|
42
43
|
|
|
44
|
+
> **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.
|
|
45
|
+
|
|
43
46
|
> ### **Attention for Huawei developers!**
|
|
44
47
|
>
|
|
45
48
|
> In order to use this module on Huawei devices (without Goggle Play services), you should add the following dependencies in the `build.gradle` files of the Android project in your React Native project:
|
|
@@ -210,7 +213,7 @@ This module uses the native Selligent SDKs:
|
|
|
210
213
|
|
|
211
214
|
> Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
|
|
212
215
|
|
|
213
|
-
3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.6.
|
|
216
|
+
3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.6.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**.
|
|
214
217
|
|
|
215
218
|
4. Execute `pod install` in the `/ios` folder
|
|
216
219
|
|
package/documentation/README.md
CHANGED
|
@@ -25,6 +25,7 @@ Selligent welcomes any recommendations or suggestions regarding the manual, as i
|
|
|
25
25
|
- [Push notifications](#push-notifications)
|
|
26
26
|
- [Rich Push Notifications](#rich-push-notifications)
|
|
27
27
|
- [Deep Linking](#deep-linking)
|
|
28
|
+
- [Background Modes](#background-modes)
|
|
28
29
|
- [Universal Linking - iOS](#universal-linking---ios)
|
|
29
30
|
- [Notification helper methods](#notification-helper-methods)
|
|
30
31
|
- [Disable Selligent Push Notifications](#disable-selligent-push-notifications)
|
|
@@ -238,8 +239,8 @@ This is because the JS layer is loaded **after** the native iOS SDK executes the
|
|
|
238
239
|
|
|
239
240
|
```javascript
|
|
240
241
|
// In DeeplinkHook.js
|
|
241
|
-
import { useEffect } from "react"
|
|
242
|
-
import { Alert, Linking } from "react-native"
|
|
242
|
+
import { useEffect } from "react"
|
|
243
|
+
import { Alert, Linking } from "react-native"
|
|
243
244
|
|
|
244
245
|
const useHandleDeepLink = () => {
|
|
245
246
|
useEffect(() => {
|
|
@@ -248,22 +249,22 @@ This is because the JS layer is loaded **after** the native iOS SDK executes the
|
|
|
248
249
|
Alert.alert('Deep Link', link || 'No link')
|
|
249
250
|
}
|
|
250
251
|
}).catch(err => {
|
|
251
|
-
console.warn('An error occurred', err)
|
|
252
|
-
})
|
|
252
|
+
console.warn('An error occurred', err)
|
|
253
|
+
})
|
|
253
254
|
|
|
254
|
-
const urlListener = Linking.addEventListener('url', ({url}) => Alert.alert('Deep Link', url || 'No link'))
|
|
255
|
+
const urlListener = Linking.addEventListener('url', ({url}) => Alert.alert('Deep Link', url || 'No link'))
|
|
255
256
|
|
|
256
|
-
return () => urlListener.remove()
|
|
257
|
+
return () => urlListener.remove()
|
|
257
258
|
}, [])
|
|
258
|
-
}
|
|
259
|
+
}
|
|
259
260
|
|
|
260
|
-
export default useHandleDeepLink
|
|
261
|
+
export default useHandleDeepLink
|
|
261
262
|
```
|
|
262
263
|
|
|
263
264
|
3. Add a call to `Selligent.executePushAction()` in your main `App.js` file, after adding the ReactNative linking handler (and after calling `Selligent.subscribeToEvents`, if being used)
|
|
264
265
|
|
|
265
266
|
```javascript
|
|
266
|
-
import Selligent from "@selligent-marketing-cloud/selligent-react-native"
|
|
267
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add Selligent import
|
|
267
268
|
|
|
268
269
|
const App = () => {
|
|
269
270
|
// Deeplinking handling library (i.e Linking.getInitialURL() & Linking.addEventListener...)
|
|
@@ -278,6 +279,38 @@ This is because the JS layer is loaded **after** the native iOS SDK executes the
|
|
|
278
279
|
}
|
|
279
280
|
```
|
|
280
281
|
|
|
282
|
+
#### Background Modes
|
|
283
|
+
|
|
284
|
+
**For iOS**, (if your app supports Background Modes) it is possible that after the app is launched from the background (location update, background push notification...) if the next action the user performs is executing a deeplink (via safari, push notification click...) the deeplink won't do anything. This is because the communication between the native part and the RN layer is not ready yet when the deeplink is executed from the native side. To workaround this, you can catch when the app is launched from the background and add a bit of delay before the `RCTLinkingManager openUrl` gets executed.
|
|
285
|
+
|
|
286
|
+
```objective-c
|
|
287
|
+
static BOOL launchedFromBackground = false;
|
|
288
|
+
|
|
289
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
290
|
+
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
|
|
291
|
+
launchedFromBackground = true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Other setup code
|
|
295
|
+
|
|
296
|
+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
|
|
300
|
+
if (launchedFromBackground) {
|
|
301
|
+
launchedFromBackground = false;
|
|
302
|
+
|
|
303
|
+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
|
304
|
+
[RCTLinkingManager application:application openURL:url options:options];
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
return [super application:application openURL:url options:options];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
281
314
|
#### Universal Linking - iOS
|
|
282
315
|
|
|
283
316
|
By default, universal links in a button from a Push/IAM will open the default browser, to avoid this and catch them on the App and apply any logic you want, you will need to add a property `interceptSelligentUniversalLinks` in the `selligent.json` with `true` as value.
|
|
@@ -755,7 +788,7 @@ The `data` property is an object itself containing more information specific to
|
|
|
755
788
|
Add the following import to work with the constants:
|
|
756
789
|
|
|
757
790
|
```javascript
|
|
758
|
-
import SelligentConstants from "@selligent-marketing-cloud/selligent-react-native/constants"
|
|
791
|
+
import SelligentConstants from "@selligent-marketing-cloud/selligent-react-native/constants"
|
|
759
792
|
```
|
|
760
793
|
|
|
761
794
|
### ClearCacheIntervalValue
|
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.3.
|
|
7
|
+
"version": "3.3.1",
|
|
8
8
|
"description": "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"repository": {
|