Skip to content

nov321/deepwall-react-native-sdk

 
 

Repository files navigation

DeepWall (deepwall-react-native-sdk)

  • This package gives wrapper methods for deepwall sdks. iOS - Android

  • Before implementing this package, you need to have api_key and list of actions.

  • You can get api_key and actions from DeepWall Dashboard


Getting started

$ npm install deepwall-react-native-sdk --save

React Native 0.59 and below

Run react-native link deepwall-react-native-sdk to link the library.

Installation Notes

  • IOS

    • Set minimum ios version to 10.0 in ios/Podfile like: platform :ios, '10.0'
    • Add use_frameworks! into ios/Podfile if not exists.
    • Remove flipper from ios/Podfile if exists.
    • Run $ cd ios && pod install
  • ANDROID

    • Set minSdkVersion to 21 in android/build.gradle
    • Add maven { url 'https://raw.githubusercontent.com/Teknasyon-Teknoloji/deepwall-android-sdk/master/' } into android/build.gradle (Add into repositories under allprojects)

Usage

Let's start

  • On application start you need to initialize sdk with api key and environment.
import DeepWall, { DeepWallEnvironments } from 'deepwall-react-native-sdk';

DeepWall.getInstance().initialize('API_KEY', DeepWallEnvironments.PRODUCTION);
  • Before requesting any landing page you need to set UserProperties (device uuid, country, language). See all parameters
import DeepWall, { DeepWallUserProperties } from 'deepwall-react-native-sdk';

DeepWall.getInstance().setUserProperties(
  new DeepWallUserProperties({
    uuid: 'UNIQUE_DEVICE_ID_HERE (UUID)',
    country: 'us',
    language: 'en-us',
  }),
);
  • After setting userProperties, you are ready for requesting landing page with an action name. You can find action name in DeepWall dashboard.
DeepWall.getInstance().requestLanding('AppLaunch');
  • You can also close landing.
DeepWall.getInstance().closeLanding();
  • If any of userProperties is changed you need to call updateUserProperties method. (For example if user changed application language)
DeepWall.getInstance().updateUserProperties({
  language: 'fr-fr',
});
  • There is also bunch of events triggering before and after DeepWall Actions. You may listen any action like below.
import DeepWall, { DeepWallEventBus, DeepWallEvents } from 'deepwall-react-native-sdk';

DeepWallEventBus.getInstance().listen(DeepWallEvents.LANDING_OPENED, function (data) {
  console.log(
    'DeepWallEvents.LANDING_OPENED',
    data
  );
});
  • For example you may listen all events from sdk like below.
import { DeepWallEventBus, DeepWallEvents } from 'deepwall-react-native-sdk';

Object.values(DeepWallEvents).map((item) => {
  DeepWallEventBus.getInstance().listen(item, function (data) {
    console.log(item, data);
  });
});

Notes

  • You may found complete list of events in Enums/Events.js or Native Sdk Page
  • UserProperties are:
    • uuid
    • country
    • language
    • environmentStyle
    • debugAdvertiseAttributions

About

This package gives wrapper methods for deepwall sdks.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 38.6%
  • Kotlin 28.2%
  • JavaScript 24.7%
  • Objective-C 5.9%
  • Ruby 2.6%