fbmobile/lib/core/viewmodels/startup_model.dart
Varakh e661171fd2
All checks were successful
/ build (push) Successful in 5m17s
Various improvements and #noissue
- Bumped Android minSdk to 30 (Android 11)
- Fixed permission service not handling Android SDK 33 correctly
- Fixed permission service not being started during application start
2023-11-26 23:53:17 +01:00

30 lines
1.1 KiB
Dart

import 'package:fbmobile/core/services/permission_service.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 PermissionService _permissionService = locator<PermissionService>();
final NavigationService _navigationService = locator<NavigationService>();
Future handleStartUpLogic() async {
setStateView(ViewState.busy);
setStateMessage(translate('startup.init'));
await Future.delayed(const Duration(milliseconds: 100));
setStateMessage(translate('startup.start_services'));
await _sessionService.start();
await _permissionService.start();
await Future.delayed(const Duration(milliseconds: 100));
_navigationService.navigateAndReplaceTo(HomeView.routeName);
setStateView(ViewState.idle);
}
}