Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0908370
chore: add version catalogs
uc-brunosouza Aug 10, 2025
991456d
chore: centralize java versions
uc-brunosouza Aug 10, 2025
1ed9d17
chore: update gradle plugin
uc-brunosouza Aug 10, 2025
47fda20
chore: remove namespace
uc-brunosouza Aug 11, 2025
8b5e101
chore: update project versions
uc-brunosouza Aug 11, 2025
7dc713f
chore: create patch versions
uc-brunosouza Aug 11, 2025
74efff3
chore: update patches
uc-brunosouza Aug 11, 2025
b6d6089
chore: update libraries version
uc-brunosouza Aug 11, 2025
40e57ad
chore: update gradle version
uc-brunosouza Aug 11, 2025
e7774c2
chore: delete patch
uc-brunosouza Aug 11, 2025
6c23d07
fix: android versions
uc-brunosouza Aug 11, 2025
491f776
chore: bump react native version
uc-brunosouza Aug 11, 2025
3cce3da
chore: update signature in MainApplication.kt
uc-brunosouza Aug 11, 2025
6f54776
chore: equalize android versions
uc-brunosouza Aug 11, 2025
7cb3dd9
chore: update patches
uc-brunosouza Aug 11, 2025
2ee4a3a
chore: update metro.config.js and babel.config.js
uc-brunosouza Aug 11, 2025
563b023
chore: update gradle scripts
uc-brunosouza Aug 11, 2025
f5c72fc
chore: add script clean-all-caches.sh
uc-brunosouza Aug 11, 2025
5a75d43
chore: add script install-dependencies.sh and run-android.sh
uc-brunosouza Aug 11, 2025
4e0c18c
chore: update README.md
uc-brunosouza Aug 11, 2025
367539d
chore: remove unnecessary parameter at script
uc-brunosouza Aug 11, 2025
7c2f4f6
chore: enable flipper
uc-brunosouza Aug 11, 2025
6c636eb
chore: improve scrip clean-all-caches.sh
uc-brunosouza Aug 11, 2025
1bef4ee
backup: Estado atual antes da atualização RN 0.74.3 -> 0.81.0
uc-brunosouza Aug 14, 2025
8a38fcd
fabric, new architecture enabled with centralized versions
uc-brunosouza Aug 14, 2025
4234ff2
chore: fix react native imports
uc-brunosouza Aug 14, 2025
23ad132
fix: webview integrations
uc-brunosouza Aug 14, 2025
b395712
feat: Enable new architecture
uc-brunosouza Aug 18, 2025
1468217
chore: add autolinking task generation
uc-brunosouza Aug 18, 2025
bba8b9e
chore: adjust android script
uc-brunosouza Aug 18, 2025
a2f1ec7
chore: adjust script messages
uc-brunosouza Aug 18, 2025
72db999
chore: update scripts
uc-brunosouza Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 103 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,36 @@ The Usercentrics Apps SDK is a native Consent Management Platform solution for m
<img src="https://docs.usercentrics.com/cmp_in_app_sdk/latest/assets/media/predefinedUI.png" alt="Usercentrics UI" />
</p>

### Requirements
* Android 5.0 (API 21) or higher with Kotlin 1.5 or higher
* iOS 11 or higher
* React 17.0 or higher
* React Native 0.65 or higher
* Node 14
## 📋 Requirements

### Mobile Platforms
* **Android 5.0 (API 21)** or higher
* **iOS 11** or higher

### Development Environment
* **Node.js 18.0+** (LTS recommended)
* **npm 9.0+** or **Yarn 1.22+**
* **TypeScript 5.1+**
* **React 18.2+**
* **React Native 0.74.3+** (with Fabric support)

### Android Development
* **Java 17+** (OpenJDK or Oracle JDK)
* **Android SDK** with API 33+ platforms
* **Android NDK 25+**
* **Gradle 8.2+**
* **Kotlin 1.9.22+**
* **Android Gradle Plugin 8.2+**

### iOS Development (macOS only)
* **Xcode 15.0+** with iOS SDK
* **CocoaPods 1.12+**
* **iOS Simulators** (recommended)

### Optional but Recommended
* **Watchman** (for better file watching)
* **Git** (for version control)
* **SDKMan** (for Java version management)

## Get started!

Expand All @@ -41,35 +65,92 @@ Continue to our [documentation](https://usercentrics.com/docs/apps/intro/) for a

See the [example](https://github.com/Usercentrics/react-native/tree/master/example) directory for a complete sample app using Usercentrics.

## Sample Project
## Quick Start

To run the sample project, you will need to run npm install from both root and example folders:
### 🚀 Automated Setup (Recommended)

The easiest way to get started is using our automated setup script:

```sh
# Check your development environment
npm run check-requirements

# Automatically install missing dependencies
npm run auto-setup

# Verify everything is ready
npm run check-requirements
```

### 📱 Running the Sample Project

### Option 1: Using Helper Scripts
```sh
# Install all dependencies
npm run install-dependencies

# Run Android app
npm run run-android

# Run iOS app (macOS only)
npm run ios
```

### Option 2: Manual Setup
* From root folder:
```sh
npm install
npm install --legacy-peer-deps
```
* From example folder:
```sh
npm install
npm install --legacy-peer-deps
```

### iOS
### iOS (macOS only)

From example folder:
```sh
npx pod-install
npx react-native run-ios
```
From example folder:
```sh
npx pod-install
npx react-native run-ios
```

### Android
### Android

Open the android folder using Android Studio in order to create essential files then run from example folder:
```sh
npx react-native run-android
```
Make sure you have Android SDK configured, then from example folder:
```sh
npx react-native run-android
```

## 🛠️ Development Scripts

| Script | Description |
|--------|-------------|
| `npm run auto-setup` | 🤖 Automatically install all required dependencies |
| `npm run check-requirements` | 🔍 Check development environment requirements |
| `npm run clean-all-caches` | 🧹 Clean all project and system caches |
| `npm run install-dependencies` | 📦 Install dependencies in root and example folders |
| `npm run run-android` | 🤖 Kill conflicting ports and run Android app |

### 🔧 Troubleshooting

If you encounter issues:

1. **Check Requirements**: `npm run check-requirements`
2. **Clean & Reinstall**: `npm run clean-all-caches && npm run install-dependencies`
3. **Auto Setup**: `npm run auto-setup` (installs missing tools)
4. **Manual Setup**: Follow the detailed error messages from check-requirements

### 📋 Environment Setup

The project includes intelligent scripts that will:
- ✅ Detect your operating system (macOS/Linux)
- ✅ Check for required tools and versions
- ✅ Install missing dependencies automatically
- ✅ Configure environment variables
- ✅ Apply necessary patches
- ✅ Verify the setup works correctly

### Consent Mediation
## Consent Mediation

You can enable and run the Consent Mediation example in this example by following the [documentation](https://usercentrics.com/docs/apps/features/consent-mediation/#enable-mediation).

Expand Down
49 changes: 31 additions & 18 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
def usercentrics_version = "2.21.1"
version usercentrics_version

buildscript {
ext.kotlin_version = '1.8.0'

ext.safeExtGet = { prop, fallback ->
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
Expand All @@ -14,8 +9,9 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath(libs.gradle.plugin)
classpath(libs.kotlin.plugin)
classpath(libs.react.native.plugin)
}
}

Expand All @@ -26,20 +22,37 @@ def safeExtGet(prop, fallback) {
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

// Apply React Native CodeGen
if (findProject(':ReactAndroid') != null) {
apply plugin: 'com.facebook.react'

react {
codegenDir = file("${rootDir}/../node_modules/react-native-codegen")
reactNativeDir = file("${rootDir}/../node_modules/react-native")
jsRootDir = file("${rootDir}/../src")
}
}

android {
compileSdkVersion 32
namespace 'com.usercentrics.reactnative'
compileSdkVersion libs.versions.compile.sdk.get().toInteger()

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

kotlinOptions {
jvmTarget = libs.versions.jvm.target.get()
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
minSdkVersion 21
minSdkVersion libs.versions.min.sdk.get().toInteger()
targetSdkVersion libs.versions.target.sdk.get().toInteger()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFile "proguard-rules.pro"
}
Expand All @@ -52,13 +65,13 @@ repositories {

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
implementation libs.react.native
// Usercentrics
implementation "com.usercentrics.sdk:usercentrics-ui:$usercentrics_version"
implementation libs.usercentrics.ui

androidTestImplementation 'io.mockk:mockk-android:1.12.0'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation libs.mockk.android
androidTestImplementation libs.junit
androidTestImplementation libs.androidx.junit.ktx
androidTestImplementation libs.androidx.test.runner
androidTestImplementation libs.androidx.test.rules
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 20 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
rootProject.name = 'usercentrics'

pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
//apply(from = file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"))
includeBuild("../node_modules/@react-native/gradle-plugin")


3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.usercentrics.reactnativeusercentrics"></manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"/>
Loading