React Native

Update Inloco React Native plugin

Run the command below in your React Native project to update the plugin version:

npm install [email protected] --save

🍎 Update iOS native dependencies

It is necessary to update the iOS native dependencies

2.1 React Native 0.59 and lower

Open the your Podfile and replace:

pod 'InLocoEngage-iOS-SDK', '~> 4.4.3'

with

pod 'InLocoEngage-iOS-SDK', '~> 5.4.0'

Inside the ios folder of your project, run the following command to install the iOS dependencies:

pod install

Link the dependencies:

react-native link react-native-inlocoengage

2.2 React Native 0.60 and higher

Run from the command line:

cd ios
pod install

📱 Update the SDK initialization

The Inloco SDK initialization now relies on the presence of initialization files for each platform. On the Android platform, it is necessary to put a file called inloco.xml in the main/res/values. On the iOS platform, it is necessary to add a InLocoOptions.plist in your iOS project. We recommend that the previous initialization is replaced with the new one, according to the integration section.

The previous initialization using the InLocoEngage.init(options) is then replaced with InLocoEngage.init().

JavaScript
JavaScript
import InLocoEngage from 'react-native-inlocoengage';
// v4 initialization (should be removed)
const options = Platform.select({
ios: {
appId: "<YOUR_IOS_APP_ID>",
logsEnabled: true
},
android: {
appId: "<YOUR_ANDROID_APP_ID>",
logsEnabled: true
},
});
InLocoEngage.init(options);
// v5 initialization: Initializes the Inloco SDK by using initialization files
InLocoEngage.init();

Create an file called inloco.xml in the main/res/values directory of your Android project:

in-loco-options.properties example
in-loco-options.properties example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Your Inloco App id-->
<string name="inloco_app_id" translatable="false">YOUR_APP_ID</string>
<!-- Whether SDK logs are enabled -->
<bool name="inloco_log_enabled">true</bool>
</resources>

Add a file called InLocoOptions.plist to your iOS project:

InLocoOptions.plist
InLocoOptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-->The Application ID<-->
<key>applicationId</key>
<string>YOUR-APP-ID</string>
<!-->Indicates whether the SDK should present logs or not. Default value: true<-->
<key>logEnabled</key>
<true/>
</dict>
</plist>

You can download examples of both files in the following links: InLocoIOptions.plist and inloco.xml

If you still prefer to initialize the Inloco SDK using the options object, you can do as shown below:

JavaScript
JavaScript
import InLocoEngage from 'react-native-inlocoengage';
//options object remains the same on both v4 and v5
const options = Platform.select({
ios: {
appId: "<YOUR_IOS_APP_ID>",
logsEnabled: true
},
android: {
appId: "<YOUR_ANDROID_APP_ID>",
logsEnabled: true
},
});
//v5 initialization with options
InLocoEngage.initWithOptions(options);
//v4 initialization with options. SHOULD BE REMOVED
InLocoEngagein.init(options);

🔏 Changes to the User Privacy functions

New functions concerning user privacy were added to provide more fine-grained control amongst data usage. To know more, refer to the documentation.

V4

V5

InLocoEngage.isWaitingUserPrivacyConsent()

InLocoEngage.checkConsent()

InLocoEngage.giveUserPrivacyConsent()

InLocoEngage.allowConsentTypes(), InLocoEngage.denyConsentTypes()

Changes to the Push Notifications functions

It is recommended to take a look at the corresponding documentation:

V4

V5

InLocoEngage.onNotificationPresented()

Removed.

InLocoEngage.onNotificationReceived()

Removed.