Update new architecture support#180
Open
nicolas-chaix-didomi wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrating the Didomi RN SDK to TurboModule with backward compat; spec, codegen config, podspec, Android build/package/module, iOS shim, and JS imports are all done and tsc/jest/bob build pass. Next: run pod install and a Gradle build in /test to confirm codegen wires up correctly.
JS / TypeScript
src/specs/NativeDidomi.ts— codegen TurboModule spec covering 65 methods, with the JSON-string-as-string contract preserved so call sites don't change.src/Didomi.tsandsrc/DidomiListener.tsto import the spec viaTurboModuleRegistry.getEnforcing<Spec>('Didomi'). The interop fallback handles old-arch consumers transparently.DidomiListener.test.tsso unit tests don't try to resolve the native module.Package config
codegenConfigblock topackage.json(nameRNDidomiSpec,jsSrcsDir src/specs,javaPackageName io.didomi.reactnative).iOS
ios/RNDidomi+TurboModule.mm— ObjC++ category on Didomi that conforms toNativeDidomiSpecand vends aNativeDidomiSpecJSI, guarded by#ifdef RCT_NEW_ARCH_ENABLED.react-native-didomi.podspecnow uses install_modules_dependencies(s) instead of a manual React-Core dep — picks up codegen, TurboModule core, and Folly automatically.RNDidomi.swiftand registeredisError+isUserConsentStatusPartialinios/Didomi.m(the iOS side was missing these — Android had them already).Android
android/build.gradle: applied com.facebook.react plugin, added react { jsRootDir, libraryName, codegenJavaPackageName },BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, and a sourceSets split between src/oldarch and src/newarch.DidomiPackage.kt: switched fromReactPackagetoTurboReactPackagewith aReactModuleInfoProviderdriven byBuildConfig.IS_NEW_ARCHITECTURE_ENABLED.DidomiModuleSpec.ktin both oldarch (extends ReactContextBaseJavaModule) and newarch (extends generated NativeDidomiSpec). DidomiModule now extends DidomiModuleSpec.setLogLevel,syncAcknowledged,removeSyncAcknowledgedCallback, both*WithExpirationsetters, andremoveListenersto match codegen's number → Double mapping; narrowed inside method bodies.forceShowNotice,isUserLegitimateInterestStatusPartial, andsetUserConsentStatuson Android (missing from the original module).listenToVendorStatus/stopListeningToVendorStatusreturn Promise.