-
Notifications
You must be signed in to change notification settings - Fork 2
fix: webview scroll issue #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe updates modify the embedded JavaScript in the HTML template of Changes
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances survey handling by tracking response submission status and improves user experience by disabling scrolling in the embedded survey web view.
- Introduces a JS callback registration (
getSetIsResponseSendingFinished
) to notify when a response has finished sending. - Disables scrolling on the
WKWebView
to prevent unwanted scroll behavior.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
Sources/FormbricksSDK/WebView/SurveyWebView.swift | Disabled the scroll view on the survey web view |
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift | Added JS callback registration for response finish tracking |
Comments suppressed due to low confidence (2)
Sources/FormbricksSDK/WebView/SurveyWebView.swift:33
- [nitpick] Add a comment explaining why scrolling is disabled in the survey web view to clarify user experience intent and aid future maintainers.
webView.scrollView.isScrollEnabled = false
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift:56
- [nitpick] The function name
getSetIsResponseSendingFinished
is confusing as it registers a callback. Consider renaming it toonResponseSendingFinished
orregisterResponseFinishedCallback
to make its purpose clearer.
function getSetIsResponseSendingFinished(callback) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift (1)
55-58
: Implementation looks good, consider improving function naming.The callback mechanism for tracking response submission status is correctly implemented. However, the function name
getSetIsResponseSendingFinished
is quite verbose and unclear about its purpose.Consider renaming for better clarity:
- let setResponseFinished = null; - function getSetIsResponseSendingFinished(callback) { - setResponseFinished = callback; - } + let setResponseFinished = null; + function setResponseFinishedCallback(callback) { + setResponseFinished = callback; + }And update the corresponding reference:
- getSetIsResponseSendingFinished, + setResponseFinishedCallback,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift
(1 hunks)Sources/FormbricksSDK/WebView/SurveyWebView.swift
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build-and-analyze
🔇 Additional comments (2)
Sources/FormbricksSDK/WebView/SurveyWebView.swift (1)
33-33
: LGTM! Correctly disables webview scrolling.This change appropriately disables scrolling in the survey webview, which aligns with the PR objective to fix the webview scroll issue and improve user experience during survey interaction.
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift (1)
64-64
: Correctly integrates the callback into survey props.The addition of the callback function to the
surveyProps
object properly exposes the response tracking functionality to the external survey library.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well 🚀✅
This pull request introduces enhancements to the
FormbricksSDK
to improve survey handling and user experience. The most important changes include adding functionality to track response submission status and disabling scrolling in the survey web view.Enhancements to survey handling:
Sources/FormbricksSDK/WebView/FormbricksViewModel.swift
: Added agetSetIsResponseSendingFinished
function to enable tracking of response submission status, along with asetResponseFinished
callback. Integrated this functionality into thesurveyProps
object.Improvements to user experience:
Sources/FormbricksSDK/WebView/SurveyWebView.swift
: Disabled scrolling in the survey web view by settingwebView.scrollView.isScrollEnabled
tofalse
.Summary by CodeRabbit