Skip to content

Update new architecture support#180

Open
nicolas-chaix-didomi wants to merge 3 commits into
mainfrom
chore/new-arch-support
Open

Update new architecture support#180
nicolas-chaix-didomi wants to merge 3 commits into
mainfrom
chore/new-arch-support

Conversation

@nicolas-chaix-didomi
Copy link
Copy Markdown
Contributor

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

  • Added src/specs/NativeDidomi.ts — codegen TurboModule spec covering 65 methods, with the JSON-string-as-string contract preserved so call sites don't change.
  • Switched src/Didomi.ts and src/DidomiListener.ts to import the spec via TurboModuleRegistry.getEnforcing<Spec>('Didomi'). The interop fallback handles old-arch consumers transparently.
  • Added Jest mock for the spec in DidomiListener.test.ts so unit tests don't try to resolve the native module.

Package config

  • Added codegenConfig block to package.json (name RNDidomiSpec, jsSrcsDir src/specs, javaPackageName io.didomi.reactnative).

iOS

  • Created ios/RNDidomi+TurboModule.mm — ObjC++ category on Didomi that conforms to NativeDidomiSpec and vends a NativeDidomiSpecJSI, guarded by #ifdef RCT_NEW_ARCH_ENABLED.
  • react-native-didomi.podspec now uses install_modules_dependencies(s) instead of a manual React-Core dep — picks up codegen, TurboModule core, and Folly automatically.
  • Added isError to RNDidomi.swift and registered isError + isUserConsentStatusPartial in ios/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 from ReactPackage to TurboReactPackage with a ReactModuleInfoProvider driven by BuildConfig.IS_NEW_ARCHITECTURE_ENABLED.
  • Created DidomiModuleSpec.kt in both oldarch (extends ReactContextBaseJavaModule) and newarch (extends generated NativeDidomiSpec). DidomiModule now extends DidomiModuleSpec.
  • Widened Int → Double on setLogLevel, syncAcknowledged, removeSyncAcknowledgedCallback, both *WithExpiration setters, and removeListeners to match codegen's number → Double mapping; narrowed inside method bodies.
  • Added forceShowNotice, isUserLegitimateInterestStatusPartial, and setUserConsentStatus on Android (missing from the original module).
  • Added NAME companion constant and made listenToVendorStatus/stopListeningToVendorStatus return Promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant