feat: derive Google Ads consent from a TCF CMP [LIN-2078] - #39
Open
Shofiya2003 wants to merge 1 commit into
Open
feat: derive Google Ads consent from a TCF CMP [LIN-2078]#39Shofiya2003 wants to merge 1 commit into
Shofiya2003 wants to merge 1 commit into
Conversation
Adds enableTCFConsentCollection to the Flutter SDK, matching the native iOS SDK and the React Native wrapper. Apps using an IAB TCF v2.2/v2.3 Consent Management Platform can now let the SDK read the CMP's IABTCF_* keys instead of mirroring every consent change through setConsent by hand. Anything set explicitly with setConsent still wins, per signal, so an app can let the CMP supply most of the state and override one field. iOS only. The native Android SDK has no TCF support, so the Android side of the plugin has no handler for this method and reaching it would throw MissingPluginException in the caller's app. The Dart layer returns early on any non-iOS platform, which is what the React Native wrapper does with Platform.OS, rather than adding a no-op handler that would imply Android support. The iOS handler is deliberately not gated on isInitialized: the flag is meant to be set before init so the first payload already carries the CMP's values, and the native SDK resolves consent per payload rather than snapshotting it. Version 4.2.0 (new public API), with pubspec.yaml, the podspec and the hardcoded packageVersion kept in step. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds an opt-in iOS TCF consent-collection API, forwards the setting through Flutter and the native method channel, validates native arguments, adds platform-specific tests, and updates package versions and changelog documentation. ChangesTCF consent collection
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant FlutterApp
participant LinkRunner
participant MethodChannel
participant SwiftLinkrunnerPlugin
participant LinkrunnerSDK
FlutterApp->>LinkRunner: enableTCFConsentCollection(enabled)
LinkRunner->>MethodChannel: Invoke native method
MethodChannel->>SwiftLinkrunnerPlugin: Pass enabled argument
SwiftLinkrunnerPlugin->>LinkrunnerSDK: Enable or disable TCF collection
SwiftLinkrunnerPlugin-->>FlutterApp: Return success
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
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.
Adds
enableTCFConsentCollectionto the Flutter SDK, matching the native iOS SDK and the React Native wrapper. Apps using an IAB TCF v2.2/v2.3 Consent Management Platform can let the SDK read the CMP'sIABTCF_*keys instead of mirroring every consent change throughsetConsentby hand. Anything set explicitly withsetConsentstill wins, per signal, so an app can let the CMP supply most of the state and override one field.iOS only, and why the gate is in Dart
The native Android SDK has no TCF support, so the Android side of the plugin has no handler for this method. Reaching it would throw
MissingPluginExceptionin the caller's app, which the existingon PlatformExceptioncatch would not swallow. The Dart layer returns early on any non-iOS platform, which is what the React Native wrapper does withPlatform.OS. A no-op Android handler was the alternative, but it would imply Android support that does not exist.The iOS handler is deliberately not gated on
isInitialized. The flag is meant to be set beforeinitso the first payload already carries the CMP's values, andLinkrunnerKitresolves consent per payload rather than snapshotting it at init.Changes
lib/linkrunner.dart: publicenableTCFConsentCollection([bool enabled = true])with the platform gatelib/linkrunner_native_bridge.dart: method channel callios/Classes/SwiftLinkrunnerPlugin.swift:enableTCFConsentCollectioncase and handlertest/tcf_consent_collection_test.dart: covers the forwarded flag, the default, the disable path, and that Android sends nothingpubspec.yaml, the podspec and the hardcodedpackageVersionTesting
flutter testpasses (6 tests).flutter analyzereports only the 15 pre-existingconstant_identifier_namesinfos inlr_capture_payment.dartandlr_consent.dart, none from the changed files.Follow-up
The public docs list Flutter as
setConsentonly. That page should be updated once 4.2.0 is published to pub.dev.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation