Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter_android] Updates pigeon version to support null safety #5395

Merged
merged 9 commits into from
Apr 28, 2022

Conversation

bparrishMines
Copy link
Contributor

@bparrishMines bparrishMines commented Apr 26, 2022

Updates pigeon api to use null safety since flutter/flutter#59118 has added support for nullable parameters.

Also updates the pigeon file to include the output files. This removes the need for the .generatePigeons.sh script.

No version change:
Only updates the pigeon api implementations.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added p: webview_flutter Edits files for a webview_flutter plugin platform-android labels Apr 26, 2022
@bparrishMines bparrishMines changed the title Android null [webview_flutter_android] Updates pigeon version to support null safety Apr 26, 2022
.setRequestHeaders(
request.getRequestHeaders() != null
? request.getRequestHeaders()
: new HashMap<>());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently request.getRequestHeaders() can return null

04-27 07:50:01.128: D/AndroidRuntime(21722): Shutting down VM
04-27 07:50:01.128: D/AndroidRuntime(21722): --------- beginning of crash
04-27 07:50:01.128: E/AndroidRuntime(21722): FATAL EXCEPTION: main
04-27 07:50:01.128: E/AndroidRuntime(21722): Process: io.flutter.plugins.webviewflutterandroidexample, PID: 21722
04-27 07:50:01.128: E/AndroidRuntime(21722): java.lang.IllegalStateException: Nonnull field "requestHeaders" is null.
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebResourceRequestData.setRequestHeaders(GeneratedAndroidWebView.java:103)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebResourceRequestData$Builder.build(GeneratedAndroidWebView.java:161)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at io.flutter.plugins.webviewflutter.WebViewClientFlutterApiImpl.createWebResourceRequestData(WebViewClientFlutterApiImpl.java:58)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at io.flutter.plugins.webviewflutter.WebViewClientFlutterApiImpl.requestLoading(WebViewClientFlutterApiImpl.java:164)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl$WebViewClientImpl.shouldOverrideUrlLoading(WebViewClientHostApiImpl.java:88)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-TrichromeWebViewGoogle.apk-stable-410410683:16)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at android.os.MessageQueue.nativePollOnce(Native Method)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at android.os.MessageQueue.next(MessageQueue.java:335)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at android.os.Looper.loop(Looper.java:183)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at android.app.ActivityThread.main(ActivityThread.java:7664)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at java.lang.reflect.Method.invoke(Native Method)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
04-27 07:50:01.128: E/AndroidRuntime(21722): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I remember the old implementation had a PR at some point to fix a null crash with request headers.

.setRequestHeaders(
request.getRequestHeaders() != null
? request.getRequestHeaders()
: new HashMap<>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I remember the old implementation had a PR at some point to fix a null crash with request headers.

late bool isRedirect;
late bool hasGesture;
late String method;
late Map<String?, String?> requestHeaders;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do a body-less constructor using this. references for the arguments, instead of everything being late?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea both formats are supported. I chose this one because it was less redundant (except for the late keyword). I'm fine with either, though.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

}

class WebResourceErrorData {
int? errorCode;
String? description;
WebResourceErrorData(this.errorCode, this.description);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.

@bparrishMines bparrishMines merged commit 0605d87 into flutter:main Apr 28, 2022
@bparrishMines bparrishMines deleted the android_null branch April 28, 2022 20:30
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 29, 2022
CaseyHillers pushed a commit to flutter/flutter that referenced this pull request Apr 29, 2022
* c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432)

* 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434)

* 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395)

* 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426)

* e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437)

* 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441)

* f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436)

* 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442)

* 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
egramond pushed a commit to egramond/flutter that referenced this pull request May 5, 2022
…#102824)

* c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432)

* 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434)

* 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395)

* 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426)

* e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437)

* 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441)

* f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436)

* 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442)

* 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
mauricioluz pushed a commit to mauricioluz/plugins that referenced this pull request Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: webview_flutter Edits files for a webview_flutter plugin platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants