1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Load configuration at application startup

This commit is contained in:
2021-02-19 17:32:38 +01:00
parent 459757b292
commit 613ceadfaa
5 changed files with 28 additions and 15 deletions

View File

@ -1,4 +1,6 @@
import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/helpers/events_helper.dart';
import 'package:comunic/helpers/server_config_helper.dart';
import 'package:comunic/helpers/websocket_helper.dart';
import 'package:comunic/ui/routes/login_route.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart';
@ -57,6 +59,14 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
/// Try to connect to server
void _tryConnect() async {
try {
await ServerConfigurationHelper.ensureLoaded();
if (!AccountHelper.isUserIDLoaded) {
_popToMainRoute();
_openLoginPage();
return;
}
print("Attempting WebSocket connection...");
setState(() {