v1.26.10 login exception handling with bloc 8.0
This commit is contained in:
@@ -88,40 +88,59 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> with Trans {
|
||||
|
||||
void _onSubmit(LoginSubmit event, Emitter<LoginState> emit) async {
|
||||
emit(LoginLoading());
|
||||
await userRepository.getUser();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "email");
|
||||
Cache().setLoginType(LoginType.email);
|
||||
|
||||
emit(LoginSuccess());
|
||||
try {
|
||||
await userRepository.getUser();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "email");
|
||||
Cache().setLoginType(LoginType.email);
|
||||
} on Exception catch(e) {
|
||||
emit(LoginError(message: e.toString()));
|
||||
} finally {
|
||||
emit(LoginSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
void _onLoginFB(LoginFB event, Emitter<LoginState> emit) async {
|
||||
emit(LoginLoading());
|
||||
Cache().setLoginType(LoginType.fb);
|
||||
await userRepository.getUserByFB();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "FB");
|
||||
emit(LoginSuccess());
|
||||
try {
|
||||
Cache().setLoginType(LoginType.fb);
|
||||
await userRepository.getUserByFB();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "FB");
|
||||
} on Exception catch(e) {
|
||||
emit(LoginError(message: e.toString()));
|
||||
} finally {
|
||||
emit(LoginSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
void _onLoginGoogle(LoginGoogle event, Emitter<LoginState> emit) async {
|
||||
emit(LoginLoading());
|
||||
Cache().setLoginType(LoginType.google);
|
||||
await userRepository.getUserByGoogle();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "Google");
|
||||
try {
|
||||
Cache().setLoginType(LoginType.google);
|
||||
await userRepository.getUserByGoogle();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "Google");
|
||||
|
||||
emit(LoginSuccess());
|
||||
} on Exception catch(e) {
|
||||
emit(LoginError(message: e.toString()));
|
||||
} finally {
|
||||
emit(LoginSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
void _onLoginApple(LoginApple event, Emitter<LoginState> emit) async {
|
||||
emit(LoginLoading());
|
||||
Cache().setLoginType(LoginType.apple);
|
||||
await userRepository.getUserByApple();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "Apple");
|
||||
emit(LoginSuccess());
|
||||
try {
|
||||
Cache().setLoginType(LoginType.apple);
|
||||
await userRepository.getUserByApple();
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn!));
|
||||
Track().track(TrackingEvent.login, eventValue: "Apple");
|
||||
} on Exception catch(e) {
|
||||
emit(LoginError(message: e.toString()));
|
||||
} finally {
|
||||
emit(LoginSuccess());
|
||||
}
|
||||
}
|
||||
|
||||
void _onRegistrationSubmit(RegistrationSubmit event, Emitter<LoginState> emit) async {
|
||||
|
||||
@@ -161,7 +161,7 @@ class SalesBloc extends Bloc<SalesEvent, SalesState> with Logging {
|
||||
return;
|
||||
}
|
||||
|
||||
String productSetString = splitTestRepository.getSplitTestValue("product_set_2");
|
||||
String productSetString = splitTestRepository.getSplitTestValue("product_set_5");
|
||||
log("ProductSetString: $productSetString");
|
||||
try {
|
||||
productSet = int.parse(productSetString);
|
||||
|
||||
Reference in New Issue
Block a user