Skip to content

Commit

Permalink
feat(getting started page): puts a loading screen PE-4742
Browse files Browse the repository at this point in the history
  • Loading branch information
matibat committed Oct 23, 2023
1 parent 08a2d25 commit 1f06d16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/authentication/login/blocs/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
required UserRepository userRepository,
}) : _arDriveAuth = arDriveAuth,
_arConnectService = arConnectService,
super(LoginLoading()) {
super(const LoginLoading()) {
on<LoginEvent>(_onLoginEvent);
_listenToWalletChange();
}
Expand Down Expand Up @@ -161,7 +161,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
CheckIfUserIsLoggedIn event,
Emitter<LoginState> emit,
) async {
emit(LoginLoading());
emit(const LoginLoading());

if (await _arDriveAuth.isUserLoggedIn()) {
if (await _arDriveAuth.isBiometricsEnabled()) {
Expand Down Expand Up @@ -190,7 +190,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
) async {
final previousState = state;

emit(LoginLoading());
emit(const LoginLoading());

try {
final user = await _arDriveAuth.unlockUser(password: event.password);
Expand All @@ -212,7 +212,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
) async {
final previousState = state;

emit(LoginLoading());
emit(const LoginLoading());

try {
await _verifyArConnectWalletAddressAndLogin(
Expand All @@ -235,7 +235,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
final previousState = state;

try {
emit(LoginLoading());
emit(const LoginLoading());

bool hasPermissions = await _arConnectService.checkPermissions();
if (!hasPermissions) {
Expand Down Expand Up @@ -353,7 +353,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
Future<void> _loginWithBiometrics({
required Emitter<LoginState> emit,
}) async {
emit(LoginLoading());
emit(const LoginLoading());

final user = await _arDriveAuth.unlockWithBiometrics(
localizedReason: 'Login using credentials stored on this device');
Expand Down
4 changes: 3 additions & 1 deletion lib/authentication/login/blocs/login_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class LoginInitial extends LoginState {
final bool isArConnectAvailable;
}

class LoginLoading extends LoginState {}
class LoginLoading extends LoginState {
const LoginLoading();
}

class LoginOnBoarding extends LoginState {
const LoginOnBoarding(this.walletFile);
Expand Down
4 changes: 4 additions & 0 deletions lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class _LoginPageState extends State<LoginPage> {
view = OnBoardingView(wallet: state.walletFile);
} else if (state is LoginCreateNewWallet) {
view = CreateNewWalletView(mnemonic: state.mnemonic);
} else if (state is LoginLoading && widget.gettingStarted) {
view = const Center(
child: CircularProgressIndicator(),
);
} else {
view = const LoginPageScaffold();
}
Expand Down

0 comments on commit 1f06d16

Please sign in to comment.