-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Enable setAllowFileAccess on Android setting when loading files #4601
[webview_flutter] Enable setAllowFileAccess on Android setting when loading files #4601
Conversation
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.
LGTM with the format issues fixed. I was wondering when closing that other PR last night how this worked 🙂 I missed the fact that the example was using an older version than the switch though.
I don't love the automatic permanent change of security setting when loading a file, but I didn't have a suggestion that doesn't feel more annoying for clients. We should do a follow-up to document that side effect in the app-facing method doc comment though.
@@ -1,7 +1,3 @@ | |||
// Copyright 2013 The Flutter Authors. All rights reserved. | |||
// Use of this source code is governed by a BSD-style license that can be | |||
// found in the LICENSE 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.
This still needs to be re-added for CI to pass.
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.
Sorry completely missed that. Just submitted an update.
This pull request is not suitable for automatic merging in its current state.
|
Merging in master will help this pass Android tests |
This pull request is not suitable for automatic merging in its current state.
|
…g when loading files (flutter/plugins#4601)
This makes two changes:
WebSettings.setAllowFileAccess()
method to provide the option to enable/ disable this feature on Android;WebSettings.setAllowFileAccess()
is called from theWebViewAndroidWidget.loadFile()
method to ensure this option is enabled. Before Android API 30 this option is enabled by default, however on Android API 30 and up this behaviour is flipped and the option is now disabled by default which means theloadFile
method doesn't work on these Android versions. This bug was not detected before because the webview_flutter_android example app is configured to target Android SDK 28 (details can be found here: https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess(boolean)).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].///
).