Skip to content

Commit

Permalink
Update drive_detail_cubit.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocarvalhodev committed Oct 30, 2024
1 parent 516f220 commit c9b1563
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/blocs/drive_detail/drive_detail_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
}

Future<void> changeDrive(String driveId) async {
logger.d('changeDrive on cubit: $driveId');

final drive = await _driveDao.driveById(driveId: driveId).getSingleOrNull();

if (drive == null) {
Expand Down Expand Up @@ -138,15 +140,22 @@ class DriveDetailCubit extends Cubit<DriveDetailState> {
_folderSubscription =
Rx.combineLatest3<Drive?, FolderWithContents, ProfileState, void>(
_driveRepository.watchDrive(driveId: driveId),
_driveDao.watchFolderContents(
_driveDao
.watchFolderContents(
driveId,
orderBy: contentOrderBy,
orderingMode: contentOrderingMode,
folderId: folderId,
),
)
.handleError((e) {
if (e is DriveNotFoundException) {
emit(DriveDetailLoadNotFound());
}
}),
_profileCubit.stream.startWith(ProfileCheckingAvailability()),
(drive, folderContents, _) async {
if (isClosed) {
logger.d('drive detail cubit is closed');
return;
}

Expand Down

0 comments on commit c9b1563

Please sign in to comment.