4.7.0 • Published 5 months ago

react-native-prizor-sdk-module v4.7.0

Weekly downloads
10
License
MIT
Repository
-
Last release
5 months ago

react-native-prizor-sdk-module

iOS and Android native integration for Prizor SDK

Installation

npm install react-native-prizor-sdk-module

iOS

XCode 14+ is recommended.

Open ios/Podfile and fill the requirements above:

  • Check to use frameworks
    use_frameworks!
  • Set minimum deployment target to 13.0
    platform :ios, '13.0'
  • Add private repository source
    source 'https://git-ext.crmall.com/cocoapods/specs.git'
  • Add public repository source
    source 'https://cdn.cocoapods.org/'
  • Run pod install at ios path

    $ pod install

Add NSAllowsLocalNetworking as true at Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsLocalNetworking</key>
    <true/>
</dict>

Add NSAllowsArbitraryLoads, NSAllowsArbitraryLoadsInWebContent and io.flutter.embedded_views_preview as true at Info.plist:

<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

Remove NSExceptionDomains from Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <!-- <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict> -->
</dict>

Android

Use minimum SDK version to 22 at project build.gradle:

minSdkVersion 22

Enable multiDexEnabled at application build.gradle:

android {
    defaultConfig {
        //...
        multiDexEnabled true
    }
}

Add Java 8 compatibility at application build.gradle:

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Allow Prizor to request the opening of other apps on the user's device by adding the tag in the AndroidManifest.xml:

...
<queries>
    <package android:name="com.whatsapp" />
    <package android:name="com.whatsapp.w4b" />
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
    </intent>
    <intent>
        <action android:name="android.intent.action.DIAL" />
        <data android:scheme="tel" />
    </intent>
    <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="*/*" />
    </intent>
</queries>

Configure the Prizor's private maven repository:

  • 1st option: set the environment variables MAVEN_PRIZOR_USERNAME and MAVEN_PRIZOR_PASSWORD with the given credentials

  • 2nd option: replace the values of the entries username and password with the given credentials at build.gradle of the react-native-prizor-sdk-module module:

repositories {
    maven {
        url "https://maven.prizor.com/"
        credentials {
            username System.getenv('MAVEN_PRIZOR_USERNAME') ?: "username"
            password System.getenv('MAVEN_PRIZOR_PASSWORD') ?: "password"
        }
    }
    maven {
        url 'https://storage.googleapis.com/download.flutter.io'
    }
}

Usage

import PrizorSdkModule from "react-native-prizor-sdk-module";

// ...

PrizorSdkModule.startWithJson(params);

Start with Json

let params = (
      '{' +
      '   "environment":"production",' +
      '   "appId":"***",' +
      '   "secret":"***",' +
      // ...
      '}'
)
PrizorSdkModule.startWithJson(params);

Start with key value pairs

let params = {
      environment: 'production',
      appId: '***',
      secret: '***',
      // ...
}
PrizorSdkModule.startWithKeyValuePairs(params);

Close

PrizorSdkModule.close();

Useful commands

Creating a new application

npx react-native init AwesomeProject

You can also start a project with a custom React Native template, like TypeScript, with --template argument:

npx react-native init AwesomeTSProject --template react-native-template-typescript

Starting React Native application

npx react-native start

You can also start reseting the cache:

watchman watch-del-all && npx react-native start --reset-cache

Running the application

iOS

npx react-native run-ios

Remember to check that Podfile was installed and its repos updated. Assert running pod install --repo-update at ios path.

Android

npx react-native run-android

License

MIT

4.6.7

8 months ago

4.6.6

9 months ago

4.6.8

8 months ago

4.6.5

9 months ago

4.6.4

9 months ago

4.7.0

5 months ago

4.6.1

9 months ago

4.6.3

9 months ago

4.6.2

9 months ago

4.5.15

10 months ago

4.5.8

10 months ago

4.5.7

11 months ago

4.5.9

10 months ago

4.5.4

11 months ago

4.5.6

11 months ago

4.5.14

10 months ago

4.5.12

10 months ago

4.5.13

10 months ago

4.5.0

1 year ago

4.5.2

1 year ago

4.5.1

1 year ago

4.3.0

1 year ago

4.2.0

1 year ago

4.1.0

2 years ago

3.6.9

2 years ago

3.6.8

2 years ago

3.7.1

2 years ago

3.7.0

2 years ago

3.6.7

2 years ago

3.6.6

2 years ago

3.6.5

2 years ago

3.6.4

2 years ago

3.5.5

2 years ago

3.6.3

2 years ago

3.6.2

2 years ago

3.6.1

2 years ago

3.6.0

2 years ago

3.5.4

3 years ago

3.5.3

3 years ago

3.5.2

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.4.3

3 years ago

3.4.2

3 years ago

3.4.1

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.3.0

4 years ago

3.2.5

4 years ago

3.2.4

4 years ago

3.2.3

4 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

0.1.0

5 years ago

0.1.1

5 years ago

3.1.0

5 years ago