From 5d4d8748b847aad8e0fb36ecb0aaa698763984e7 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Tue, 15 Oct 2019 13:51:43 -0700 Subject: [PATCH] [webview_flutter] (Trivial) Add V2 warnings The V2 embedding in webview_flutter depends on an extremely new bugfix in flutter/engine. This was mentioned in the git log but that's difficult to find. Add more warnings in the docs surrounding the new code path. In general this is an interesting problem. We can't select for the higher version as a min SDK requirement because the old embedding path doesn't need this bugfix. Ideally we should figure out a way to programmatically enforce this constraint instead of relying on developer documentation. This kind of problem is likely to happen again. --- .../plugins/webviewflutter/WebViewFlutterPlugin.java | 5 +++++ .../plugins/webviewflutterexample/MainActivity.java | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index dcce7962aed5..0284f20115f8 100644 --- a/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -26,6 +26,11 @@ public class WebViewFlutterPlugin implements FlutterPlugin { * Add an instance of this to {@link io.flutter.embedding.engine.plugins.PluginRegistry} to * register it. * + *

THIS PLUGIN CODE PATH DEPENDS ON A NEWER VERSION OF FLUTTER THAN THE ONE DEFINED IN THE + * PUBSPEC.YAML. Text input will fail on some Android devices unless this is used with at least + * flutter/flutter@1d4d63ace1f801a022ea9ec737bf8c15395588b9. Use the V1 embedding with {@link + * #registerWith(Registrar)} to use this plugin with older Flutter versions. + * *

Registration should eventually be handled automatically by v2 of the * GeneratedPluginRegistrant. https://github.com/flutter/flutter/issues/42694 */ diff --git a/packages/webview_flutter/example/android/app/src/main/java/io/flutter/plugins/webviewflutterexample/MainActivity.java b/packages/webview_flutter/example/android/app/src/main/java/io/flutter/plugins/webviewflutterexample/MainActivity.java index 1596844948e7..2f3b7edd3d9f 100644 --- a/packages/webview_flutter/example/android/app/src/main/java/io/flutter/plugins/webviewflutterexample/MainActivity.java +++ b/packages/webview_flutter/example/android/app/src/main/java/io/flutter/plugins/webviewflutterexample/MainActivity.java @@ -8,6 +8,14 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugins.webviewflutter.WebViewFlutterPlugin; +/** + * THIS PLUGIN CODE PATH DEPENDS ON A NEWER VERSION OF FLUTTER THAN THE ONE DEFINED IN THE + * PUBSPEC.YAML. Text input will fail on some Android devices unless this is used with at least + * flutter/flutter@1d4d63ace1f801a022ea9ec737bf8c15395588b9. + * + *

Use the V1 embedding as seen in {@link EmbeddingV1Activity} to use this plugin on older + * Flutter versions. + */ public class MainActivity extends FlutterActivity { // TODO(mklim): Remove this once v2 of GeneratedPluginRegistrant rolls to stable. https://github.com/flutter/flutter/issues/42694 @Override