React Native wrapper for Wootric
Clone or download
diegoserranoa Add iOS
Add iOS implementation for react-native-wootric wrapper.

Changes:
- Update iOS library code

Trello
https://trello.com/c/4Usth9st/3900-7-build-ios-and-android-wrapper-of-our-native-sdk-for-react-native-5
Latest commit 881343c Nov 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android Add Android Nov 14, 2018
ios Add iOS Nov 21, 2018
windows Add Android Nov 14, 2018
.gitignore Add Android Nov 14, 2018
README.md Add iOS Nov 21, 2018
index.js Add Android Nov 14, 2018
package-lock.json Add Android Nov 14, 2018
package.json Add Android Nov 14, 2018

README.md

react-native-wootric

Getting started

$ npm install react-native-wootric --save

Mostly automatic installation

$ react-native link react-native-wootric

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-wootric and add RNWootric.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNWootric.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<
iOS only: additional steps for iOS
  • Download the SDK and add it to your project without using any dependency manager.
  1. Download & unzip the Wootric SDK

  2. In your Xcode project, drag & drop the WootricSDK.framework in the RNWootric.xcodeproj

Your project will look something like this

Xcode

Make sure the "Copy items if needed" checkbox is checked.

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNWootricPackage; to the imports at the top of the file
  • Add new RNWootricPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-wootric'
    project(':react-native-wootric').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-wootric/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-wootric')
    

Windows

Read it! :D

  1. In Visual Studio add the RNWootric.sln in node_modules/react-native-wootric/windows/RNWootric.sln folder to their solution, reference from their app.
  2. Open up your MainPage.cs app
  • Add using Wootric.RNWootric; to the usings at the top of the file
  • Add new RNWootricPackage() to the List<IReactPackage> returned by the Packages method

Usage

import RNWootric from 'react-native-wootric';

RNWootric.configureWithClientID("client_id", "NPS-1234asdf");
RNWootric.setEndUserEmail("react_example@wootric.com");
RNWootric.setSurveyImmediately(true);
RNWootric.setEndUserCreatedAt(1234567890);
RNWootric.setEndUserExternalId("external_id_1234");
RNWootric.setEndUserPhoneNumber("+17865551234");
RNWootric.setEndUserProperties({first_name: "React", last_name: "Native"});
RNWootric.showOptOut(true);
RNWootric.setFirstSurveyAfter(5);
RNWootric.setCustomLanguage("ES");
RNWootric.setCustomProductName("Wootric React Native");
RNWootric.setCustomAudience("un amigo");
RNWootric.showSurvey();