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:
@ -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(() {
|
||||
|
Reference in New Issue
Block a user