Skip to content

fix(MSDK-3355): Remove stale showCMP and getTCFString bridge declarations#195

Open
uc-christiansousa wants to merge 1 commit intomasterfrom
bugfix/MSDK-3355-remove-stale-mm-declarations
Open

fix(MSDK-3355): Remove stale showCMP and getTCFString bridge declarations#195
uc-christiansousa wants to merge 1 commit intomasterfrom
bugfix/MSDK-3355-remove-stale-mm-declarations

Conversation

@uc-christiansousa
Copy link
Copy Markdown
Collaborator

@uc-christiansousa uc-christiansousa commented Apr 2, 2026

User description

Summary

  • Removed RCT_EXTERN_METHOD declarations for showCMP and getTCFString from RNUsercentricsModule.mm — these had no matching @objc func implementations in RNUsercentricsModule.swift
  • With New Architecture (TurboModules), React Native validates all .mm selectors against the Swift class at startup, producing two WARN messages on every iOS cold start

Test plan

  • Build and run the sample app on iOS with New Architecture enabled
  • Verify no showCMP / getTCFString warnings appear in console during startup
  • Verify showFirstLayer, showSecondLayer, getTCFData and other methods still work correctly

CodeAnt-AI Description

Remove unsupported iOS bridge methods that caused startup warnings

What Changed

  • Removed two bridge declarations that had no matching app behavior behind them
  • iOS apps using the new React Native architecture no longer show startup warnings for these missing methods
  • Existing consent and layer-related actions remain available

Impact

✅ Fewer iOS startup warnings
✅ Cleaner new-architecture app launch
✅ Less noise when checking app logs

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Chores
    • Removed two methods from the module's public interface, making them no longer available for use.

…mm file

These RCT_EXTERN_METHOD entries had no matching @objc func in the Swift
implementation, causing warnings on iOS with New Architecture enabled.
@uc-christiansousa uc-christiansousa self-assigned this Apr 2, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 2, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7b9f9420-72ec-492b-a2f8-df98df4e452e

📥 Commits

Reviewing files that changed from the base of the PR and between 194bc55 and 877d87e.

📒 Files selected for processing (1)
  • ios/RNUsercentricsModule.mm
💤 Files with no reviewable changes (1)
  • ios/RNUsercentricsModule.mm

📝 Walkthrough

Walkthrough

Two React Native bridge methods (showCMP and getTCFString) are removed from the Usercentrics iOS module, eliminating their exposure to JavaScript. This change affects 7 lines of code in a single file with no additions.

Changes

Cohort / File(s) Summary
React Native Bridge Methods
ios/RNUsercentricsModule.mm
Removed two exported promise methods: showCMP and getTCFString. These methods are no longer accessible from JavaScript through the native module interface.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size:M, Review effort 2/5

Suggested reviewers

  • uc-brunosouza
  • islameldesoky95

Poem

🐰 Two methods hop away,
Like carrots in decay,
The bridge grows lean and clean,
No longer to be seen! 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: removing stale bridge declarations for two methods (showCMP and getTCFString) from the iOS module, which directly aligns with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/MSDK-3355-remove-stale-mm-declarations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pantoaibot
Copy link
Copy Markdown

pantoaibot bot commented Apr 2, 2026

PR Summary:

Removed stale iOS bridge exports for showCMP and getTCFString in RNUsercentricsModule.

  • Files changed: ios/RNUsercentricsModule.mm
  • Removed RCT_EXTERN_METHOD declarations:
    • showCMP:(NSDictionary *)dict resolve:reject:
    • getTCFString:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
  • No other methods or dependencies modified.
  • Impact: These native methods are no longer exported to React Native; JS callers will no longer find them. If any JS code still calls showCMP or getTCFString, update the code to remove or replace those calls (or reintroduce native implementations if needed).

Reviewed by Panto AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai bot commented Apr 2, 2026

CodeAnt AI finished reviewing your PR.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Remove stale showCMP and getTCFString bridge declarations

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Removed stale showCMP bridge declaration with no Swift implementation
• Removed stale getTCFString bridge declaration with no Swift implementation
• Eliminates startup warnings in React Native New Architecture
• Maintains all functional consent and layer methods
Diagram
flowchart LR
  A["RNUsercentricsModule.mm<br/>Bridge Declarations"] -->|Remove stale methods| B["showCMP removed"]
  A -->|Remove stale methods| C["getTCFString removed"]
  B --> D["Clean iOS startup<br/>No warnings"]
  C --> D
  A -->|Keep functional| E["showFirstLayer<br/>showSecondLayer<br/>Other methods"]
  E --> D
Loading

Grey Divider

File Changes

1. ios/RNUsercentricsModule.mm 🐞 Bug fix +0/-7

Remove unsupported bridge method declarations

• Removed RCT_EXTERN_METHOD(showCMP:resolve:reject:) declaration (4 lines)
• Removed RCT_EXTERN_METHOD(getTCFString:reject:) declaration (3 lines)
• Eliminated blank lines associated with removed declarations
• All other bridge method declarations remain intact

ios/RNUsercentricsModule.mm


Grey Divider

Qodo Logo

Comment on lines 13 to 15
RCT_EXTERN_METHOD(showFirstLayer:(NSDictionary *)dict
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL_BUG] Removing the RCT_EXTERN_METHOD declarations for showCMP and getTCFString is correct to stop the New Architecture warnings, but this is a breaking change in the native surface. Before merging, search the repo (and downstream consumers) for any runtime calls to RNUsercentricsModule.showCMP or RNUsercentricsModule.getTCFString and either: 1) update the JS/TS public API to remove/deprecate those functions (and update types), or 2) provide a JS shim that maps the old function names to the new implemented methods (if behaviour can be preserved), so existing apps don't crash at runtime. Include a clear deprecation/release note and bump the package version appropriately.

// Example JS shim to preserve backward compatibility
// src/index.ts (public JS/TS surface)

/**
 * @deprecated Use showFirstLayer instead. This shim is kept for backward compatibility
 * and will be removed in a future major version.
 */
export async function showCMP(params: ShowLayerParams): Promise<ShowLayerResult> {
  return showFirstLayer(params);
}

/**
 * @deprecated Use getTCFData instead and extract the encoded string from the
 * returned structure (e.g. `tcfData.tcString`). This shim is kept for
 * backward compatibility and will be removed in a future major version.
 */
export async function getTCFString(): Promise<string | undefined> {
  const tcfData = await RNUsercentricsModule.getTCFData();
  return tcfData?.tcString;
}

@pantoaibot
Copy link
Copy Markdown

pantoaibot bot commented Apr 2, 2026

Reviewed up to commit:877d87e65a3bfeb15396393f04fe8fb518723256

Additional Suggestion
src/__tests__/index.test.ts, line:34 Tests and mocks still reference showCMP (see RN.NativeModules.RNUsercentricsModule mock). Update the jest mock to remove showCMP/getTCFString (or mark them deprecated) to keep tests aligned with the native surface. If you keep a JS shim (see previous suggestion), update tests to reflect the shim behavior instead.
jest.mock("react-native", () => {
    const RN = jest.requireActual("react-native");

    RN.NativeModules.RNUsercentricsModule = {
        configure: jest.fn(),
        isReady: jest.fn(),
        // showCMP: jest.fn(), // removed – no longer part of native surface
        showFirstLayer: jest.fn(),
        restoreUserSession: jest.fn(),
        getControllerId: jest.fn(),
        getABTestingVariant: jest.fn(),
        getConsents: jest.fn(),
        getCMPData: jest.fn(),
        getUserSessionData: jest.fn(),
        getUSPData: jest.fn(),
        getGPPData: jest.fn(),
        getGPPString: jest.fn(),
        getTCFData: jest.fn(),
        getAdditionalConsentModeData: jest.fn(),
        changeLanguage: jest.fn(),
        acceptAll: jest.fn(),
        acceptAllForTCF: jest.fn(),
        // getTCFString: jest.fn(), // removed – no longer part of native surface
    };

    return RN;
});
Others - Run a full iOS build with the New Architecture (TurboModules) enabled and include this in CI. Verify there are no selector validation warnings and exercise the public API (showFirstLayer, showSecondLayer, getTCFData, getControllerId, etc.). Additionally, double-check that every remaining RCT_EXTERN_METHOD here has a corresponding @objc func implementation in RNUsercentricsModule.swift to avoid future selector-mismatch warnings.

Reviewed by Panto AI

@qodo-code-review
Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: test-android

Failed stage: Run SDK Unit Tests [❌]

Failed test name: ""

Failure summary:

The action failed because the Android module :react-native-usercentrics did not compile Kotlin
sources.
- Gradle task :react-native-usercentrics:compileDebugKotlin failed with Kotlin compilation
errors in android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt and
android/src/main/java/com/usercentrics/reactnative/extensions/GppDataExtensions.kt.
- Key errors
include unresolved references (likely missing/changed SDK APIs), such as GppSectionChangePayload,
getDpsMetadata, and onGppSectionChange, plus API/signature mismatches:
-
RNUsercentricsModule.kt:11:42 and :19:75 Unresolved reference 'GppSectionChangePayload'
-
RNUsercentricsModule.kt:90:51 Unresolved reference 'getDpsMetadata'
-
RNUsercentricsModule.kt:94:38 toWritableMap() is not accessible (private in file)
-
RNUsercentricsModule.kt:192:182 Too many arguments for 'denyAllForTCF(...)'
-
GppDataExtensions.kt:7:42, :79:14 Unresolved reference 'GppSectionChangePayload' and related
unresolved members
- Because compilation failed, Gradle exited with code 1, causing the GitHub
Action to fail.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

295:  GRADLE_VERSION: 8.13
296:  JAVA_HOME_17.0.18_x64: /Users/runner/hostedtoolcache/jdk/17.0.18/x64
297:  JAVA_HOME: /Users/runner/hostedtoolcache/jdk/17.0.18/x64
298:  JAVA_HOME_17_0_18_X64: /Users/runner/hostedtoolcache/jdk/17.0.18/x64
299:  ##[endgroup]
300:  Downloading https://services.gradle.org/distributions/gradle-8.13-all.zip
301:  ......................10%......................20%......................30%......................40%......................50%......................60%......................70%.......................80%......................90%......................100%
302:  Welcome to Gradle 8.13!
303:  Here are the highlights of this release:
304:  - Daemon JVM auto-provisioning
305:  - Enhancements for Scala plugin and JUnit testing
306:  - Improvements for build authors and plugin developers
307:  For more details see https://docs.gradle.org/8.13/release-notes.html
308:  Starting a Gradle Daemon (subsequent builds will be faster)
309:  Configuration on demand is an incubating feature.
310:  > Task :gradle-plugin:react-native-gradle-plugin:checkKotlinGradlePluginConfigurationErrors SKIPPED
311:  > Task :gradle-plugin:shared:checkKotlinGradlePluginConfigurationErrors SKIPPED
312:  > Task :gradle-plugin:react-native-gradle-plugin:pluginDescriptors
...

320:  > Task :gradle-plugin:react-native-gradle-plugin:compileJava NO-SOURCE
321:  > Task :gradle-plugin:react-native-gradle-plugin:classes
322:  > Task :gradle-plugin:react-native-gradle-plugin:jar
323:  > Configure project :react-native-usercentrics
324:  WARNING: The option setting 'android.enableResourceOptimizations=false' is deprecated.
325:  The current default is 'true'.
326:  It will be removed in version 9.0 of the Android Gradle plugin.
327:  WARNING: The option setting 'android.defaults.buildfeatures.buildconfig=true' is deprecated.
328:  The current default is 'false'.
329:  It will be removed in version 10.0 of the Android Gradle plugin.
330:  To keep using this feature, add the following to your module-level build.gradle files:
331:  android.buildFeatures.buildConfig = true
332:  or from Android Studio, click: `Refactor` > `Migrate BuildConfig to Gradle Build Files`.
333:  w: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/build.gradle.kts:27:9: 'targetSdk: Int?' is deprecated. Will be removed from library DSL in v9.0. Use testOptions.targetSdk or/and lint.targetSdk instead
334:  w: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/build.gradle.kts:58:15: 'getter for buildDir: File!' is deprecated. Deprecated in Java
335:  > Task :react-native-usercentrics:checkKotlinGradlePluginConfigurationErrors SKIPPED
336:  > Task :react-native-usercentrics:generateCodegenSchemaFromJavaScript
...

355:  > Task :react-native-usercentrics:generateDebugRFile
356:  > Task :react-native-usercentrics:generateReleaseRFile
357:  > Task :react-native-usercentrics:javaPreCompileRelease FROM-CACHE
358:  > Task :react-native-usercentrics:compileDebugKotlin
359:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:11:42 Unresolved reference 'GppSectionChangePayload'.
360:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:19:75 Unresolved reference 'GppSectionChangePayload'.
361:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:90:51 Unresolved reference 'getDpsMetadata'.
362:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:94:38 Cannot access 'fun Map<*, *>.toWritableMap(): WritableMap': it is private in file.
363:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:158:74 Argument type mismatch: actual type is 'Any?', but 'Any' was expected.
364:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:192:182 Too many arguments for 'fun denyAllForTCF(fromLayer: TCFDecisionUILayer, consentType: UsercentricsConsentType, unsavedPurposeLIDecisions: Map<Int, Boolean>? = ...): List<UsercentricsServiceConsent>'.
365:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:263:58 Unresolved reference 'onGppSectionChange'.
366:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/RNUsercentricsModule.kt:263:79 Cannot infer type for this parameter. Specify it explicitly.
367:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/extensions/GppDataExtensions.kt:7:42 Unresolved reference 'GppSectionChangePayload'.
368:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/extensions/GppDataExtensions.kt:79:14 Unresolved reference 'GppSectionChangePayload'.
369:  e: file:///Users/runner/work/react-native-sdk/react-native-sdk/android/src/main/java/com/usercentrics/reactnative/extensions/GppDataExtensions.kt:81:30 Unresolved reference 'data'.
370:  > Task :react-native-usercentrics:compileDebugKotlin FAILED
371:  > Task :react-native-usercentrics:generateDebugUnitTestStubRFile
372:  FAILURE: Build failed with an exception.
373:  26 actionable tasks: 23 executed, 3 from cache
374:  * What went wrong:
375:  Execution failed for task ':react-native-usercentrics:compileDebugKotlin'.
376:  > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
377:  > Compilation error. See log for more details
378:  * Try:
379:  > Run with --stacktrace option to get the stack trace.
380:  > Run with --info or --debug option to get more log output.
381:  > Run with --scan to get full insights.
382:  > Get more help at https://help.gradle.org.
383:  BUILD FAILED in 6m 43s
384:  ##[error]Process completed with exit code 1.
385:  ##[group]Run actions/upload-artifact@v4

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