-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ChromeSafariBrowser isn't calling its events, and not keeping track of isOpen properly #759
Comments
As you can see from the error, you can't open 2 times the same instance at the same moment if it's already opened. That's right and it's the expected behavior. final webBrowser1 = AppWebBrowser();
final webBrowser2 = AppWebBrowser();
// ... other code ...
webBrowser1.open(url: Uri.parse('https://google.com'));
webBrowser2.open(url: Uri.parse('https://flutter.dev')); |
Sorry, I think you misunderstood. I actually close the web browser before calling open again, by pressing the X button on the tab. The real issue seems to be that the events are not being called at all. |
I'm unable to reproduce your problem. This is my code example tested on Android Emulator API 30: import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
class AppWebBrowser extends ChromeSafariBrowser {
@override
void onOpened() {
print("ChromeSafari browser opened");
}
@override
void onCompletedInitialLoad() {
print("ChromeSafari browser initial load completed");
}
@override
void onClosed() {
print("ChromeSafari browser closed");
}
}
final webBrowser = AppWebBrowser();
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(MaterialApp(home: new MyApp()));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('ChromeSafariBrowser Example'),
),
body: Center(
child: ElevatedButton(
child: Text("Open Browser"),
onPressed: () async {
await webBrowser.open(url: Uri.parse('https://google.com'));
},
),
));
}
} This is the screen recording: Registrazione.schermo.2021-03-26.alle.20.54.29.mov |
Hmm, thanks for the quick answer. It must be something else messing with it in my app then. I'll report back if I get more data on when it's failing. |
If possible, share your code or create the exact steps to reproduce that error using an example code. |
Okay, I figured out the exact spot where it no longer works in my codebase. I was able to take your example and break it. Something is actually happening somewhere when attaching FirebaseMessaging with a background message handler.
My pubspec has these dependencies:
I'm not too knowledgeable about the native side to know why this might be conflicting. You can see I'm not even doing anything in the background message handler for Firebase. |
Fixed with new release |
Thanks so much! The fix works great |
Environment
Device information: Pixel 5
Description
onOpened
onCompletedInitialLoad
andonClosed
are not being called for me. It seems to be becausehandleMethod
is never being called. Because of that, it's also not keeping track of_isOpened
properly. It's only letting me open the browser once since it thinks it's still opened even after closing.Steps to reproduce
I basically took the example.
Stacktrace/Logcat
The text was updated successfully, but these errors were encountered: