-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[webview_flutter_android] Updates plugin to use ProxyApis
s
#7794
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
Merged
auto-submit
merged 96 commits into
flutter:main
from
bparrishMines:webview_android_pigeon_2
Nov 19, 2024
Merged
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
3a06ba1
recreate android webkit libbrary pigeon file
bparrishMines 022f335
formatting
bparrishMines eba1170
compilation works
bparrishMines 139b71b
new proxy apis for data classes
bparrishMines 817900f
add version checker and cookie manager impl
bparrishMines b2df316
use class level requiresapi
bparrishMines da9e40f
add missing method and webview implementation
bparrishMines 8b7f3a6
websettings and javascriptchannel implementations
bparrishMines 6710e7d
finish webviewclient
bparrishMines d95064a
formatting call on main thread and downloadlistener
bparrishMines bca2a8f
webchromeclient impl i think
bparrishMines 44069c5
some more implementations
bparrishMines 7d08599
last couple implementations
bparrishMines 5af1f19
formatting and update the java plugin class
bparrishMines 8be75df
gen new proxy
bparrishMines 840a9c0
fix proxy name
bparrishMines 0bb7d0c
convert android_webview_controller
bparrishMines 38887e4
fix on requeest headres nullness
bparrishMines 9437524
fix prompting
bparrishMines d64584f
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 15fd208
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 04e8b65
regen and update pigeon
bparrishMines 3313810
add licenses and fix code
bparrishMines 73333f4
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 1a66dda
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 73af051
update tests
bparrishMines 3247075
formatting and new code gen
bparrishMines 3244f36
java tests compile
bparrishMines 7439716
passing tests
bparrishMines 417c9d4
fix cookiemanager tests
bparrishMines edc96ed
fix evaluate javascript
bparrishMines 4ecf2cb
destroy test
bparrishMines 6b6f5af
fix android proxy
bparrishMines b566a80
fix legacy errors
bparrishMines 875a3db
fix legacy tests and regen mockitos
bparrishMines 1ecebcf
fix navigation tests
bparrishMines bf34fe7
get test file compiling
bparrishMines adcd9aa
fix geolocation test
bparrishMines 79f39e8
fix android_controller tests
bparrishMines b84aa1b
fix all unit tests
bparrishMines a8bc402
fix integration tests
bparrishMines 29f24ab
remove unused files and chage pigeon file to android_webview
bparrishMines 436f627
fix integration tests
bparrishMines 604da48
fix tests and analysis
bparrishMines b864491
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 63add96
version bump
bparrishMines 362de78
use different test strings
bparrishMines 7a74ee3
remove instancemanager test
bparrishMines 7979424
some formatting
bparrishMines 14f2b9f
changelog
bparrishMines d004bdc
improvements and lints
bparrishMines db583c5
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 27060b6
null annotations
bparrishMines d4a017a
fix tests
bparrishMines 61e5be0
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 0d2a6de
fix unit tests
bparrishMines 504f4e7
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 97db13f
fix jvm target
bparrishMines c43e103
fix
bparrishMines 91924ab
add annotation
bparrishMines bd240fe
nullability annotations
bparrishMines 2406ecb
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 97794ec
formatting
bparrishMines 11acdbd
remove 21 checks
bparrishMines d51c389
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 1e0c79e
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 4b05e38
formatting and remove version checks
bparrishMines b7891e3
fix cookiemanager
bparrishMines 66d47d3
formatting and fix log message
bparrishMines 577d75a
remove api requirement
bparrishMines 7a324c2
other class
bparrishMines 6402f15
update instancemanager
bparrishMines 80f2510
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 8e3beed
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines d16ad98
bump pubspec version
bparrishMines d2e4f7e
nits
bparrishMines 74c1566
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines c893bd4
maybe fix
bparrishMines 0c22e1e
add contributing doc
bparrishMines f3824f1
fix changelog
bparrishMines 464c2a8
add contribution guide
bparrishMines 320b8ac
update contributing
bparrishMines 78ca1bd
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 4ab4648
fix version bump
bparrishMines c313cc8
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 050c8e4
fix type
bparrishMines 0d5ad0f
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines 9c92615
contributing fixes
bparrishMines 72f26ae
change pigeon file name
bparrishMines 7c35e9b
fix plugin
bparrishMines 7d63b78
try higher kotlin versiong
bparrishMines dd57f9f
fix compilation
bparrishMines dfeff6d
fix kotlin version
bparrishMines 4567360
fix pigeon name
bparrishMines bdf82ea
by not in
bparrishMines 2ecb73b
Merge branch 'main' of github.com:flutter/packages into webview_andro…
bparrishMines File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/webview_flutter/webview_flutter_android/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/webview_flutter/webview_flutter_android/CONTRIBUTING.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Contributing to `webview_flutter_android` | ||
|
||
Please start by taking a look at the general guide to contributing to the `flutter/packages` repo: | ||
https://github.com/flutter/packages/blob/main/CONTRIBUTING.md | ||
|
||
## Package Structure | ||
|
||
This plugin serves as a platform implementation plugin as outlined in [federated plugins](https://docs.flutter.dev/packages-and-plugins/developing-packages#federated-plugins). | ||
The sections below will provide an overview of how this plugin implements this portion with Android. | ||
|
||
For making changes to this package, please take a look at [changing federated plugins](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins). | ||
|
||
### Quick Overview | ||
|
||
This plugin implements the platform interface provided by `webview_flutter_platform_interface` using | ||
the native WebKit APIs for Android. | ||
|
||
#### SDK Wrappers | ||
|
||
To access native APIS, this plugins uses Dart wrappers of the native library. The native library is | ||
wrapped using using the `ProxyApi` feature from the `pigeon` package. | ||
|
||
The wrappers for the native library can be updated and modified by changing `pigeons/android_webkit.dart`. | ||
|
||
The generated files are located: | ||
* `lib/src/android_webkit.g.dart` | ||
* `android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt` | ||
|
||
To update the wrapper, follow the steps below: | ||
|
||
##### 1. Ensure the project has been built at least once | ||
|
||
Run `flutter build apk --debug` in `example/`. | ||
|
||
##### 2. Make changes to the respective pigeon file that matches the native SDK | ||
|
||
* Android Dependency: https://developer.android.com/reference/android/webkit/package-summary | ||
* Pigeon file to update: `pigeons/android_webkit.dart` | ||
|
||
##### 3. Run the code generator from the terminal | ||
|
||
Run: `dart run pigeon --input pigeons/android_webkit.dart` | ||
|
||
##### 4. Update the generated APIs in native code | ||
|
||
Running the `flutter build` command from step 1 again should provide build errors and indicate what | ||
needs to be done. Alternatively, it can be easier to update native code with the platform's specific | ||
IDE: | ||
|
||
Open `example/android/` in a separate Android Studio project. | ||
|
||
##### 5. Write API tests | ||
|
||
Assuming a non-static method or constructor was added to the native wrapper, a native test will need | ||
to be added. | ||
|
||
Tests location: `android/src/test/java/io/flutter/plugins/webviewflutter/` | ||
|
||
## Important Notes | ||
|
||
### Calling `WebView.destroy()` after Dart Instance is Garbage Collected | ||
|
||
To avoid a potentially breaking change, the code in `android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt` | ||
needs to be updated after the pigeon generator is run. Please add | ||
|
||
```kotlin | ||
val instance: Any? = getInstance(identifier) | ||
if (instance is WebViewProxyApi.WebViewPlatformView) { | ||
instance.destroy() | ||
} | ||
``` | ||
|
||
to `AndroidWebkitLibraryPigeonInstanceManager.remove`. The current implementation of the native | ||
code doesn't currently support handling when the Dart instance is garbage collected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.