-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[webview_flutter_wkwebview] Add webkit interface for showing javascript alert message #4555
[webview_flutter_wkwebview] Add webkit interface for showing javascript alert message #4555
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
8db3bc6
to
1933921
Compare
@jsharp83 Thanks for the contribution! It looks like this feature is also supported on Android, onJSAlert, so we should add support for this in the common platform interface: See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins for more info on the process of doing this. |
@bparrishMines Thanks for the review. Unlike iOS, in Android, System popup works without any additional implementation. I added a test code on webview_flutter_android example, so you can check it . Even Android supports system popup in Javascript, someone wants to use flutter version of alert. If you think that it is necessary things to support, I will additionally implement it on android platform. Thanks. |
9478648
to
5875cf9
Compare
@bparrishMines I checked onJsAlert, onJsConfirm and onJsPrompt function in WebChromeClient you already mentioned. I will implement a interface with it on WebChromeClientHostApiImpl.java |
5875cf9
to
2a1b164
Compare
@jsharp83 Yea, I think we should still add a common platform interface for this method since it is supported on Android. The reason being that someone could want to override the default JS alerts on Android and we don't want to create an interface on iOS that is difficult for Android to implement at a later date. |
@jsharp83 Thank you for your contents. But when I add the changes to [webview_flutter_wkwebview] , the below errors FWFWKJavaScriptPanelCompletionData Expected ')' What can I do? or can you upload other neccessary files? |
It is defined in You should run pigeon script on webview_flutter_wkwebview folder
I closed this PR because I uploaded a new PR with Android version implementation. If you just add a feature temporary in iOS, check this commit |
@jsharp83
After that the app is exited. |
…#4704) * there are cases where Web calls System Popup with javascript on webview_flutter * At this time, the message comes in the WKUIDelegate part in iOS. * https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview * https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview * Android also has a interface on WebChromeClient * https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult) * It was implemented according to the requirements of the code review of the #4555 * Related issue: flutter/flutter#30358 (comment) * Related Interface PR: #5670
…flutter#4704) * there are cases where Web calls System Popup with javascript on webview_flutter * At this time, the message comes in the WKUIDelegate part in iOS. * https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview * https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview * Android also has a interface on WebChromeClient * https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult) * It was implemented according to the requirements of the code review of the flutter#4555 * Related issue: flutter/flutter#30358 (comment) * Related Interface PR: flutter#5670
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.