Closed felix-barz-brickmakers closed 4 years ago
Interesting PR!
There is a conflict in MethodCallHandlerImpl.java
, could you please resolve it so that I can merge?
Done! All conflicts resolved.
I have an exception when I test on my x86 android emulator.
E/MethodChannel#flutter_web_browser(11050): Failed to handle method call
E/MethodChannel#flutter_web_browser(11050): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#flutter_web_browser(11050): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/MethodChannel#flutter_web_browser(11050): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.notImplemented(MethodChannel.java:248)
E/MethodChannel#flutter_web_browser(11050): at dev.vbonnet.flutterwebbrowser.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:32)
E/MethodChannel#flutter_web_browser(11050): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter_web_browser(11050): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter_web_browser(11050): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:693)
E/MethodChannel#flutter_web_browser(11050): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter_web_browser(11050): at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#flutter_web_browser(11050): at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#flutter_web_browser(11050): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#flutter_web_browser(11050): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_web_browser(11050): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#flutter_web_browser(11050): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/DartMessenger(11050): Uncaught exception in binary message listener
E/DartMessenger(11050): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(11050): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/DartMessenger(11050): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:253)
E/DartMessenger(11050): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/DartMessenger(11050): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:693)
E/DartMessenger(11050): at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(11050): at android.os.MessageQueue.next(MessageQueue.java:335)
E/DartMessenger(11050): at android.os.Looper.loop(Looper.java:183)
E/DartMessenger(11050): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/DartMessenger(11050): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(11050): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/DartMessenger(11050): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I was missing a break;
in the android method handler. Should be fixed now
This PR adds 2 improvements. I created a single PR since they depend on each other. If prefered, I can split it into two:
FlutterWebBrowser.warmup()
, which will warmup the browser engine used to open a custom tab, leading to much faster page loading. Does nothing on iOS