react-native-app-consent

0.2.5 • Public • Published

react-native-app-consent

Getting started

$ yarn add git+https://gitlab+deploy-token-98:N3jnpXWzcBmuaaxHkRhs@git.snapp.fr/fidme/apps/modules/react-native-app-consent

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-app-consent and add RNAppConsent.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNAppConsent.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)
Additional iOS step

You need to manually follow these steps :

  1. Open up your project in Xcode
  2. Select the main target (under "Targets"),
  3. Go to the "Build Settings" tab, and find the "Framework Search Paths" section.
  4. Add $(SRCROOT)/../node_modules/react-native-app-consent/ios (non-recursive) for each of your configurations (e.g. Debug and Release).
  5. Find the AppConsentKit.framework file in ../node_modules/react-native-app-consent/ios and drag it into Xcode under the "Frameworks" group. In the dialog that pops up, uncheck "Copy items if needed", choose "Create groups", and ensure your main target is checked under "Add to targets".
  6. In Xcode, select the project, then select the main target (under "Targets"), then go to the "General" tab and find the "Embedded Binaries" section. Click the "+" icon and select AppConsentKit.framework which appears under "Frameworks" then click "Add".
  7. Clean your project "Product" -> "Clean"
  8. Run your project (Cmd+R)

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.fidme.appconsent.RNAppConsentPackage; to the imports at the top of the file
  • Add new RNAppConsentPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
include ':react-native-app-consent'
project(':react-native-app-consent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-app-consent/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
implementation project(':react-native-app-consent')
Additional Android step
  1. Open up your project in AndroidStudio
  2. In your project build.gradle file, under allprojects/repositories add the following and replace ${username} by the provided username and ${encrypted_password} by the provided encrypted password
maven {
    url "https://artifactory.datalf.chat/artifactory/app-consent-release"
    credentials {
        username = "${username}"
        password = "${encrypted_password}"
    }
}
  1. You need to add the following in your app build.gradle
android.configurations {
        all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

Usage

import RNAppConsent from 'react-native-app-consent';
 
RNAppConsent.start(String url);
RNAppConsent.presentGeoNoticeOnUserDemand(boolean userDemand, Promise promise);
RNAppConsent.presentNoticeOnUserDemand(boolean userDemand, Promise promise);
RNAppConsent.presentBannerOnUserDemand(boolean userDemand, Promise promise);
RNAppConsent.presentGeoBannerOnUserDemand(boolean userDemand, Promise promise);
RNAppConsent.isExtraPurposeAllowed(String purposeId, Promise promise);
RNAppConsent.isExtraVendorInPurposeAllowed(String vendorId, String purposeId, Promise promise);
RNAppConsent.shouldPresentGeolocationNoticeWithResolver();
RNAppConsent.shouldPresentNoticeWithResolver();
RNAppConsent.shouldPresentNoticesWithResolver();
RNAppConsent.subjectToGDPR(Promise promise);
RNAppConsent.cmpPresent(Promise promise);
RNAppConsent.consentString(Promise promise);
RNAppConsent.parsedVendors(Promise promise);
RNAppConsent.parsedPurposes(Promise promise);
RNAppConsent.setApplicationIcon(ReadableMap icon);
RNAppConsent.setNavigationBackImage(ReadableMap image);
RNAppConsent.setNoticeOnboardingImage(ReadableMap image);
RNAppConsent.setNoticeSuccessImage(ReadableMap image);
RNAppConsent.setNoticeInformationIcon(ReadableMap icon);
RNAppConsent.setGeoAdvertizingIcon(ReadableMap icon);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.5
    1
    • latest

Version History

Package Sidebar

Install

npm i react-native-app-consent

Weekly Downloads

1

Version

0.2.5

License

MIT

Unpacked Size

33 MB

Total Files

118

Last publish

Collaborators

  • dylanvicente
  • fidme_engineering