fix: adds click outside close and overlay settings#38
Conversation
WalkthroughThis change refactors the overlay system by replacing a boolean 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
|



What does this PR do?
Implements the iOS SDK counterpart to formbricks/formbricks#7197, which replaces the
darkOverlayboolean with a newoverlayenum (none,light,dark) and fixesclickOutsideClosenot being passed to the survey JS library.Fixes #37
Changes
New
SurveyOverlayenum (Survey.swift)SurveyOverlayenum with casesnone,light,dark, matching the backend'sSurveyOverlayschema.Model updates (
Project.swift,Survey.swift)Project.darkOverlay: Bool?→Project.overlay: SurveyOverlay?ProjectOverwrites.darkOverlay: Bool?→ProjectOverwrites.overlay: SurveyOverlay?Native overlay background (
PresentSurveyManager.swift)UIColor.gray.withAlphaComponent(0.6)regardless of config. It now respects the resolved overlay value:dark→ dark semi-transparent backgroundlight→ light semi-transparent backgroundnone→ fully transparent (clear)present()now accepts anoverlayparameter, resolved bySurveyManager.Overlay resolution (
SurveyManager.swift)resolveOverlay(for:)helper that follows the correct precedence: survey-levelprojectOverwrites.overlay→ project-leveloverlay→.none.track()andshowSurvey()resolve and pass the overlay to the presenter.WebView data (
FormbricksViewModel.swift)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 (
FormbricksSDKTests.swift,Environment.json)"darkOverlay": false→"overlay": "none","darkOverlay": true→"overlay": "dark".overlayas a string andclickOutsideas a boolean.How should this be tested?
lightordarkoverlay → verify tapping outside the survey card dismisses itprojectOverwrites.overlayoverrides the project-level defaultoverlayfield default tonone