|
|
@ -18,6 +18,7 @@ class _HomePageState extends State<HomePage> { |
|
|
|
late GlobalOptions _globalOptions; |
|
|
|
late GlobalOptions _globalOptions; |
|
|
|
late AccountsBloc _accountsBloc; |
|
|
|
late AccountsBloc _accountsBloc; |
|
|
|
late AppsBloc _appsBloc; |
|
|
|
late AppsBloc _appsBloc; |
|
|
|
|
|
|
|
late StreamSubscription _versionCheckSubscription; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
@ -27,7 +28,7 @@ class _HomePageState extends State<HomePage> { |
|
|
|
_account = _accountsBloc.activeAccount.value!; |
|
|
|
_account = _accountsBloc.activeAccount.value!; |
|
|
|
_appsBloc = _accountsBloc.activeAppsBloc; |
|
|
|
_appsBloc = _accountsBloc.activeAppsBloc; |
|
|
|
|
|
|
|
|
|
|
|
_appsBloc.appVersions.listen((final values) { |
|
|
|
_versionCheckSubscription = _appsBloc.appVersions.listen((final values) { |
|
|
|
if (values == null || !mounted) { |
|
|
|
if (values == null || !mounted) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -54,13 +55,16 @@ class _HomePageState extends State<HomePage> { |
|
|
|
unawaited(_checkMaintenanceMode()); |
|
|
|
unawaited(_checkMaintenanceMode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
|
|
void dispose() { |
|
|
|
|
|
|
|
unawaited(_versionCheckSubscription.cancel()); |
|
|
|
|
|
|
|
super.dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Future _checkMaintenanceMode() async { |
|
|
|
Future _checkMaintenanceMode() async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
final status = await _account.client.core.getStatus(); |
|
|
|
final status = await _account.client.core.getStatus(); |
|
|
|
if (status.maintenance) { |
|
|
|
if (status.maintenance && mounted) { |
|
|
|
if (!mounted) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await _showProblem( |
|
|
|
await _showProblem( |
|
|
|
AppLocalizations.of(context).errorServerInMaintenanceMode, |
|
|
|
AppLocalizations.of(context).errorServerInMaintenanceMode, |
|
|
|
); |
|
|
|
); |
|
|
|