Repository navigation
Expose showWidget, hideWidget and isWidgetVisible - #192
Open
nicolas-chaix-didomi wants to merge 6 commits into
Open
nicolas-chaix-didomi wants to merge 6 commits into
nicolas-chaix-didomi wants to merge 6 commits into
Conversation
Bridge the native widget APIs available since Didomi SDK 2.47.0/2.50.0: - showWidget(parameters?) with optional widgetId and layerName, the widget is selected by the Rules Engine when no ID is provided - hideWidget() - isWidgetVisible(widgetId?) Add the DidomiWidgetParameters type, the old architecture stubs and Jest tests.
Add showWidget, hideWidget and isWidgetVisible calls to the test app and an "Initialize widget notice" button using a local configuration with widgets (didomi_config_widgets.json) so the tests do not depend on geolocation. The UI tests only check the on_show_widget event for now: the native SDKs currently hide and show the widget again after a single showWidget call, which breaks isWidgetVisible and hideWidget.
nicolas-chaix-didomi
force-pushed
the
feat/7002-widget-apis
branch
from
October 7, 2026 14:39
d1b1998 to
dd54491
Compare
andresilveirah
approved these changes
Oct 7, 2026
UiThreadUtil.runOnUiThread posts the block, so exceptions thrown inside it (e.g. DidomiNotReadyException when called before the SDK is ready) escaped the surrounding try/catch and crashed the app on the UI thread, after the promise had already been resolved. The try/catch and the promise resolution now run inside the UI thread block for setupUI, showNotice, forceShowNotice, showPreferences, showWidget and hideWidget.
pmerlet-at-didomi
approved these changes
Oct 8, 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.
CMP-7002
showWidget({ widgetId?, layerName? }),hideWidget()andisWidgetVisible(widgetId?)to the RN bridge, mirroring the native iOS/Android APIs (available since 2.47.0 / 2.50.0). Without awidgetId, the widget is selected by the Rules Engine.DidomiWidgetParameterstype, add the old architecture stubs and Jest tests.SHOW_WIDGETis emitted for each layer of a widget: navigating inside the same widget (e.g.notice→purposes→ back) emitson_show_widgetagain with the newlayerName, withouton_hide_widgetin between. The widget is closed only onon_hide_widget.didomi_config_widgets.json), so tests don't depend on geolocation. Add iOS/Android UI tests asserting theon_show_widgetevent.Note: the UI tests only check the show event for now. With the current native SDKs, a single
showWidgetcall leads to a shown → hidden → shown sequence from the Web SDK. On iOS,isWidgetVisiblethen returnsfalsewhile the widget is displayed andhideWidgetends withon_show_notice. On Android, the second show fails withandroidInterface.onWidgetShown is not a function.The fixes are in progress:
fix/ignore-widget-events-during-initfix/widget-host-webview-cachingfix/widget-host-show-notice-eventWith these, the full flow (show →
isWidgetVisible == true→ hide →on_hide_widget→isWidgetVisible == false) passes locally on both platforms. TheisWidgetVisible/on_hide_widgetassertions will be added to the UI tests once the native SDKs including the fixes are released.