33 lines
1.1 KiB
Dart
33 lines
1.1 KiB
Dart
import 'package:aman_kassa_flutter/core/base/base_view_model.dart';
|
|
import 'package:aman_kassa_flutter/core/route_names.dart';
|
|
import 'package:aman_kassa_flutter/core/services/authentication_service.dart';
|
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class StartUpViewModel extends BaseViewModel {
|
|
NavigatorService _navigationService;
|
|
AuthenticationService _authenticationService;
|
|
|
|
StartUpViewModel({
|
|
@required AuthenticationService authenticationService,
|
|
@required NavigatorService navigationService,
|
|
}) :
|
|
_authenticationService = authenticationService ,
|
|
_navigationService = navigationService;
|
|
|
|
|
|
|
|
Future handleStartUpLogic() async {
|
|
// Register for push notifications
|
|
//await _pushNotificationService.initialise();
|
|
|
|
var hasLoggedInUser = await _authenticationService.isUserLoggedIn('test');
|
|
log.i('hasLoggedInUser $hasLoggedInUser');
|
|
if (hasLoggedInUser) {
|
|
//_navigationService.navigateTo(HomeViewRoute);
|
|
_navigationService.replace(HomeViewRoute);
|
|
} else {
|
|
_navigationService.replace(LoginViewRoute);
|
|
}
|
|
}
|
|
} |