Skip to content

Commit 375373c

Browse files
Update new architecture support (#180)
* Update new architecture support * override + old-arch stubs in DidomiModule.kt and DidomiModuleSpec.kt * forward-declare the Didomi interface inheriting from RCTEventEmitter (matching what Swift exposes) * Bump native SDK dependencies to 2.43.0 * Register codegen library for Android autolinking Adds libraryName 'RNDidomiSpec' so the new-arch autolinker includes the codegen-generated JNI module in the host app's autolinking.cpp. Without this, TurboModuleRegistry.getEnforcing('Didomi') fails at JS load time even though DidomiPackage registers the module correctly on the Java side. * Use double for numeric TurboModule arguments on iOS The codegen-generated TurboModule binding treats JS numbers as C double; declaring Swift parameters as Int/UInt8 (and Obj-C as (int)) causes an NSInvalidArgumentException ('-[__NSCFNumber localizedDescription]: unrecognized selector') when the bridge invokes the method. Affects syncAcknowledged, removeSyncAcknowledgedCallback, and setLogLevel. * Patch fmt v9 in post_install for Xcode 26 / Clang 21 Xcode 26 ships Apple Clang 21, which enforces consteval more strictly and rejects fmt v9's FMT_STRING macro (used throughout React Native's bundled fmt pod). fmt's own version detection only disables consteval for Apple Clang < 14; widen that check to all Apple Clang versions when pod install runs. * update gh actions (deprecation warnings)
1 parent be8567f commit 375373c

20 files changed

Lines changed: 733 additions & 126 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/checkout@v6
2626

2727
- name: Cache Node dependencies
28-
uses: actions/cache@v4
28+
uses: actions/cache@v5
2929
with:
3030
path: ~/.npm
3131
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
node-version: 20
2626

2727
- name: Cache Node dependencies
28-
uses: actions/cache@v4
28+
uses: actions/cache@v5
2929
with:
3030
path: ~/.npm
3131
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -61,7 +61,7 @@ jobs:
6161
node-version: 20
6262

6363
- name: Cache Node dependencies
64-
uses: actions/cache@v4
64+
uses: actions/cache@v5
6565
with:
6666
path: ~/.npm
6767
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -72,13 +72,13 @@ jobs:
7272
run: npm install
7373

7474
- name: Cache Gradle Wrapper
75-
uses: actions/cache@v4
75+
uses: actions/cache@v5
7676
with:
7777
path: ~/.gradle/wrapper
7878
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
7979

8080
- name: Cache Gradle Dependencies
81-
uses: actions/cache@v4
81+
uses: actions/cache@v5
8282
with:
8383
path: ~/.gradle/caches
8484
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
@@ -94,7 +94,7 @@ jobs:
9494
cd android && ./gradlew assembleDebug --no-daemon
9595
9696
- name: Upload Android App APK
97-
uses: actions/upload-artifact@v5
97+
uses: actions/upload-artifact@v7
9898
with:
9999
name: app-debug.apk
100100
path: test/android/app/build/outputs/apk/debug/app-debug.apk
@@ -104,7 +104,7 @@ jobs:
104104
cd android && ./gradlew :app:assembleDebugAndroidTest --no-daemon
105105
106106
- name: Upload Android Test APK
107-
uses: actions/upload-artifact@v5
107+
uses: actions/upload-artifact@v7
108108
with:
109109
name: app-debug-androidTest.apk
110110
path: test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
@@ -116,7 +116,7 @@ jobs:
116116
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
117117

118118
- name: Setup Cloud SDK
119-
uses: google-github-actions/setup-gcloud@v2
119+
uses: google-github-actions/setup-gcloud@v3
120120
with:
121121
project_id: ${{ secrets.FIREBASE_PROJECT_ID }}
122122
install_components: 'beta'
@@ -153,7 +153,7 @@ jobs:
153153
registry-url: 'https://registry.npmjs.org'
154154

155155
- name: Cache Node dependencies
156-
uses: actions/cache@v4
156+
uses: actions/cache@v5
157157
with:
158158
path: ~/.npm
159159
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -179,7 +179,7 @@ jobs:
179179
# Archive Result if failure
180180
- name: Archive iOS artifacts
181181
if: ${{ failure() }}
182-
uses: actions/upload-artifact@v5
182+
uses: actions/upload-artifact@v7
183183
with:
184184
name: ios-test-results
185185
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
node-version: 20
2626

2727
- name: Cache Node dependencies
28-
uses: actions/cache@v4
28+
uses: actions/cache@v5
2929
with:
3030
path: ~/.npm
3131
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Install dependencies
3636
run: npm install
37-
37+
3838
- name: Run JS tests
3939
run: npm test
4040

@@ -61,7 +61,7 @@ jobs:
6161
node-version: 20
6262

6363
- name: Cache Node dependencies
64-
uses: actions/cache@v4
64+
uses: actions/cache@v5
6565
with:
6666
path: ~/.npm
6767
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -72,13 +72,13 @@ jobs:
7272
run: npm install
7373

7474
- name: Cache Gradle Wrapper
75-
uses: actions/cache@v4
75+
uses: actions/cache@v5
7676
with:
7777
path: ~/.gradle/wrapper
7878
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
7979

8080
- name: Cache Gradle Dependencies
81-
uses: actions/cache@v4
81+
uses: actions/cache@v5
8282
with:
8383
path: ~/.gradle/caches
8484
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
@@ -94,7 +94,7 @@ jobs:
9494
cd android && ./gradlew assembleDebug --no-daemon
9595
9696
- name: Upload Android App APK
97-
uses: actions/upload-artifact@v5
97+
uses: actions/upload-artifact@v7
9898
with:
9999
name: app-debug.apk
100100
path: test/android/app/build/outputs/apk/debug/app-debug.apk
@@ -104,7 +104,7 @@ jobs:
104104
cd android && ./gradlew :app:assembleDebugAndroidTest --no-daemon
105105
106106
- name: Upload Android Test APK
107-
uses: actions/upload-artifact@v5
107+
uses: actions/upload-artifact@v7
108108
with:
109109
name: app-debug-androidTest.apk
110110
path: test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
@@ -116,7 +116,7 @@ jobs:
116116
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
117117

118118
- name: Setup Cloud SDK
119-
uses: google-github-actions/setup-gcloud@v2
119+
uses: google-github-actions/setup-gcloud@v3
120120
with:
121121
project_id: ${{ secrets.FIREBASE_PROJECT_ID }}
122122
install_components: 'beta'
@@ -153,7 +153,7 @@ jobs:
153153
registry-url: 'https://registry.npmjs.org'
154154

155155
- name: Cache Node dependencies
156-
uses: actions/cache@v4
156+
uses: actions/cache@v5
157157
with:
158158
path: ~/.npm
159159
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -182,7 +182,7 @@ jobs:
182182
# Archive Result if failure
183183
- name: Archive iOS artifacts
184184
if: ${{ failure() }}
185-
uses: actions/upload-artifact@v5
185+
uses: actions/upload-artifact@v7
186186
with:
187187
name: ios-test-results
188188
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/*.xcresult

android/build.gradle

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ buildscript {
1717

1818
apply plugin: "com.android.library"
1919
apply plugin: "kotlin-android"
20+
apply plugin: "com.facebook.react"
2021

2122
def getExtOrDefault(name) {
2223
return project.properties["Didomi_" + name].toString()
@@ -26,19 +27,39 @@ def getExtOrIntegerDefault(name) {
2627
return project.properties["Didomi_" + name].toInteger()
2728
}
2829

30+
def isNewArchitectureEnabled() {
31+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
32+
}
33+
2934
def parsedPackage = new JsonSlurper().parseText(file("../package.json").text)
3035

3136
android {
3237
compileSdk getExtOrIntegerDefault("compileSdkVersion")
3338
namespace "io.didomi.reactnative"
34-
39+
3540
defaultConfig {
3641
minSdk getExtOrIntegerDefault("minSdkVersion")
3742
targetSdk getExtOrIntegerDefault("targetSdkVersion")
3843
versionCode 1
3944
versionName "${parsedPackage.version}"
4045

4146
multiDexEnabled = true
47+
48+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
49+
}
50+
51+
buildFeatures {
52+
buildConfig = true
53+
}
54+
55+
sourceSets {
56+
main {
57+
if (isNewArchitectureEnabled()) {
58+
java.srcDirs += ['src/newarch/java']
59+
} else {
60+
java.srcDirs += ['src/oldarch/java']
61+
}
62+
}
4263
}
4364

4465
buildTypes {
@@ -60,6 +81,12 @@ android {
6081

6182
}
6283

84+
react {
85+
jsRootDir = file("../src/specs")
86+
libraryName = "RNDidomiSpec"
87+
codegenJavaPackageName = "io.didomi.reactnative"
88+
}
89+
6390
repositories {
6491
google()
6592
mavenLocal()
@@ -131,5 +158,5 @@ dependencies {
131158
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
132159

133160
implementation("com.google.code.gson:gson:2.13.1")
134-
implementation "io.didomi.sdk:android:2.42.0"
161+
implementation "io.didomi.sdk:android:2.43.0"
135162
}

0 commit comments

Comments
 (0)