No mobile_app error handling
This commit is contained in:
parent
8efeb3da8a
commit
0d2f1cf9aa
@ -301,8 +301,8 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
_subscribe().then((_) {
|
||||
ConnectionManager().init(loadSettings: true, forceReconnect: true).then((__){
|
||||
_fetchData();
|
||||
}, onError: (code) {
|
||||
_setErrorState(code);
|
||||
}, onError: (error) {
|
||||
_setErrorState(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -315,8 +315,8 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
_showInfoBottomBar(progress: true,);
|
||||
ConnectionManager().init(loadSettings: false, forceReconnect: false).then((_){
|
||||
_fetchData();
|
||||
}, onError: (code) {
|
||||
_setErrorState(code);
|
||||
}, onError: (error) {
|
||||
_setErrorState(error);
|
||||
});
|
||||
}
|
||||
|
||||
@ -460,10 +460,12 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
_setErrorState(error) {
|
||||
if (error is UserError) {
|
||||
setState(() {
|
||||
_showBottomBar = false;
|
||||
_userError = error;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_showBottomBar = false;
|
||||
_userError = UserError(code: ErrorCode.UNKNOWN);
|
||||
});
|
||||
}
|
||||
|
@ -162,8 +162,16 @@ class UserErrorScreen extends StatelessWidget {
|
||||
));
|
||||
break;
|
||||
}
|
||||
case ErrorCode.NO_MOBILE_APP_COMPONENT: {
|
||||
errorText = "Looks like mobile_app component is not enabled on your Home Assistant instance. Please add it to your configuration.yaml";
|
||||
buttons.add(RaisedButton(
|
||||
onPressed: () => Launcher.launchURLInCustomTab(context: context, url: "https://www.home-assistant.io/components/mobile_app/"),
|
||||
child: Text("Help"),
|
||||
));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
errorText = "???";
|
||||
errorText = "There was an error. Code ${this.error.code}";
|
||||
buttons.add(RaisedButton(
|
||||
onPressed: () => _reload(),
|
||||
child: Text("Reload"),
|
||||
|
Reference in New Issue
Block a user