Repository navigation
feat: Expose widgets APIs - #128
Merged
Merged
Conversation
Bridge the native widget APIs to Unity: - ShowWidget(parameters?) with optional widget ID and layer name, the widget is selected by the Rules Engine when no ID is provided - HideWidget() - IsWidgetVisible(widgetId?) Add the DidomiWidgetParameters class and the Unity Editor stubs. On Android, show/hide run on the UI thread since the native SDK drives a WebView.
Cover the behavior when no widget is configured: show and hide are ignored, no widget event is triggered and IsWidgetVisible returns false.
- Ignore Unity test runner scenes, gradle template backups and the downloaded Didomi.xcframework in source/.gitignore, after the rule that re-includes .meta files so their .meta files are ignored too - Ignore .utmp, *.slnx, source/artifacts and packages-lock.json
andresilveirah
approved these changes
Oct 7, 2026
The native SDK already handles threading for showWidget and hideWidget: hiding posts the JavaScript to the main looper and showing commits a fragment, like showNotice. Drop the UI thread helper and call the native methods directly like ShowNotice and ShowPreferences, so a not-ready exception reaches the caller instead of only being logged.
pmerlet-at-didomi
approved these changes
Oct 8, 2026
pmerlet-at-didomi
approved these changes
Oct 8, 2026
pmerlet-at-didomi
approved these changes
Oct 9, 2026
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.
Summary
Expose the native
widgets.*APIs to Unity apps (CMP-7004), mirroring the React Native bridge (CMP-7002).ShowWidget(DidomiWidgetParameters parameters = null): optional widget ID and layer name; when omitted, the widget and layer are selected by the Rules EngineHideWidget()IsWidgetVisible(string widgetId = null): when no ID is given, any displayed widget matchesThe
ShowWidget/HideWidgetevents were already bridged.Implementation notes
ShowNotice/ShowPreferences. The native SDK already handles threading (the JavaScript is posted to the main looper, the widget host is a fragment commit).DidomiNotReadyExceptionto the caller instead, like the other methods. This is documented onShowWidget..gitignore: ignore Unity test runner scenes, gradle template backups, the downloadedDidomi.xcframework,.utmp,*.slnxandsource/artifacts.Tests
WidgetsTestsSuitecovers the no-widget case with the test notice: show/hide are ignored, no widget event is triggered andIsWidgetVisiblereturns false. Testing a displayed widget would need a notice with widgets and Web SDK rendering enabled.AAABeforeSDKInitTestsSuite.TestSyncBeforeInit, which depends on a backend sync response and doesn't touch this code.