fix: adds click outside close and overlay settings#45
Conversation
WalkthroughThis change replaces the boolean 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 |
Dhruwang
left a comment
There was a problem hiding this comment.
Looks good, just need to fix the coverage !
|



What does this PR do?
Implements the Android SDK counterpart to formbricks/formbricks#7197 and mirrors formbricks/ios#38, which replaces the
darkOverlayboolean with a newoverlayenum (none,light,dark) and fixesclickOutsideClosenot being passed to the survey JS library.Fixes #44
Changes
New
SurveyOverlayenum (Survey.kt)SurveyOverlayenum with casesNONE,LIGHT,DARK, with@SerializedNameannotations matching the backend'sSurveyOverlayschema.Model updates (
Project.kt,Survey.kt)Project.darkOverlay: Boolean?→Project.overlay: SurveyOverlay?SurveyProjectOverwrites.darkOverlay: Boolean?→SurveyProjectOverwrites.overlay: SurveyOverlay?Native overlay background (
FormbricksFragment.kt)0.5fregardless of config. It now respects the resolved overlay value:DARK→ dark semi-transparent background (0.6f)LIGHT→ light semi-transparent background (0.3f)NONE→ fully transparent (0.0f)show()now accepts anoverlayparameter, resolved bySurveyManager.Overlay resolution (
SurveyManager.kt)resolveOverlay(survey)helper that follows the correct precedence: survey-levelprojectOverwrites.overlay→ project-leveloverlay→NONE.track()resolves and passes the overlay to the presenter.WebView data (
FormbricksViewModel.kt)data["darkOverlay"](Bool) withdata["overlay"](String:"none"/"light"/"dark"), matching the JS survey library's expected prop.data["clickOutside"], which was missing entirely. Without it, the JS survey library's click-outside-to-dismiss handler never activated, even whenclickOutsideClosewastrue.Test updates (
FormbricksViewModelInstrumentedTest.kt,Environment.json)"darkOverlay": false→"overlay": "none".Projectconstructor in tests to useoverlayinstead ofdarkOverlay.How should this be tested?
lightordarkoverlay → verify tapping outside the survey card dismisses itprojectOverwrites.overlayoverrides the project-level defaultoverlayfield default tonone