feat: add showWidget and hideWidget events - #125
Merged
Conversation
Update the native SDKs to 2.47.0 and expose the new widget events, mirroring didomi/react-native#186. Native SDKs -> 2.47.0 - iosNativeVersion and androidNativeVersion in package.json, which is the single source of truth for both the XCFramework download and the Android dependency injected at build time. Widget events - New ShowWidgetEvent (widgetId, layerName) and HideWidgetEvent classes, exposed as ShowWidget / HideWidget on DidomiEventListener. - Android: showWidget / hideWidget implementations in EventListenerProxy. AndroidJavaProxy requires every method of the Java interface to be implemented, so both are mandatory with the 2.47.0 SDK. - iOS: DDMEventTypeShowWidget / DDMEventTypeHideWidget mapped to the native values 47 and 48. Values 44 to 46 belong to events not exposed in Unity, so the enum is not contiguous here. - iOS showWidget carries two strings, so it uses a dedicated callback like integrationError. hideWidget has no payload and reuses the generic handler. - Events registered in the sample app. Cross-platform naming: the iOS SDK exposes the property as widgetID and Android as widgetId. Both bridges map it to widgetId so a single C# event class fits both platforms, as done in the React Native PR. Verification - Unity 6000.3.5f1 batchmode compile succeeds with no errors; the new types, the add_/remove_ accessors for both events and the new P/Invoke callback are present in the compiled DidomiAssembly.dll. - Didomi.mm passes clang -fsyntax-only against the real 2.47.0 XCFramework headers with no errors or warnings, confirming onShowWidget, onHideWidget and the widgetID property. - EventListenerProxy implements all 46 methods of the 2.47.0 DidomiEventListener Java interface, verified against the published AAR. Not covered by automated tests: end-to-end delivery needs a web-rendered notice that actually serves a widget, and the existing suites are on-device integration tests with no API to trigger one. Same limitation as the React Native and Flutter PRs, so this is worth a manual check against a widget-serving notice before release.
pmerlet-at-didomi
approved these changes
Aug 4, 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.
Updates the native SDKs to 2.47.0 and exposes the new widget events, mirroring didomi/react-native#186.
Changes
Native SDKs → 2.47.0
iosNativeVersionandandroidNativeVersioninResources/package.json. That file is the single source of truth:DidomiPathsbuilds the XCFramework download URL from it, andPostProcessorinjects the Android dependency from it, so there are no other version pins to update.Widget events
ShowWidgetEvent(widgetId,layerName) andHideWidgetEvent, exposed asShowWidget/HideWidgetonDidomiEventListenershowWidget/hideWidgetinEventListenerProxy.cs, with aConvertToShowWidgetEventhelper following the existingintegrationErrorpatternDDMEventTypeShowWidget/DDMEventTypeHideWidget,onShowWidget/onHideWidgetclosures inDidomi.mm, and a newOnShowWidgetEventListenerDelegateP/Invoke callback inDidomiFramework.csDemoGUI.cs)Two things worth a reviewer's attention
The iOS enum is not contiguous. The native values are 47 and 48, not 44/45 — slots 44 to 46 belong to
ConsentChangedWithObjectand two UI events that Unity does not expose. The iOS header carries the note "Please keep the current order because of Unity bridge." Appending sequentially would have compiled fine and silently misrouted events at runtime, so the values were read off the real 2.47.0 header. A comment inDDMEventType.csrecords why the gap is there.Android's proxy has a hard runtime contract.
AndroidJavaProxyrequires every method of the Java interface to be implemented, soshowWidget/hideWidgetwere not optional once the SDK moved to 2.47.0 — omitting them would break the whole listener.Cross-platform naming
The iOS SDK exposes the property as
widgetID, Android aswidgetId. Both bridges map it towidgetIdso a single C# event class fits both platforms. Noted in a comment at each site, same approach as the React Native PR.Since
showWidgetcarries two strings it uses a dedicated callback, likeintegrationError.hideWidgethas no payload and reuses the generic handler.Verification
add_/remove_accessors for both events, and the new P/Invoke callback are all present in the compiledDidomiAssembly.dll.Didomi.mmpassesclang -fsyntax-onlyagainst the real 2.47.0 XCFramework headers with no errors and no warnings, confirmingonShowWidget,onHideWidgetand thewidgetIDproperty.EventListenerProxyimplements all 46 methods of the 2.47.0DidomiEventListenerinterface, verified against the published AAR.Not covered by automated tests
End-to-end event delivery needs a web-rendered notice that actually serves a widget, and the existing suites are on-device integration tests with no API to trigger one — so no test was added that would assert nothing. Same limitation documented in the React Native and Flutter PRs. Worth a manual check against a widget-serving notice configuration before release.