Resolves #401 Fix login restart and several login views opened
This commit is contained in:
parent
e8efefe25d
commit
de762a4878
41
flutter_03.log
Normal file
41
flutter_03.log
Normal file
@ -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<String, dynamic>: {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!
|
||||||
|
```
|
@ -176,8 +176,7 @@ class HAClientApp extends StatelessWidget {
|
|||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Manual", style: TextStyle(color: Colors.white)),
|
child: Text("Manual", style: TextStyle(color: Colors.white)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
eventBus.fire(ShowPageEvent(path: "/connection-settings", goBackFirst: true));
|
||||||
Navigator.of(context).pushNamed("/connection-settings");
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -212,6 +211,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
StreamSubscription _showPageSubscription;
|
StreamSubscription _showPageSubscription;
|
||||||
int _previousViewCount;
|
int _previousViewCount;
|
||||||
bool _showLoginButton = false;
|
bool _showLoginButton = false;
|
||||||
|
bool _preventAppRefresh = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -255,6 +255,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
_settingsSubscription = eventBus.on<SettingsChangedEvent>().listen((event) {
|
_settingsSubscription = eventBus.on<SettingsChangedEvent>().listen((event) {
|
||||||
Logger.d("Settings change event: reconnect=${event.reconnect}");
|
Logger.d("Settings change event: reconnect=${event.reconnect}");
|
||||||
if (event.reconnect) {
|
if (event.reconnect) {
|
||||||
|
_preventAppRefresh = false;
|
||||||
_fullLoad();
|
_fullLoad();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -332,7 +333,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
Logger.d("$state");
|
Logger.d("$state");
|
||||||
if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded) {
|
if (state == AppLifecycleState.resumed && ConnectionManager().settingsLoaded && !_preventAppRefresh) {
|
||||||
_quickLoad();
|
_quickLoad();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,7 +412,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
if (_showPageSubscription == null) {
|
if (_showPageSubscription == null) {
|
||||||
_showPageSubscription =
|
_showPageSubscription =
|
||||||
eventBus.on<ShowPageEvent>().listen((event) {
|
eventBus.on<ShowPageEvent>().listen((event) {
|
||||||
_showPage(event.path);
|
_showPage(event.path, event.goBackFirst);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,6 +430,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
if (event.showButton) {
|
if (event.showButton) {
|
||||||
_showOAuth();
|
_showOAuth();
|
||||||
} else {
|
} else {
|
||||||
|
_preventAppRefresh = false;
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -442,6 +444,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _showOAuth() {
|
void _showOAuth() {
|
||||||
|
_preventAppRefresh = true;
|
||||||
Navigator.of(context).pushNamed('/login');
|
Navigator.of(context).pushNamed('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +512,10 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showPage(String path) {
|
void _showPage(String path, bool goBackFirst) {
|
||||||
|
if (goBackFirst) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
path
|
path
|
||||||
|
@ -59,7 +59,7 @@ class StartupUserMessagesManager {
|
|||||||
onPositive: () {
|
onPositive: () {
|
||||||
SharedPreferences.getInstance().then((prefs) {
|
SharedPreferences.getInstance().then((prefs) {
|
||||||
prefs.setBool(_supportAppDevelopmentMessageKey, true);
|
prefs.setBool(_supportAppDevelopmentMessageKey, true);
|
||||||
eventBus.fire(ShowPageEvent("/configuration"));
|
eventBus.fire(ShowPageEvent(path: "/configuration"));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onNegative: () {
|
onNegative: () {
|
||||||
|
@ -200,9 +200,10 @@ class ShowEntityPageEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ShowPageEvent {
|
class ShowPageEvent {
|
||||||
String path;
|
final String path;
|
||||||
|
final bool goBackFirst;
|
||||||
|
|
||||||
ShowPageEvent(this.path);
|
ShowPageEvent({@required this.path, this.goBackFirst: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShowErrorEvent {
|
class ShowErrorEvent {
|
||||||
|
Reference in New Issue
Block a user