fix(MSDK-3355): Remove stale showCMP and getTCFString bridge declarations#195
fix(MSDK-3355): Remove stale showCMP and getTCFString bridge declarations#195uc-christiansousa wants to merge 1 commit intomasterfrom
Conversation
…mm file These RCT_EXTERN_METHOD entries had no matching @objc func in the Swift implementation, causing warnings on iOS with New Architecture enabled.
|
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 · |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughTwo React Native bridge methods ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
PR Summary: Removed stale iOS bridge exports for showCMP and getTCFString in RNUsercentricsModule.
|
|
CodeAnt AI finished reviewing your PR. |
Review Summary by QodoRemove stale showCMP and getTCFString bridge declarations
WalkthroughsDescription• 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 Diagramflowchart 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
File Changes1. ios/RNUsercentricsModule.mm
|
| RCT_EXTERN_METHOD(showFirstLayer:(NSDictionary *)dict | ||
| resolve:(RCTPromiseResolveBlock)resolve | ||
| reject:(RCTPromiseRejectBlock)reject) |
There was a problem hiding this comment.
[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;
}|
Reviewed up to commit:877d87e65a3bfeb15396393f04fe8fb518723256 Additional Suggestionsrc/__tests__/index.test.ts, line:34Tests 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. |
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
User description
Summary
Test plan
CodeAnt-AI Description
Remove unsupported iOS bridge methods that caused startup warnings
What Changed
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:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
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:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
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