├── .github ├── scripts │ ├── check_before_update.sh │ ├── extract_android_sdk_version.sh │ ├── extract_ios_sdk_version.sh │ ├── extract_version.sh │ ├── update.sh │ ├── update_bridge_version.sh │ └── update_native_sdks.sh └── workflows │ ├── publish.yml │ ├── release.yml │ ├── tag.yml │ ├── test.yml │ └── update.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── android ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── didomi │ └── reactnative │ ├── DidomiModule.kt │ ├── DidomiPackage.kt │ └── EventTypes.kt ├── babel.config.js ├── ios ├── Didomi-Bridging-Header.h ├── Didomi.m ├── Didomi.xcodeproj │ └── project.pbxproj ├── Extensions │ └── StringExtension.swift └── RNDidomi.swift ├── package.json ├── react-native-didomi.podspec ├── sample ├── .bundle │ └── config ├── .eslintrc.js ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── Gemfile ├── Gemfile.lock ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── didomi_config.json │ │ │ ├── java │ │ │ └── io │ │ │ │ └── didomi │ │ │ │ └── reactnative │ │ │ │ └── sample │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .xcode.env │ ├── Podfile │ ├── _xcode.env │ ├── sample.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── sample.xcscheme │ ├── sample.xcworkspace │ │ └── contents.xcworkspacedata │ ├── sample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ ├── PrivacyInfo.xcprivacy │ │ ├── didomi_config.json │ │ └── main.m │ └── sampleTests │ │ ├── Info.plist │ │ └── sampleTests.m ├── jest.config.js ├── metro.config.js ├── package.json ├── src │ ├── App.tsx │ ├── GetterCall.tsx │ ├── GetterParamsCall.tsx │ ├── Getters.tsx │ ├── GettersParams.tsx │ ├── MethodCall.tsx │ ├── Methods.tsx │ ├── SetterCall.tsx │ ├── Setters.tsx │ └── Types.ts └── tsconfig.json ├── scripts └── bootstrap.js ├── src ├── Constants.ts ├── CurrentUserStatusTransaction.ts ├── Didomi.ts ├── DidomiListener.ts ├── DidomiTypes.ts ├── __tests__ │ ├── CurrentUserStatusTransaction.test.ts │ └── DidomiListener.test.ts └── index.tsx ├── test ├── .bundle │ └── config ├── .eslintrc.js ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── Gemfile ├── Gemfile.lock ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── didomi │ │ │ │ └── reactnative │ │ │ │ └── test │ │ │ │ ├── BaseUITest.kt │ │ │ │ ├── EspressoViewFinder.kt │ │ │ │ ├── UIGettersParamsTest.kt │ │ │ │ ├── UIGettersTest.kt │ │ │ │ ├── UIInitializeTest.kt │ │ │ │ ├── UIMethodsTest.kt │ │ │ │ ├── UISetUserTest.kt │ │ │ │ ├── UISettersTest.kt │ │ │ │ └── UITest.kt │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── didomi_config.json │ │ │ ├── java │ │ │ └── io │ │ │ │ └── didomi │ │ │ │ └── reactnative │ │ │ │ └── test │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── raw │ │ │ └── app.json │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .xcode.env │ ├── Didomi Tests.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Didomi Tests.xcscheme │ ├── Didomi Tests.xcworkspace │ │ └── contents.xcworkspacedata │ ├── DidomiUITests │ │ ├── DidomiUITests.swift │ │ ├── Info.plist │ │ ├── extensions │ │ │ ├── String.swift │ │ │ └── XCUIElement.swift │ │ └── models │ │ │ ├── PurposeData.swift │ │ │ └── VendorData.swift │ ├── Podfile │ ├── _xcode.env │ └── test │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ ├── PrivacyInfo.xcprivacy │ │ ├── didomi_config.json │ │ └── main.m ├── jest.config.js ├── metro.config.js ├── package.json ├── scripts │ ├── android │ │ └── prepare-ui-tests-locally-android.sh │ └── ios │ │ ├── prepare-ui-tests-locally-ios.sh │ │ └── run-ui-tests-locally-ios.sh ├── src │ ├── App.tsx │ ├── CurrentUserStatusTransactionsList.tsx │ ├── GetterCall.tsx │ ├── GetterParamsCall.tsx │ ├── Getters.tsx │ ├── GettersParams.tsx │ ├── InitializeMethods.tsx │ ├── MethodCall.tsx │ ├── Methods.tsx │ ├── SetUser.tsx │ ├── SetterCall.tsx │ ├── Setters.tsx │ ├── Types.ts │ ├── constants │ │ └── constants.tsx │ └── helpers │ │ └── ResultHelper.tsx └── tsconfig.json ├── tsconfig.build.json └── tsconfig.json /.github/scripts/check_before_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Check new versions for android and iOS sdks 5 | # exit with error if no update available (abort pipeline) 6 | #---------------------------------------------------------- 7 | 8 | # Get last version from pod 9 | pod_last_version() { 10 | version="" 11 | temp_file=$(mktemp) 12 | pod trunk info Didomi-XCFramework > "$temp_file" 13 | 14 | while IFS= read -r line; do 15 | if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+) ]]; then 16 | current_version="${BASH_REMATCH[1]}" 17 | if [[ -z "$version" || $(printf '%s\n' "$version" "$current_version" | sort -V | tail -n1) == "$current_version" ]]; then 18 | version=$current_version 19 | fi 20 | fi 21 | done < "$temp_file" 22 | 23 | rm "$temp_file" 24 | echo "$version" 25 | } 26 | 27 | changes=0 28 | 29 | # Check android SDK Version 30 | currentVersion=$(sh .github/scripts/extract_android_sdk_version.sh) 31 | if [[ -z $currentVersion ]]; then 32 | echo "Error while getting android SDK current version" 33 | exit 1 34 | fi 35 | 36 | lastVersion=$(curl -s 'https://repo.maven.apache.org/maven2/io/didomi/sdk/android/maven-metadata.xml' | sed -ne '/release/{s/.*\(.*\)<\/release>.*/\1/p;q;}') 37 | if [[ ! $lastVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 38 | echo "Error while getting android SDK version" 39 | exit 1 40 | fi 41 | 42 | 43 | if [[ "$currentVersion" == "$lastVersion" ]]; then 44 | echo "No change for Android SDK: $currentVersion" 45 | else 46 | changes=$changes+1 47 | 48 | echo "Android SDK current version needs update: $currentVersion to $lastVersion" 49 | fi 50 | 51 | # Check ios SDK Version 52 | currentVersion=$(sh .github/scripts/extract_ios_sdk_version.sh) 53 | if [[ -z $currentVersion ]]; then 54 | echo "Error while getting iOS SDK current version" 55 | exit 1 56 | fi 57 | 58 | lastVersion=$(pod_last_version) 59 | if [[ -z $lastVersion ]]; then 60 | echo "Error while getting iOS SDK version" 61 | exit 1 62 | fi 63 | 64 | if [[ "$currentVersion" == "$lastVersion" ]]; then 65 | echo "No change for iOS SDK: $currentVersion" 66 | else 67 | changes=$changes+1 68 | 69 | echo "iOS SDK current version needs update: $currentVersion to $lastVersion" 70 | fi 71 | 72 | if [[ $changes == 0 ]]; then 73 | echo "--------------------" 74 | echo "| No change, abort! |" 75 | echo "--------------------" 76 | exit 1 77 | else 78 | # continue 79 | exit 0 80 | fi 81 | -------------------------------------------------------------------------------- /.github/scripts/extract_android_sdk_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Extract Android SDK version (eg: 1.2.3) 5 | # Returns the Android SDK current version if match pattern 6 | #---------------------------------------------------------- 7 | 8 | version=$(cat android/build.gradle | sed -n 's|.*io.didomi.sdk:android:\([^"]*\)".*|\1|p') 9 | if [[ -z $version ]]; then 10 | echo "Error while getting android SDK current version" 11 | exit 1 12 | fi 13 | 14 | echo "$version" 15 | -------------------------------------------------------------------------------- /.github/scripts/extract_ios_sdk_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Extract iOS SDK version (eg: 1.2.3) 5 | # Returns the iOS SDK current version if match pattern 6 | #---------------------------------------------------------- 7 | 8 | version=$(cat react-native-didomi.podspec | sed -n "s|.*s.dependency[ ]*\"Didomi-XCFramework\", \"\([^']*\)\".*|\1|p") 9 | if [[ ! $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 10 | echo "Error while getting iOS version" 11 | exit 1 12 | fi 13 | 14 | echo "$version" 15 | -------------------------------------------------------------------------------- /.github/scripts/extract_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Extract RN version (eg: 1.2.3) 5 | # Returns the RN current version if match pattern 6 | #---------------------------------------------------------- 7 | 8 | version=$(grep -m 1 "\"version\"" package.json | sed -r 's/^ *//;s/.*: *"//;s/",?//') 9 | if [[ ! $version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 10 | echo "Error while getting RN version" 11 | exit 1 12 | fi 13 | 14 | echo "$version" 15 | -------------------------------------------------------------------------------- /.github/scripts/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #--------------------------------------------------------------------------------------------- 4 | # Update Android and iOS SDKs version (latest from repos) 5 | # THEN 6 | # Increment React-Native version (from param major|minor|patch) 7 | # No argument: use patch as default 8 | #--------------------------------------------------------------------------------------------- 9 | 10 | sh .github/scripts/update_native_sdks.sh || exit 1 11 | sh .github/scripts/update_bridge_version.sh "$1" || exit 1 12 | -------------------------------------------------------------------------------- /.github/scripts/update_bridge_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Increment React-Native version (from param major|minor|patch) 5 | # No argument: use patch as default 6 | # Update React-Native dependencies 7 | #---------------------------------------------------------- 8 | 9 | # set nocasematch option 10 | shopt -s nocasematch 11 | 12 | # Increment position (Patch is default) 13 | if [[ "$1" =~ ^major$ ]]; then 14 | position=0 15 | elif [[ "$1" =~ ^minor$ ]]; then 16 | position=1 17 | else 18 | position=2 19 | fi 20 | 21 | # unset nocasematch option 22 | shopt -u nocasematch 23 | 24 | # Increment version (eg `sh increment_version 1.2.3 1` returns `1.3.0`) 25 | # args: 26 | # - version number (eg `0.32.4`) 27 | # - increment number: `0` (major) | `1` (minor) | `2` (patch) 28 | increment_version() { 29 | local delimiter=. 30 | local array=($(echo "$1" | tr $delimiter '\n')) 31 | array[$2]=$((array[$2] + 1)) 32 | if [ $2 -lt 2 ]; then array[2]=0; fi 33 | if [ $2 -lt 1 ]; then array[1]=0; fi 34 | echo $( 35 | local IFS=$delimiter 36 | echo "${array[*]}" 37 | ) 38 | } 39 | 40 | # 41 | # React Native 42 | # 43 | 44 | # Get RN version 45 | currentRNVersion=$(sh .github/scripts/extract_version.sh) 46 | if [[ ! $currentRNVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 47 | echo "Error while getting RN version ($currentRNVersion)" 48 | exit 1 49 | fi 50 | 51 | echo "Current version is $currentRNVersion" 52 | 53 | # Increment RN version 54 | newRNVersion=$(increment_version "$currentRNVersion" $position) 55 | echo "React Native version will change from $currentRNVersion to $newRNVersion" 56 | 57 | # Update RN version for Constants 58 | pushd src >/dev/null 59 | sed -i~ -e "s|DIDOMI_VERSION = \"[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|DIDOMI_VERSION = \"$newRNVersion|g" Constants.ts || exit 1 60 | popd >/dev/null 61 | 62 | # Update RN version in package.json 63 | sed -i~ -e "s|\"version\": \"[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|\"version\": \"$newRNVersion|g" package.json || exit 1 64 | 65 | # 66 | # Cleanup 67 | # 68 | 69 | # Cleanup backup files 70 | find . -type f -name '*~' -delete 71 | 72 | echo "Update complete" 73 | -------------------------------------------------------------------------------- /.github/scripts/update_native_sdks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------- 4 | # Update Android and iOS SDKs version (latest from repos) 5 | #---------------------------------------------------------- 6 | 7 | # Get last version from pod 8 | pod_last_version() { 9 | version="" 10 | temp_file=$(mktemp) 11 | pod trunk info Didomi-XCFramework > "$temp_file" 12 | 13 | while IFS= read -r line; do 14 | if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+) ]]; then 15 | current_version="${BASH_REMATCH[1]}" 16 | if [[ -z "$version" || $(printf '%s\n' "$version" "$current_version" | sort -V | tail -n1) == "$current_version" ]]; then 17 | version=$current_version 18 | fi 19 | fi 20 | done < "$temp_file" 21 | 22 | rm "$temp_file" 23 | echo "$version" 24 | } 25 | 26 | # 27 | # Android 28 | # 29 | 30 | # Get Android SDK Version 31 | lastAndroidVersion=$(curl -s 'https://repo.maven.apache.org/maven2/io/didomi/sdk/android/maven-metadata.xml' | sed -ne '/release/{s/.*\(.*\)<\/release>.*/\1/p;q;}') 32 | if [[ ! $lastAndroidVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 33 | echo "Error while getting android SDK version" 34 | exit 1 35 | fi 36 | 37 | echo "Android SDK last version is $lastAndroidVersion" 38 | 39 | # Update Android dependency 40 | sed -i~ -e "s|io.didomi.sdk:android:[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}|io.didomi.sdk:android:$lastAndroidVersion|g" android/build.gradle || exit 1 41 | 42 | # 43 | # iOS 44 | # 45 | 46 | # Get iOS SDK Version 47 | lastIosVersion=$(pod_last_version) 48 | if [[ ! $lastIosVersion =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then 49 | echo "Error while getting ios SDK version" 50 | exit 1 51 | fi 52 | 53 | echo "iOS SDK last version is $lastIosVersion" 54 | 55 | # Update iOS dependency 56 | sed -i~ -e "s|s.dependency \"Didomi-XCFramework\", \"[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}\"|s.dependency \"Didomi-XCFramework\", \"$lastIosVersion\"|g" react-native-didomi.podspec || exit 1 57 | 58 | # Update pod 59 | pod repo update || exit 1 60 | 61 | # 62 | # Cleanup 63 | # 64 | 65 | # Cleanup backup files 66 | find . -type f -name '*~' -delete 67 | 68 | echo "Update complete" 69 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | # Triggered manually or on release creation 4 | on: 5 | release: 6 | types: 7 | - created 8 | workflow_dispatch: 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | steps: 18 | 19 | - name: Cache Node dependencies 20 | uses: actions/cache@v4 21 | with: 22 | path: ~/.npm 23 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 24 | restore-keys: | 25 | ${{ runner.os }}-node- 26 | 27 | - name: Checkout 28 | uses: actions/checkout@v4 29 | 30 | - name: Setup Node 31 | uses: actions/setup-node@v4 32 | with: 33 | node-version: 20 34 | registry-url: 'https://registry.npmjs.org' 35 | 36 | - name: Install dependencies 37 | run: npm install 38 | 39 | - name: Prepare and publish 40 | run: | 41 | npm run prepare 42 | npm publish --access public 43 | env: 44 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 45 | -------------------------------------------------------------------------------- /.github/workflows/tag.yml: -------------------------------------------------------------------------------- 1 | name: Create TAG 2 | 3 | # Triggered manually or from Update 4 | on: 5 | workflow_dispatch: 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-${{ github.ref }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | on-success: 13 | name: Create TAG 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | 20 | - name: Set React Native version as ENV 21 | run: | 22 | echo "rn_version=$(sh .github/scripts/extract_version.sh)" >> $GITHUB_ENV 23 | 24 | - name: Print React Native Version 25 | run: | 26 | echo "React Native version is: ${{ env.rn_version }}" 27 | 28 | - name: Create tag 29 | uses: actions/github-script@v6 30 | with: 31 | github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # Use custom token to trigger following workflows 32 | script: | 33 | github.rest.git.createRef({ 34 | owner: context.repo.owner, 35 | repo: context.repo.repo, 36 | ref: "refs/tags/${{ env.rn_version }}", 37 | sha: context.sha 38 | }) 39 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: Update 2 | 3 | # Triggered manually 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | increment: 8 | description: "Increment (major, minor, patch)" 9 | required: true 10 | default: "patch" 11 | force: 12 | description: "Force update (even if sdk is up to date)" 13 | required: false 14 | default: "false" 15 | 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.ref }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | update: 22 | name: Update version and dependencies 23 | runs-on: macos-14 # required for pod info / update 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v4 28 | with: 29 | token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} 30 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token 31 | fetch-depth: 0 # otherwise, you will failed to push refs to dest repo 32 | 33 | - name: Check if React Native SDK requires update 34 | if: github.event.inputs.force != 'true' 35 | run: | 36 | bash .github/scripts/check_before_update.sh 37 | 38 | - name: Setup Node 39 | uses: actions/setup-node@v4 40 | with: 41 | node-version: 20 42 | 43 | - name: Cache Node dependencies 44 | uses: actions/cache@v4 45 | with: 46 | path: ~/.npm 47 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 48 | restore-keys: | 49 | ${{ runner.os }}-node- 50 | 51 | - name: Install dependencies 52 | run: npm install 53 | 54 | - name: Update React Native SDK 55 | run: | 56 | echo "Increment: ${{ github.event.inputs.increment }}" 57 | bash .github/scripts/update.sh ${{ github.event.inputs.increment }} 58 | 59 | - name: Commit & Push changes 60 | uses: actions-js/push@master 61 | with: 62 | author_email: ${{ secrets.AUTHOR_EMAIL }} 63 | author_name: ${{ secrets.AUTHOR_NAME }} 64 | branch: ${{ github.ref }} 65 | github_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} 66 | message: "Update Native SDKs and increment ${{ github.event.inputs.increment }} version" 67 | 68 | - name: Trigger Tag 69 | run: | 70 | curl --request POST \ 71 | --url 'https://api.github.com/repos/didomi/react-native/actions/workflows/tag.yml/dispatches' \ 72 | --header 'authorization: Bearer ${{ secrets.CUSTOM_GITHUB_TOKEN }}' \ 73 | --data '{ "ref": "${{ github.ref }}" }' 74 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | **/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | 65 | # testing 66 | /coverage 67 | 68 | # Yarn 69 | .yarn/* 70 | !.yarn/patches 71 | !.yarn/plugins 72 | !.yarn/releases 73 | !.yarn/sdks 74 | !.yarn/versions 75 | 76 | # generated by sample / test 77 | lib/ 78 | package-lock.json 79 | Podfile.lock 80 | yarn.lock 81 | index.android.bundle 82 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | # Modified BSD License (BSD-3) 2 | 3 | _Copyright © `2021`, `Didomi`_ 4 | _All rights reserved._ 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. Neither the name of the `Didomi` nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL `DIDOMI` BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Didomi React Native 2 | 3 | Didomi is a leading Consent Management Platform that allows companies to collect, store, and leverage user consent under GDPR, CCPA, and other data privacy regulations. This plugin enables React Native developers to get in compliance and optimize their consent rate and monetization on native mobile apps. 4 | 5 | This repository contains the source code and a sample app for the Didomi React Native plugin. This plugin enables React Native developers to easily use Didomi's Consent Management Platform on Android and iOS apps. 6 | 7 | ## Installation 8 | 9 | Install using ``yarn add @didomi/react-native`` 10 | Or ``npm i @didomi/react-native`` 11 | 12 | Then install required pods for iOS with ``cd ios && pod install`` 13 | 14 | As Didomi requires Swift runtime for iOS, you may need to add an empty Swift file (to create a briding header) into Xcode project. 15 | 16 | ## Usage 17 | 18 | 19 | ```js 20 | import { Didomi, DidomiEventType } from '@didomi/react-native'; 21 | import { useEffect } from 'react'; 22 | 23 | // ... 24 | function App() { 25 | useEffect(() => { 26 | // Initialize and setup UI 27 | // The initialize function need to be called only once and as early as possible to give time for the SDK initialization 28 | Didomi.initialize('YOUR_API_KEY', undefined, undefined, undefined, false, undefined, 'YOUR_NOTICE_ID'); 29 | 30 | // The setupUI displays the popup and is only available once the SDK sent the onReady events 31 | Didomi.setupUI(); 32 | }, []) 33 | return ( 34 | 35 | // ... 36 | 37 | ); 38 | } 39 | 40 | //... 41 | 42 | // Retrieve data 43 | const purposes = await Didomi.getEnabledPurposes(); 44 | const status = await Didomi.getUserStatusForVendor('vendorId'); 45 | 46 | //... 47 | 48 | // Register an event listener 49 | Didomi.addEventListener(DidomiEventType.SHOW_NOTICE, () => { 50 | console.log('Show notice'); 51 | }); 52 | 53 | //... 54 | 55 | ``` 56 | 57 | For a complete overview of available methods and events, have a look at the [online documentation](https://developers.didomi.io/cmp/mobile-sdk/react-native). 58 | 59 | ## Configuration with local file 60 | 61 | 62 | In case you need to use a local configuration. The ``didomi_config.json`` must be added to native iOS and Android projects. 63 | 64 | On iOS, drag and drop the file to Xcode files. 65 | 66 | On Android, copy it to the ``src/main/assets`` folder. 67 | 68 | ## Documentation 69 | 70 | For complete instructions on installing and using the plugin, please read our documentation: 71 | 72 | [Developer guide](https://developers.didomi.io/cmp/react-native) 73 | 74 | [API reference](https://developers.didomi.io/cmp/react-native/reference) 75 | 76 | ## Example applications 77 | 78 | Sources contain 2 applications: ``/test`` (an app designed mostly for UI testing ) and ``/sample`` (more human friendly app). 79 | 80 | They can be run with: 81 | 82 | ```bash 83 | # test or sample Application 84 | cd sample 85 | cd ios && pod install 86 | cd .. 87 | npx react-native run-ios 88 | # or npx react-native run-android 89 | ``` 90 | 91 | ## Suggesting improvements 92 | 93 | To file bugs, make feature requests, or to suggest other improvements, please use [Github's issue tracker](https://github.com/didomi/reat-native/issues). 94 | 95 | ## License 96 | 97 | Modified BSD License (BSD-3) 98 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonSlurper 2 | 3 | buildscript { 4 | // Buildscript is evaluated before everything else so we can't use getExtOrDefault 5 | def kotlin_version = project.properties["Didomi_kotlinVersion"] 6 | 7 | repositories { 8 | google() 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | classpath "com.android.tools.build:gradle:8.5.2" 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 15 | } 16 | } 17 | 18 | apply plugin: "com.android.library" 19 | apply plugin: "kotlin-android" 20 | 21 | def getExtOrDefault(name) { 22 | return project.properties["Didomi_" + name].toString() 23 | } 24 | 25 | def getExtOrIntegerDefault(name) { 26 | return project.properties["Didomi_" + name].toInteger() 27 | } 28 | 29 | def parsedPackage = new JsonSlurper().parseText(file("../package.json").text) 30 | 31 | android { 32 | compileSdk getExtOrIntegerDefault("compileSdkVersion") 33 | namespace "io.didomi.reactnative" 34 | 35 | defaultConfig { 36 | minSdk getExtOrIntegerDefault("minSdkVersion") 37 | targetSdk getExtOrIntegerDefault("targetSdkVersion") 38 | versionCode 1 39 | versionName "${parsedPackage.version}" 40 | 41 | multiDexEnabled = true 42 | } 43 | 44 | buildTypes { 45 | release { 46 | minifyEnabled false 47 | } 48 | } 49 | lintOptions { 50 | disable "GradleCompatible" 51 | } 52 | compileOptions { 53 | sourceCompatibility JavaVersion.VERSION_17 54 | targetCompatibility JavaVersion.VERSION_17 55 | } 56 | 57 | kotlinOptions { 58 | jvmTarget = JavaVersion.VERSION_17 59 | } 60 | 61 | } 62 | 63 | repositories { 64 | google() 65 | mavenLocal() 66 | mavenCentral() 67 | 68 | def found = false 69 | def defaultDir = null 70 | def androidSourcesName = "React Native sources" 71 | 72 | if (rootProject.ext.has("reactNativeAndroidRoot")) { 73 | defaultDir = rootProject.ext.get("reactNativeAndroidRoot") 74 | } else { 75 | defaultDir = new File(projectDir, "/../../../node_modules/react-native/android") 76 | } 77 | 78 | if (defaultDir.exists()) { 79 | maven { 80 | url defaultDir.toString() 81 | name androidSourcesName 82 | } 83 | 84 | logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}") 85 | found = true 86 | } else { 87 | def parentDir = rootProject.projectDir 88 | 89 | 1.upto(5, { 90 | if (found) return true 91 | parentDir = parentDir.parentFile 92 | 93 | def androidSourcesDir = new File(parentDir, "node_modules/react-native") 94 | 95 | def androidPrebuiltBinaryDir = new File(parentDir, "node_modules/react-native/android") 96 | 97 | if (androidPrebuiltBinaryDir.exists()) { 98 | maven { 99 | url androidPrebuiltBinaryDir.toString() 100 | name androidSourcesName 101 | } 102 | 103 | logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}") 104 | found = true 105 | } else if (androidSourcesDir.exists()) { 106 | maven { 107 | url androidSourcesDir.toString() 108 | name androidSourcesName 109 | } 110 | 111 | logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}") 112 | found = true 113 | } 114 | }) 115 | } 116 | 117 | if (!found) { 118 | throw new GradleException( 119 | "${project.name}: unable to locate React Native android sources. " + 120 | "Ensure you have you installed React Native as a dependency in your project and try again." 121 | ) 122 | } 123 | } 124 | 125 | def kotlin_version = getExtOrDefault("kotlinVersion") 126 | 127 | dependencies { 128 | // noinspection GradleDynamicVersion 129 | api "com.facebook.react:react-native:+" 130 | 131 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 132 | 133 | implementation "io.didomi.sdk:android:2.25.1" 134 | } 135 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | Didomi_kotlinVersion=1.9.24 2 | 3 | Didomi_buildToolsVersion=34.0.0 4 | Didomi_compileSdkVersion=34 5 | Didomi_minSdkVersion=21 6 | Didomi_targetSdkVersion=34 7 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /android/src/main/java/io/didomi/reactnative/DidomiPackage.kt: -------------------------------------------------------------------------------- 1 | package io.didomi.reactnative 2 | 3 | import com.facebook.react.ReactPackage 4 | import com.facebook.react.bridge.NativeModule 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.uimanager.ViewManager 7 | 8 | class DidomiPackage : ReactPackage { 9 | override fun createNativeModules(reactContext: ReactApplicationContext): List { 10 | return listOf(DidomiModule(reactContext)) 11 | } 12 | 13 | override fun createViewManagers(reactContext: ReactApplicationContext): List> { 14 | return emptyList() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /android/src/main/java/io/didomi/reactnative/EventTypes.kt: -------------------------------------------------------------------------------- 1 | package io.didomi.reactnative 2 | 3 | enum class EventTypes(val event: String) { 4 | // Consent 5 | CONSENT_CHANGED("on_consent_changed"), 6 | 7 | // SDK lifecycle events 8 | ERROR("on_error"), 9 | ERROR_CALLBACK("on_error_callback"), 10 | READY("on_ready"), 11 | READY_CALLBACK("on_ready_callback"), 12 | 13 | // Notice 14 | HIDE_NOTICE("on_hide_notice"), 15 | SHOW_NOTICE("on_show_notice"), 16 | NOTICE_CLICK_AGREE("on_notice_click_agree"), 17 | NOTICE_CLICK_DISAGREE("on_notice_click_disagree"), 18 | NOTICE_CLICK_VIEW_VENDORS("on_notice_click_view_vendors"), 19 | NOTICE_CLICK_VIEW_SPI_PURPOSES("on_notice_click_view_spi_purposes"), 20 | NOTICE_CLICK_MORE_INFO("on_notice_click_more_info"), 21 | NOTICE_CLICK_PRIVACY_POLICY("on_notice_click_privacy_policy"), 22 | 23 | // Preferences 24 | HIDE_PREFERENCES("on_hide_preferences"), 25 | SHOW_PREFERENCES("on_show_preferences"), 26 | 27 | // Preferences - Views 28 | PREFERENCES_CLICK_VIEW_PURPOSES("on_preferences_click_view_purposes"), 29 | PREFERENCES_CLICK_VIEW_VENDORS("on_preferences_click_view_vendors"), 30 | PREFERENCES_CLICK_VIEW_SPI_PURPOSES("on_preferences_click_view_spi_purposes"), 31 | 32 | // Preferences - Purpose 33 | PREFERENCES_CLICK_AGREE_TO_ALL("on_preferences_click_agree_to_all"), 34 | PREFERENCES_CLICK_DISAGREE_TO_ALL("on_preferences_click_disagree_to_all"), 35 | PREFERENCES_CLICK_AGREE_TO_ALL_PURPOSES("on_preferences_click_agree_to_all_purposes"), 36 | PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES("on_preferences_click_disagree_to_all_purposes"), 37 | PREFERENCES_CLICK_RESET_ALL_PURPOSES("on_preferences_click_reset_all_purposes"), 38 | PREFERENCES_CLICK_PURPOSE_AGREE("on_preferences_click_purpose_agree"), 39 | PREFERENCES_CLICK_PURPOSE_DISAGREE("on_preferences_click_purpose_disagree"), 40 | PREFERENCES_CLICK_CATEGORY_AGREE("on_preferences_click_category_agree"), 41 | PREFERENCES_CLICK_CATEGORY_DISAGREE("on_preferences_click_category_disagree"), 42 | PREFERENCES_CLICK_SAVE_CHOICES("on_preferences_click_save_choices"), 43 | 44 | // Preferences - Vendor 45 | PREFERENCES_CLICK_AGREE_TO_ALL_VENDORS("on_preferences_click_agree_to_all_vendors"), 46 | PREFERENCES_CLICK_DISAGREE_TO_ALL_VENDORS("on_preferences_click_disagree_to_all_vendors"), 47 | PREFERENCES_CLICK_VENDOR_AGREE("on_preferences_click_vendor_agree"), 48 | PREFERENCES_CLICK_VENDOR_DISAGREE("on_preferences_click_vendor_disagree"), 49 | PREFERENCES_CLICK_VENDOR_SAVE_CHOICES("on_preferences_click_vendor_save_choices"), 50 | 51 | // Preferences - Sensitive Personal Information 52 | PREFERENCES_CLICK_SPI_PURPOSE_AGREE("on_preferences_click_spi_purpose_agree"), 53 | PREFERENCES_CLICK_SPI_PURPOSE_DISAGREE("on_preferences_click_spi_purpose_disagree"), 54 | PREFERENCES_CLICK_SPI_CATEGORY_AGREE("on_preferences_click_spi_category_agree"), 55 | PREFERENCES_CLICK_SPI_CATEGORY_DISAGREE("on_preferences_click_spi_category_disagree"), 56 | PREFERENCES_CLICK_SPI_PURPOSE_SAVE_CHOICES("on_preferences_click_spi_purpose_save_choices"), 57 | 58 | // Sync 59 | SYNC_DONE("on_sync_done"), 60 | SYNC_READY("on_sync_ready"), 61 | SYNC_ERROR("on_sync_error"), 62 | 63 | // Language 64 | LANGUAGE_UPDATED("on_language_updated"), 65 | LANGUAGE_UPDATE_FAILED("on_language_update_failed"), 66 | 67 | // Vendor Status 68 | VENDOR_STATUS_CHANGE_PREFIX("on_vendor_status_change_"); 69 | } 70 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /ios/Didomi-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | -------------------------------------------------------------------------------- /ios/Extensions/StringExtension.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension String { 4 | func toJSON() throws -> [String: Any] { 5 | guard let data = self.data(using: .utf8), 6 | let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { 7 | throw NSError(domain: "Didomi", code: 400, userInfo: [NSLocalizedDescriptionKey: "Invalid JSON format"]) 8 | } 9 | return json 10 | } 11 | 12 | func toJSONArray() throws -> [[String: Any]] { 13 | guard let data = self.data(using: .utf8), 14 | let json = try JSONSerialization.jsonObject(with: data, options: []) as? [[String: Any]] else { 15 | throw NSError(domain: "Didomi", code: 400, userInfo: [NSLocalizedDescriptionKey: "Invalid JSON array format"]) 16 | } 17 | return json 18 | } 19 | 20 | func getJSONValue(for key: String) throws -> Any? { 21 | let json = try self.toJSON() 22 | return json[key] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@didomi/react-native", 3 | "version": "2.12.0", 4 | "description": "Didomi React Native SDK", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/index.d.ts", 8 | "react-native": "src/index", 9 | "source": "src/index", 10 | "files": [ 11 | "src", 12 | "lib", 13 | "android", 14 | "ios", 15 | "cpp", 16 | "react-native-didomi.podspec", 17 | "!lib/typescript/sample", 18 | "!lib/typescript/test", 19 | "!android/build", 20 | "!ios/build", 21 | "!**/__tests__", 22 | "!**/__fixtures__", 23 | "!**/__mocks__" 24 | ], 25 | "workspaces": [ 26 | ".", 27 | "sample", 28 | "test" 29 | ], 30 | "scripts": { 31 | "test": "jest", 32 | "typescript": "tsc --noEmit", 33 | "prepare": "bob build", 34 | "pods": "cd test && pod-install --quiet" 35 | }, 36 | "keywords": [ 37 | "react-native", 38 | "ios", 39 | "android" 40 | ], 41 | "repository": { 42 | "type": "git", 43 | "url": "git+https://github.com/didomi/react-native.git" 44 | }, 45 | "author": "Didomi", 46 | "license": "BSD-3", 47 | "homepage": "https://www.didomi.io/", 48 | "publishConfig": { 49 | "registry": "https://registry.npmjs.org/" 50 | }, 51 | "devDependencies": { 52 | "@rnx-kit/metro-config": "^1.3.15", 53 | "@types/jest": "^26.0.0", 54 | "@types/react": "^18.3.3", 55 | "jest": "^29.7.0", 56 | "metro-config": "^0.80.9", 57 | "pod-install": "^0.2.2", 58 | "react": "18.2.0", 59 | "react-native": "0.73.8", 60 | "react-native-builder-bob": "^0.29.1", 61 | "react-native-monorepo-tools": "^1.2.1", 62 | "typescript": "^5.0.4" 63 | }, 64 | "peerDependencies": { 65 | "react": "*", 66 | "react-native": "*" 67 | }, 68 | "jest": { 69 | "preset": "react-native", 70 | "modulePathIgnorePatterns": [ 71 | "/sample/node_modules", 72 | "/test/node_modules", 73 | "/lib/" 74 | ] 75 | }, 76 | "react-native-builder-bob": { 77 | "source": "src", 78 | "output": "lib", 79 | "targets": [ 80 | "commonjs", 81 | "module", 82 | [ 83 | "typescript", 84 | { 85 | "project": "tsconfig.build.json" 86 | } 87 | ] 88 | ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /react-native-didomi.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = "react-native-didomi" 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.homepage = package["homepage"] 10 | s.license = package["license"] 11 | s.authors = package["author"] 12 | 13 | s.platforms = { :ios => "11.0", :tvos => "11.0" } 14 | s.source = { :git => "https://github.com/didomi/react-native.git", :tag => "#{s.version}" } 15 | 16 | s.source_files = "ios/**/*.{h,m,mm,swift}" 17 | 18 | s.dependency "React-Core" 19 | s.dependency "Didomi-XCFramework", "2.25.1" 20 | end 21 | -------------------------------------------------------------------------------- /sample/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /sample/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native', 4 | }; 5 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | **/.xcode.env.local 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | *.hprof 33 | .cxx/ 34 | *.keystore 35 | !debug.keystore 36 | 37 | # node.js 38 | # 39 | node_modules/ 40 | npm-debug.log 41 | yarn-error.log 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | **/fastlane/report.xml 51 | **/fastlane/Preview.html 52 | **/fastlane/screenshots 53 | **/fastlane/test_output 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # Ruby / CocoaPods 59 | **/Pods/ 60 | /vendor/bundle/ 61 | 62 | # Temporary files created by Metro to check the health of the file watcher 63 | .metro-health-check* 64 | 65 | # testing 66 | /coverage 67 | 68 | # Yarn 69 | .yarn/* 70 | !.yarn/patches 71 | !.yarn/plugins 72 | !.yarn/releases 73 | !.yarn/sdks 74 | !.yarn/versions 75 | -------------------------------------------------------------------------------- /sample/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: false, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /sample/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /sample/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | 6 | # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper 7 | # bound in the template on Cocoapods with next React Native release. 8 | gem 'cocoapods', '>= 1.13', '< 1.15' 9 | gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' 10 | -------------------------------------------------------------------------------- /sample/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.7) 5 | base64 6 | nkf 7 | rexml 8 | activesupport (6.1.7.8) 9 | concurrent-ruby (~> 1.0, >= 1.0.2) 10 | i18n (>= 1.6, < 2) 11 | minitest (>= 5.1) 12 | tzinfo (~> 2.0) 13 | zeitwerk (~> 2.3) 14 | addressable (2.8.7) 15 | public_suffix (>= 2.0.2, < 7.0) 16 | algoliasearch (1.27.5) 17 | httpclient (~> 2.8, >= 2.8.3) 18 | json (>= 1.5.1) 19 | atomos (0.1.3) 20 | base64 (0.2.0) 21 | claide (1.1.0) 22 | cocoapods (1.14.3) 23 | addressable (~> 2.8) 24 | claide (>= 1.0.2, < 2.0) 25 | cocoapods-core (= 1.14.3) 26 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 27 | cocoapods-downloader (>= 2.1, < 3.0) 28 | cocoapods-plugins (>= 1.0.0, < 2.0) 29 | cocoapods-search (>= 1.0.0, < 2.0) 30 | cocoapods-trunk (>= 1.6.0, < 2.0) 31 | cocoapods-try (>= 1.1.0, < 2.0) 32 | colored2 (~> 3.1) 33 | escape (~> 0.0.4) 34 | fourflusher (>= 2.3.0, < 3.0) 35 | gh_inspector (~> 1.0) 36 | molinillo (~> 0.8.0) 37 | nap (~> 1.0) 38 | ruby-macho (>= 2.3.0, < 3.0) 39 | xcodeproj (>= 1.23.0, < 2.0) 40 | cocoapods-core (1.14.3) 41 | activesupport (>= 5.0, < 8) 42 | addressable (~> 2.8) 43 | algoliasearch (~> 1.0) 44 | concurrent-ruby (~> 1.1) 45 | fuzzy_match (~> 2.0.4) 46 | nap (~> 1.0) 47 | netrc (~> 0.11) 48 | public_suffix (~> 4.0) 49 | typhoeus (~> 1.0) 50 | cocoapods-deintegrate (1.0.5) 51 | cocoapods-downloader (2.1) 52 | cocoapods-plugins (1.0.0) 53 | nap 54 | cocoapods-search (1.0.1) 55 | cocoapods-trunk (1.6.0) 56 | nap (>= 0.8, < 2.0) 57 | netrc (~> 0.11) 58 | cocoapods-try (1.2.0) 59 | colored2 (3.1.2) 60 | concurrent-ruby (1.3.3) 61 | escape (0.0.4) 62 | ethon (0.16.0) 63 | ffi (>= 1.15.0) 64 | ffi (1.17.0) 65 | fourflusher (2.3.1) 66 | fuzzy_match (2.0.4) 67 | gh_inspector (1.1.3) 68 | httpclient (2.8.3) 69 | i18n (1.14.5) 70 | concurrent-ruby (~> 1.0) 71 | json (2.7.2) 72 | minitest (5.24.1) 73 | molinillo (0.8.0) 74 | nanaimo (0.3.0) 75 | nap (1.1.0) 76 | netrc (0.11.0) 77 | nkf (0.2.0) 78 | public_suffix (4.0.7) 79 | rexml (3.2.9) 80 | strscan 81 | ruby-macho (2.5.1) 82 | strscan (3.1.0) 83 | typhoeus (1.4.1) 84 | ethon (>= 0.9.0) 85 | tzinfo (2.0.6) 86 | concurrent-ruby (~> 1.0) 87 | xcodeproj (1.24.0) 88 | CFPropertyList (>= 2.3.3, < 4.0) 89 | atomos (~> 0.1.3) 90 | claide (>= 1.0.2, < 2.0) 91 | colored2 (~> 3.1) 92 | nanaimo (~> 0.3.0) 93 | rexml (~> 3.2.4) 94 | zeitwerk (2.6.17) 95 | 96 | PLATFORMS 97 | ruby 98 | 99 | DEPENDENCIES 100 | activesupport (>= 6.1.7.5, < 7.1.0) 101 | cocoapods (>= 1.13, < 1.15) 102 | 103 | RUBY VERSION 104 | ruby 2.6.10p210 105 | 106 | BUNDLED WITH 107 | 2.4.10 108 | -------------------------------------------------------------------------------- /sample/README.md: -------------------------------------------------------------------------------- 1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). 2 | 3 | # Getting Started 4 | 5 | >**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding. 6 | 7 | ## Step 1: Start the Metro Server 8 | 9 | First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native. 10 | 11 | To start Metro, run the following command from the _root_ of your React Native project: 12 | 13 | ```bash 14 | # using npm 15 | npm start 16 | 17 | # OR using Yarn 18 | yarn start 19 | ``` 20 | 21 | ## Step 2: Start your Application 22 | 23 | Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app: 24 | 25 | ### For Android 26 | 27 | ```bash 28 | # using npm 29 | npm run android 30 | 31 | # OR using Yarn 32 | yarn android 33 | ``` 34 | 35 | ### For iOS 36 | 37 | ```bash 38 | # using npm 39 | npm run ios 40 | 41 | # OR using Yarn 42 | yarn ios 43 | ``` 44 | 45 | If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly. 46 | 47 | This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively. 48 | 49 | ## Step 3: Modifying your App 50 | 51 | Now that you have successfully run the app, let's modify it. 52 | 53 | 1. Open `App.tsx` in your text editor of choice and edit some lines. 54 | 2. For **Android**: Press the R key twice or select **"Reload"** from the **Developer Menu** (Ctrl + M (on Window and Linux) or Cmd ⌘ + M (on macOS)) to see your changes! 55 | 56 | For **iOS**: Hit Cmd ⌘ + R in your iOS Simulator to reload the app and see your changes! 57 | 58 | ## Congratulations! :tada: 59 | 60 | You've successfully run and modified your React Native App. :partying_face: 61 | 62 | ### Now what? 63 | 64 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). 65 | - If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started). 66 | 67 | # Troubleshooting 68 | 69 | If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. 70 | 71 | # Learn More 72 | 73 | To learn more about React Native, take a look at the following resources: 74 | 75 | - [React Native Website](https://reactnative.dev) - learn more about React Native. 76 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. 77 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. 78 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. 79 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. 80 | -------------------------------------------------------------------------------- /sample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "org.jetbrains.kotlin.android" 3 | apply plugin: "com.facebook.react" 4 | 5 | /** 6 | * This is the configuration block to customize your React Native Android app. 7 | * By default you don't need to apply any configuration, just uncomment the lines you need. 8 | */ 9 | react { 10 | /* Folders */ 11 | // The root of your project, i.e. where "package.json" lives. Default is '..' 12 | // root = file("../") 13 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native 14 | // reactNativeDir = file("../node_modules/react-native") 15 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen 16 | // codegenDir = file("../node_modules/@react-native/codegen") 17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js 18 | // cliFile = file("../node_modules/react-native/cli.js") 19 | 20 | /* Variants */ 21 | // The list of variants to that are debuggable. For those we're going to 22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 24 | // debuggableVariants = ["liteDebug", "prodDebug"] 25 | 26 | /* Bundling */ 27 | // A list containing the node command and its flags. Default is just 'node'. 28 | // nodeExecutableAndArgs = ["node"] 29 | // 30 | // The command to run when bundling. By default is 'bundle' 31 | // bundleCommand = "ram-bundle" 32 | // 33 | // The path to the CLI configuration file. Default is empty. 34 | // bundleConfig = file(../rn-cli.config.js) 35 | // 36 | // The name of the generated asset file containing your JS bundle 37 | // bundleAssetName = "MyApplication.android.bundle" 38 | // 39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 40 | // entryFile = file("../js/MyApplication.android.js") 41 | // 42 | // A list of extra flags to pass to the 'bundle' commands. 43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 44 | // extraPackagerArgs = [] 45 | 46 | /* Hermes Commands */ 47 | // The hermes compiler command to run. By default it is 'hermesc' 48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 49 | // 50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 51 | // hermesFlags = ["-O", "-output-source-map"] 52 | } 53 | 54 | /** 55 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 56 | */ 57 | def enableProguardInReleaseBuilds = false 58 | 59 | /** 60 | * The preferred build flavor of JavaScriptCore (JSC) 61 | * 62 | * For example, to use the international variant, you can use: 63 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 64 | * 65 | * The international variant includes ICU i18n library and necessary data 66 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 67 | * give correct results when using with locales other than en-US. Note that 68 | * this variant is about 6MiB larger per architecture than default. 69 | */ 70 | def jscFlavor = 'org.webkit:android-jsc:+' 71 | 72 | android { 73 | ndkVersion rootProject.ext.ndkVersion 74 | compileSdk rootProject.ext.compileSdkVersion 75 | 76 | namespace "io.didomi.reactnative.sample" 77 | defaultConfig { 78 | applicationId "io.didomi.reactnative.sample" 79 | minSdkVersion rootProject.ext.minSdkVersion 80 | targetSdkVersion rootProject.ext.targetSdkVersion 81 | versionCode 1 82 | versionName "1.0" 83 | } 84 | signingConfigs { 85 | debug { 86 | storeFile file('debug.keystore') 87 | storePassword 'android' 88 | keyAlias 'androiddebugkey' 89 | keyPassword 'android' 90 | } 91 | } 92 | buildTypes { 93 | debug { 94 | signingConfig signingConfigs.debug 95 | } 96 | release { 97 | // Caution! In production, you need to generate your own keystore file. 98 | // see https://reactnative.dev/docs/signed-apk-android. 99 | signingConfig signingConfigs.debug 100 | minifyEnabled enableProguardInReleaseBuilds 101 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 102 | } 103 | } 104 | } 105 | 106 | repositories { 107 | google() 108 | mavenLocal() 109 | mavenCentral() 110 | } 111 | 112 | dependencies { 113 | // The version of react-native is set by the React Native Gradle Plugin 114 | implementation("com.facebook.react:react-android") 115 | 116 | if (hermesEnabled.toBoolean()) { 117 | implementation("com.facebook.react:hermes-android") 118 | } else { 119 | implementation jscFlavor 120 | } 121 | } 122 | 123 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 124 | -------------------------------------------------------------------------------- /sample/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/debug.keystore -------------------------------------------------------------------------------- /sample/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /sample/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /sample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /sample/android/app/src/main/assets/didomi_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": { 3 | "name": "Didomi Sample", 4 | "privacyPolicyURL": "http://www.website.com/privacy", 5 | "vendors": { 6 | "didomi": [ 7 | "google", 8 | "amazon", 9 | "facebook", 10 | "twitter" 11 | ], 12 | "iab": { 13 | "version": 2, 14 | "all": true 15 | } 16 | }, 17 | "gdprAppliesGlobally": true, 18 | "gdprAppliesWhenUnknown": true, 19 | "country": "fr" 20 | }, 21 | "languages": { 22 | "enabled": [ 23 | "fr", 24 | "en", 25 | "es" 26 | ], 27 | "default": "fr" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/android/app/src/main/java/io/didomi/reactnative/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.didomi.reactnative.sample 2 | 3 | import com.facebook.react.ReactActivity 4 | import com.facebook.react.ReactActivityDelegate 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate 7 | 8 | class MainActivity : ReactActivity() { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | override fun getMainComponentName(): String = "sample" 15 | 16 | /** 17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 19 | */ 20 | override fun createReactActivityDelegate(): ReactActivityDelegate = 21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 22 | } 23 | -------------------------------------------------------------------------------- /sample/android/app/src/main/java/io/didomi/reactnative/sample/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package io.didomi.reactnative.sample 2 | 3 | import android.app.Application 4 | import com.facebook.react.* 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 6 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 7 | import com.facebook.react.defaults.DefaultReactNativeHost 8 | import com.facebook.soloader.SoLoader 9 | 10 | class MainApplication : Application(), ReactApplication { 11 | 12 | override val reactNativeHost: ReactNativeHost = 13 | object : DefaultReactNativeHost(this) { 14 | override fun getPackages(): List = 15 | PackageList(this).packages.apply { 16 | // Packages that cannot be autolinked yet can be added manually here, for example: 17 | // add(MyReactNativePackage()) 18 | } 19 | 20 | override fun getJSMainModuleName(): String = "index" 21 | 22 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 23 | 24 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 25 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 26 | } 27 | 28 | override val reactHost: ReactHost 29 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 30 | 31 | override fun onCreate() { 32 | super.onCreate() 33 | SoLoader.init(this, false) 34 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 35 | // If you opted-in for the New Architecture, we load the native entry point for this app. 36 | load() 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sample/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Didomi Sample 3 | 4 | -------------------------------------------------------------------------------- /sample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /sample/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | buildToolsVersion = "34.0.0" 4 | minSdkVersion = 23 5 | compileSdkVersion = 34 6 | targetSdkVersion = 34 7 | ndkVersion = "26.1.10909125" 8 | kotlinVersion = "1.9.22" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /sample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Use this property to specify which architecture you want to build. 28 | # You can also override it from the CLI using 29 | # ./gradlew -PreactNativeArchitectures=x86_64 30 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 31 | 32 | # Use this property to enable support to the new architecture. 33 | # This will allow you to use TurboModules and the Fabric render in 34 | # your application. You should enable this flag either if you want 35 | # to write custom TurboModules/Fabric components OR use libraries that 36 | # are providing them. 37 | newArchEnabled=false 38 | 39 | # Use this property to enable or disable the Hermes JS engine. 40 | # If set to false, you will be using JSC instead. 41 | hermesEnabled=true 42 | -------------------------------------------------------------------------------- /sample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/didomi/react-native/e0db57c4384af5001122e65739be4667d0a9f554/sample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /sample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /sample/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /sample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Didomi Sample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../../node_modules/@react-native/gradle-plugin') 5 | -------------------------------------------------------------------------------- /sample/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "displayName": "Didomi Sample" 4 | } 5 | -------------------------------------------------------------------------------- /sample/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /sample/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import { AppRegistry } from 'react-native'; 6 | import App from './src/App'; 7 | import { name as appName } from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /sample/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | export NODE_BINARY=$(command -v node) 2 | -------------------------------------------------------------------------------- /sample/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Resolve react_native_pods.rb with node to allow for hoisting 2 | require Pod::Executable.execute_command('node', ['-p', 3 | 'require.resolve( 4 | "react-native/scripts/react_native_pods.rb", 5 | {paths: [process.argv[1]]}, 6 | )', __dir__]).strip 7 | 8 | platform :ios, min_ios_version_supported 9 | prepare_react_native_project! 10 | 11 | linkage = ENV['USE_FRAMEWORKS'] 12 | if linkage != nil 13 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 14 | use_frameworks! :linkage => linkage.to_sym 15 | end 16 | 17 | target 'sample' do 18 | config = use_native_modules! 19 | 20 | use_react_native!( 21 | :path => config[:reactNativePath], 22 | # An absolute path to your application root. 23 | :app_path => "#{Pod::Config.instance.installation_root}/.." 24 | ) 25 | 26 | target 'sampleTests' do 27 | inherit! :complete 28 | # Pods for testing 29 | end 30 | 31 | post_install do |installer| 32 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 33 | react_native_post_install( 34 | installer, 35 | config[:reactNativePath], 36 | :mac_catalyst_enabled => false, 37 | # :ccache_enabled => true 38 | ) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /sample/ios/_xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /sample/ios/sample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sample/ios/sample.xcodeproj/xcshareddata/xcschemes/sample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /sample/ios/sample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample/ios/sample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : RCTAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /sample/ios/sample/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | @implementation AppDelegate 6 | 7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 8 | { 9 | self.moduleName = @"sample"; 10 | // You can add your custom initial props in the dictionary below. 11 | // They will be passed down to the ViewController used by React Native. 12 | self.initialProps = @{}; 13 | 14 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 15 | } 16 | 17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 18 | { 19 | return [self bundleURL]; 20 | } 21 | 22 | - (NSURL *)bundleURL 23 | { 24 | #if DEBUG 25 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 26 | #else 27 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 28 | #endif 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /sample/ios/sample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /sample/ios/sample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /sample/ios/sample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Didomi Sample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSAllowsLocalNetworking 32 | 33 | 34 | NSLocationWhenInUseUsageDescription 35 | 36 | UILaunchStoryboardName 37 | LaunchScreen 38 | UIRequiredDeviceCapabilities 39 | 40 | arm64 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIViewControllerBasedStatusBarAppearance 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /sample/ios/sample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /sample/ios/sample/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyAccessedAPIType 9 | NSPrivacyAccessedAPICategoryFileTimestamp 10 | NSPrivacyAccessedAPITypeReasons 11 | 12 | C617.1 13 | 14 | 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryUserDefaults 18 | NSPrivacyAccessedAPITypeReasons 19 | 20 | CA92.1 21 | 22 | 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategorySystemBootTime 26 | NSPrivacyAccessedAPITypeReasons 27 | 28 | 35F9.1 29 | 30 | 31 | 32 | NSPrivacyCollectedDataTypes 33 | 34 | NSPrivacyTracking 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sample/ios/sample/didomi_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": { 3 | "name": "Didomi Sample", 4 | "privacyPolicyURL": "http://www.website.com/privacy", 5 | "vendors": { 6 | "iab": { 7 | "all": true 8 | } 9 | }, 10 | "gdprAppliesGlobally": true, 11 | "gdprAppliesWhenUnknown": true, 12 | "country": "fr" 13 | }, 14 | "languages": { 15 | "enabled": [ 16 | "fr", 17 | "en", 18 | "es" 19 | ], 20 | "default": "en" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sample/ios/sample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /sample/ios/sampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /sample/ios/sampleTests/sampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface sampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation sampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /sample/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /sample/metro.config.js: -------------------------------------------------------------------------------- 1 | const { makeMetroConfig } = require('@rnx-kit/metro-config'); 2 | const { resolveSymlinks, getWorkspaces } = require('react-native-monorepo-tools'); 3 | 4 | module.exports = makeMetroConfig({ 5 | projectRoot: __dirname, 6 | resolver: { 7 | resolveRequest: resolveSymlinks, 8 | }, 9 | watchFolders: getWorkspaces(), 10 | }); 11 | -------------------------------------------------------------------------------- /sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "didomi-sample", 3 | "description": "Sample Application for Didomi SDK", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "android": "react-native run-android", 8 | "ios": "react-native run-ios", 9 | "lint": "eslint .", 10 | "start": "react-native start", 11 | "test": "jest" 12 | }, 13 | "dependencies": { 14 | "@didomi/react-native": "*", 15 | "react": "18.2.0", 16 | "react-native": "0.74.4" 17 | }, 18 | "devDependencies": { 19 | "@babel/core": "^7.20.0", 20 | "@babel/preset-env": "^7.20.0", 21 | "@babel/runtime": "^7.20.0", 22 | "@react-native/babel-preset": "0.74.86", 23 | "@react-native/eslint-config": "0.74.86", 24 | "@react-native/metro-config": "0.74.86", 25 | "@react-native/typescript-config": "0.74.86", 26 | "@rnx-kit/metro-config": "^1.3.15", 27 | "@types/react": "^18.2.6", 28 | "@types/react-test-renderer": "^18.0.0", 29 | "babel-jest": "^29.6.3", 30 | "eslint": "^8.19.0", 31 | "jest": "^29.6.3", 32 | "metro-config": "^0.80.9", 33 | "prettier": "2.8.8", 34 | "react-native-monorepo-tools": "^1.2.1", 35 | "react-test-renderer": "18.2.0", 36 | "typescript": "5.0.4" 37 | }, 38 | "engines": { 39 | "node": ">=18" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /sample/src/GetterCall.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import { Button, StyleSheet, Text, View } from 'react-native'; 3 | 4 | interface GetterCallProps { 5 | name: string; 6 | call: () => any; 7 | test: (result: any) => boolean; 8 | } 9 | 10 | export default function Getter(props: GetterCallProps) { 11 | const [called, setCalled] = useState(false); 12 | const [result, setResult] = useState(null); 13 | 14 | return ( 15 | 16 |