Skip to content

Commit

Permalink
fix(upload folder)
Browse files Browse the repository at this point in the history
- dont show loading files modal when selecting folders
  • Loading branch information
thiagocarvalhodev committed Oct 8, 2024
1 parent fff9b74 commit de00862
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/blocs/upload/upload_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class UploadCubit extends Cubit<UploadState> {
_arnsRepository = arnsRepository,
_uploadRepository = uploadRepository,
_uploadThumbnail = configService.config.uploadThumbnails,
super(UploadLoadingFiles());
super(uploadFolders ? UploadLoadingFolders() : UploadLoadingFiles());

// Dependencies
final UploadRepository _uploadRepository;
Expand Down
2 changes: 2 additions & 0 deletions lib/blocs/upload/upload_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,5 @@ enum UploadErrors {
turboTimeout,
unknown,
}

class UploadLoadingFolders extends UploadState {}
50 changes: 24 additions & 26 deletions lib/components/upload_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,32 @@ Future<void> promptToUpload(
}) async {
final driveDetailCubit = context.read<DriveDetailCubit>();

final uploadCubit = BlocProvider<UploadCubit>(
create: (context) {
final cubit = UploadCubit(
activityTracker: context.read<ActivityTracker>(),
arDriveUploadManager: context.read<ArDriveUploadPreparationManager>(),
uploadFileSizeChecker: context.read<UploadFileSizeChecker>(),
driveId: driveId,
parentFolderId: parentFolderId,
profileCubit: context.read<ProfileCubit>(),
driveDao: context.read<DriveDao>(),
uploadFolders: isFolderUpload,
auth: context.read<ArDriveAuth>(),
configService: context.read<ConfigService>(),
arnsRepository: context.read<ARNSRepository>(),
uploadRepository: context.read<UploadRepository>(),
);
final cubit = UploadCubit(
activityTracker: context.read<ActivityTracker>(),
arDriveUploadManager: context.read<ArDriveUploadPreparationManager>(),
uploadFileSizeChecker: context.read<UploadFileSizeChecker>(),
driveId: driveId,
parentFolderId: parentFolderId,
profileCubit: context.read<ProfileCubit>(),
driveDao: context.read<DriveDao>(),
uploadFolders: isFolderUpload,
auth: context.read<ArDriveAuth>(),
configService: context.read<ConfigService>(),
arnsRepository: context.read<ARNSRepository>(),
uploadRepository: context.read<UploadRepository>(),
);

if (files != null) {
cubit.selectFiles(files, parentFolderId);
} else if (isFolderUpload) {
cubit.pickFilesFromFolder(
context: context, parentFolderId: parentFolderId);
} else {
cubit.pickFiles(context: context, parentFolderId: parentFolderId);
}
if (files != null) {
cubit.selectFiles(files, parentFolderId);
} else if (isFolderUpload) {
await cubit.pickFilesFromFolder(
context: context, parentFolderId: parentFolderId);
} else {
cubit.pickFiles(context: context, parentFolderId: parentFolderId);
}

return cubit;
},
final uploadCubit = BlocProvider<UploadCubit>(
create: (context) => cubit,
);

final uploadPaymentMethodBloc = BlocProvider(
Expand Down

0 comments on commit de00862

Please sign in to comment.