diff --git a/flutter_03.log b/flutter_03.log new file mode 100644 index 0000000..417082c --- /dev/null +++ b/flutter_03.log @@ -0,0 +1,41 @@ +Flutter crash report; please file at https://github.com/flutter/flutter/issues. + +## command + +flutter --no-color run --machine --track-widget-creation --device-id=89AY052S4 lib/main.dart + +## exception + +_InternalLinkedHashMap: {code: 105, message: Isolate must be runnable, data: {request: {method: _reloadSources, params: {pause: true, rootLibUri: file:///data/user/0/com.keyboardcrumbs.haclient/code_cache/ha_clientLNSJAH/ha_client/lib/main.dart.incremental.dill, packagesUri: file:///data/user/0/com.keyboardcrumbs.haclient/code_cache/ha_clientLNSJAH/ha_client/.packages, isolateId: isolates/866521062}}, details: Isolate must be runnable before this request is made.}} + +``` +null``` + +## flutter doctor + +``` +[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale en_US.UTF-8) + • Flutter version 1.7.8+hotfix.4 at /home/estevez/sdk/flutter + • Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700 + • Engine revision fee001c93f + • Dart version 2.4.0 + +[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) + • Android SDK at /home/estevez/Android/Sdk + • Android NDK location not configured (optional; useful for native profiling support) + • Platform android-29, build-tools 29.0.2 + • Java binary at: /home/estevez/bin/android-studio/jre/bin/java + • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) + • All Android licenses accepted. + +[✓] Android Studio (version 3.5) + • Android Studio at /home/estevez/bin/android-studio + • Flutter plugin version 38.2.3 + • Dart plugin version 191.8423 + • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) + +[✓] Connected device (1 available) + • Pixel 3 XL • 89AY052S4 • android-arm64 • Android 9 (API 28) + +• No issues found! +``` diff --git a/lib/main.dart b/lib/main.dart index 7623a2f..f85fd4b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -176,8 +176,7 @@ class HAClientApp extends StatelessWidget { FlatButton( child: Text("Manual", style: TextStyle(color: Colors.white)), onPressed: () { - Navigator.of(context).pop(); - Navigator.of(context).pushNamed("/connection-settings"); + eventBus.fire(ShowPageEvent(path: "/connection-settings", goBackFirst: true)); }, ) ], @@ -212,6 +211,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker StreamSubscription _showPageSubscription; int _previousViewCount; bool _showLoginButton = false; + bool _preventAppRefresh = false; @override void initState() { @@ -255,6 +255,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker _settingsSubscription = eventBus.on().listen((event) { Logger.d("Settings change event: reconnect=${event.reconnect}"); if (event.reconnect) { + _preventAppRefresh = false; _fullLoad(); } }); @@ -332,7 +333,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker @override void didChangeAppLifecycleState(AppLifecycleState state) { Logger.d("$state"); - if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded) { + if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded && !_preventAppRefresh) { _quickLoad(); } } @@ -411,7 +412,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker if (_showPageSubscription == null) { _showPageSubscription = eventBus.on().listen((event) { - _showPage(event.path); + _showPage(event.path, event.goBackFirst); }); } @@ -429,6 +430,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker if (event.showButton) { _showOAuth(); } else { + _preventAppRefresh = false; Navigator.of(context).pop(); } }); @@ -442,6 +444,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker } void _showOAuth() { + _preventAppRefresh = true; Navigator.of(context).pushNamed('/login'); } @@ -509,7 +512,10 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker ); } - void _showPage(String path) { + void _showPage(String path, bool goBackFirst) { + if (goBackFirst) { + Navigator.pop(context); + } Navigator.pushNamed( context, path diff --git a/lib/managers/startup_user_messages_manager.class.dart b/lib/managers/startup_user_messages_manager.class.dart index 13756ed..6e6c9c6 100644 --- a/lib/managers/startup_user_messages_manager.class.dart +++ b/lib/managers/startup_user_messages_manager.class.dart @@ -59,7 +59,7 @@ class StartupUserMessagesManager { onPositive: () { SharedPreferences.getInstance().then((prefs) { prefs.setBool(_supportAppDevelopmentMessageKey, true); - eventBus.fire(ShowPageEvent("/configuration")); + eventBus.fire(ShowPageEvent(path: "/configuration")); }); }, onNegative: () { diff --git a/lib/utils.class.dart b/lib/utils.class.dart index 5e3ffcb..dd38c03 100644 --- a/lib/utils.class.dart +++ b/lib/utils.class.dart @@ -200,9 +200,10 @@ class ShowEntityPageEvent { } class ShowPageEvent { - String path; + final String path; + final bool goBackFirst; - ShowPageEvent(this.path); + ShowPageEvent({@required this.path, this.goBackFirst: false}); } class ShowErrorEvent {