react-native-app-consent
v0.2.5
Published
react-native-app-consent
Downloads
11
Readme
react-native-app-consent
Getting started
$ yarn add git+https://gitlab+deploy-token-98:[email protected]/fidme/apps/modules/react-native-app-consent
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-app-consent
and addRNAppConsent.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNAppConsent.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)
Additional iOS step
You need to manually follow these steps :
- Open up your project in Xcode
- Select the main target (under "Targets"),
- Go to the "Build Settings" tab, and find the "Framework Search Paths" section.
- Add
$(SRCROOT)/../node_modules/react-native-app-consent/ios
(non-recursive) for each of your configurations (e.g. Debug and Release). - 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". - 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". - Clean your project
"Product" -> "Clean"
- Run your project (
Cmd+R
)
Android
- 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 thegetPackages()
method
- 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')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:
implementation project(':react-native-app-consent')
Additional Android step
- Open up your project in AndroidStudio
- 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}"
}
}
- 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);