From bbd06098c1fa9a101da3b53f97a2ab596b5c9f2a Mon Sep 17 00:00:00 2001 From: Thiago Carvalho <32248947+thiagocarvalhodev@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:19:09 -0300 Subject: [PATCH] Update drive_attach_cubit.dart --- lib/blocs/drive_attach/drive_attach_cubit.dart | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/blocs/drive_attach/drive_attach_cubit.dart b/lib/blocs/drive_attach/drive_attach_cubit.dart index d98b83c0da..508d008a6a 100644 --- a/lib/blocs/drive_attach/drive_attach_cubit.dart +++ b/lib/blocs/drive_attach/drive_attach_cubit.dart @@ -141,15 +141,17 @@ class DriveAttachCubit extends Cubit { profileKey: _profileKey, ); - emit(DriveAttachSuccess()); - /// Wait for the sync to finish before syncing the newly attached drive. - await _syncBloc.waitCurrentSync(); + _syncBloc.waitCurrentSync().then((value) { + logger.d('after sync drives attach'); + + /// Then, sync and select the newly attached drive. + unawaited(_syncBloc.startSync()); - /// Then, sync and select the newly attached drive. - unawaited(_syncBloc - .startSync() - .then((value) => _drivesBloc.selectDrive(driveId))); + _drivesBloc.selectDrive(driveId); + }); + + emit(DriveAttachSuccess()); PlausibleEventTracker.trackAttachDrive( drivePrivacy: drivePrivacy,