New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-sift-iosshare

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-sift-iosshare

A React Native wrapper for Sift iOS and Android SDKs

latest
npmnpm
Version
0.1.11
Version published
Maintainers
1
Created
Source

sift-react-native

React Native wrapper for Sift iOS and Android SDKs

Installation

  • Install library from npm:
    yarn add sift-react-native
    or
    npm install sift-react-native

Android React Native 0.60.0 or above

No additional setup is required

iOS React Native 0.60.0 or above

  • Insert the following line in Podfile where new pods are added: pod 'sift-react-native', :path => '../node_modules/sift-react-native'
  • Navigate to the ios directory of the project via terminal and run pod install

Android React Native 0.59 or below

Automatically

react-native link

Manually

  • Append the following lines to android/settings.gradle:

    include ':sift-react-native'

    project(':sift-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/sift-react-native/android')

  • Insert the following lines inside the dependencies block in android/app/build.gradle:

    implementation project(':sift-react-native')

  • Open up android/app/src/main/java/[...]/MainApplication.java

  • Add import com.siftreactnative.SiftReactNativePackage; to the imports at the top of the file
  • Add new SiftReactNativePackage() to the list returned by the getPackages() method. Add a comma to the previous item if there's already something there.

Insert the following lines inside the dependencies block in android/app/build.gradle:

   implementation 'com.android.support:support-v4:27.0.2'

iOS React Native 0.59 or below

Support will be available soon

Usage

First, import the module:

import SiftReactNative from "sift-react-native";

Then, invoke the following method to initialise the SDK:

Configure the account details

SiftReactNative.setSiftConfig(accountId, beaconKey, disallowCollectingLocationData, serverUrlFormat);

Where:

  • accountId (string, the Account ID that needs to be obtained from Sift console under API Keys tab) required
  • beaconKey (string, the Beacon Key that needs to be obtained from Sift console under API Keys tab) required
  • disallowCollectingLocationData (boolean, permission to allow collection of location data from device)

Make sure to add location permissions to your application if you want Sift to collect location data. Sift will not request permissions that are not granted by the user from your application.

  • serverUrlFormat (string, the format of URL where the data needs to be uploaded) -- Sample URL format for iOS: https://api3.siftscience.com/v3/accounts/%@/mobile_events -- Sample URL format for Android: https://api3.siftscience.com/v3/accounts/%s/mobile_events

NB: This feature is available only in iOS platform

Set the User ID

As soon as your application is aware of the user id, set it on the Sift instance using the code below. All subsequent events will include the user id.

SiftReactNative.setUserId(userId);

If the user logs out of your application, you should unset the user id:

SiftReactNative.unsetUserId();

Upload event

To upload collected events to sift.

SiftReactNative.upload();

Set page name

NB: This feature is available only in Android platform

To set the page name

SiftReactNative.setPageName("HomePage");

Example

To see sift-react-native in action you can check out the source in the example folder.

To initialize example project

yarn bootstrap

When the bootstrap is done, you will be able to start the example app by executing one of the following commands:

iOS app

yarn example ios

Android app

yarn example android

License

MIT

Keywords

react-native

FAQs

Package last updated on 15 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts