fbmobile/lib/core/viewmodels/startup_model.dart
Varakh b55e932204
All checks were successful
continuous-integration/drone/push Build is passing
Added proper linting #noissue
2023-01-04 21:17:54 +01:00

27 lines
911 B
Dart

import 'package:flutter_translate/flutter_translate.dart';
import '../../locator.dart';
import '../../ui/views/home_view.dart';
import '../enums/viewstate.dart';
import '../services/navigation_service.dart';
import '../services/session_service.dart';
import 'base_model.dart';
class StartUpViewModel extends BaseModel {
final SessionService _sessionService = locator<SessionService>();
final NavigationService _navigationService = locator<NavigationService>();
Future handleStartUpLogic() async {
setStateView(ViewState.busy);
setStateMessage(translate('startup.init'));
await Future.delayed(const Duration(milliseconds: 150));
setStateMessage(translate('startup.start_services'));
await _sessionService.start();
await Future.delayed(const Duration(milliseconds: 150));
_navigationService.navigateAndReplaceTo(HomeView.routeName);
setStateView(ViewState.idle);
}
}