diff --git a/lib/blocs/upload/upload_cubit.dart b/lib/blocs/upload/upload_cubit.dart index 970f80e304..1ade9bed53 100644 --- a/lib/blocs/upload/upload_cubit.dart +++ b/lib/blocs/upload/upload_cubit.dart @@ -785,24 +785,10 @@ class UploadCubit extends Cubit { if (!hasEmittedError) { addError(error); hasEmittedError = true; - } + } }, ); return uploader; } } - -// double calculateTotalPercentage(List progressList) { -// double totalProgress = 0; -// int totalSize = 0; - -// for (var item in progressList) { -// totalProgress += item.progress * item.totalSize; -// totalSize += item.totalSize; -// } - -// if (totalSize == 0) return 0.0; // Avoid division by zero - -// return totalProgress / totalSize; -// } diff --git a/lib/pages/drive_detail/components/drive_explorer_item_tile.dart b/lib/pages/drive_detail/components/drive_explorer_item_tile.dart index 3242497593..3c71d56456 100644 --- a/lib/pages/drive_detail/components/drive_explorer_item_tile.dart +++ b/lib/pages/drive_detail/components/drive_explorer_item_tile.dart @@ -66,7 +66,7 @@ class DriveExplorerItemTileLeading extends StatelessWidget { children: [ Align( alignment: Alignment.center, - child: _getIconForContentType( + child: getIconForContentType( item.contentType, ), ), @@ -110,43 +110,41 @@ class DriveExplorerItemTileLeading extends StatelessWidget { ), ); } +} - ArDriveIcon _getIconForContentType(String contentType) { - const size = 18.0; - - if (contentType == 'folder') { - return ArDriveIcons.folderOutline( - size: size, - ); - } else if (FileTypeHelper.isZip(contentType)) { - return ArDriveIcons.zip( - size: size, - ); - } else if (FileTypeHelper.isImage(contentType)) { - return ArDriveIcons.image( - size: size, - ); - } else if (FileTypeHelper.isVideo(contentType)) { - return ArDriveIcons.video( - size: size, - ); - } else if (FileTypeHelper.isAudio(contentType)) { - return ArDriveIcons.music( - size: size, - ); - } else if (FileTypeHelper.isDoc(contentType)) { - return ArDriveIcons.fileOutlined( - size: size, - ); - } else if (FileTypeHelper.isCode(contentType)) { - return ArDriveIcons.fileOutlined( - size: size, - ); - } else { - return ArDriveIcons.fileOutlined( - size: size, - ); - } +ArDriveIcon getIconForContentType(String contentType, {double size = 18}) { + if (contentType == 'folder') { + return ArDriveIcons.folderOutline( + size: size, + ); + } else if (FileTypeHelper.isZip(contentType)) { + return ArDriveIcons.zip( + size: size, + ); + } else if (FileTypeHelper.isImage(contentType)) { + return ArDriveIcons.image( + size: size, + ); + } else if (FileTypeHelper.isVideo(contentType)) { + return ArDriveIcons.video( + size: size, + ); + } else if (FileTypeHelper.isAudio(contentType)) { + return ArDriveIcons.music( + size: size, + ); + } else if (FileTypeHelper.isDoc(contentType)) { + return ArDriveIcons.fileOutlined( + size: size, + ); + } else if (FileTypeHelper.isCode(contentType)) { + return ArDriveIcons.fileOutlined( + size: size, + ); + } else { + return ArDriveIcons.fileOutlined( + size: size, + ); } } diff --git a/packages/ardrive_uploader/lib/src/ardrive_uploader.dart b/packages/ardrive_uploader/lib/src/ardrive_uploader.dart index f99a59a20a..c825079f35 100644 --- a/packages/ardrive_uploader/lib/src/ardrive_uploader.dart +++ b/packages/ardrive_uploader/lib/src/ardrive_uploader.dart @@ -324,12 +324,16 @@ class _ArDriveUploader implements ArDriveUploader { ); /// Attaches the upload controller to the upload service - _uploadFiles(files: files, wallet: wallet, controller: uploadController); + _uploadFiles( + files: files, + wallet: wallet, + controller: uploadController, + driveKey: driveKey, + ); return uploadController; } - // TODO: broken logic. Future _uploadFiles({ required List<(ARFSUploadMetadataArgs, IOFile)> files, required Wallet wallet, diff --git a/packages/ardrive_uploader/lib/src/upload_controller.dart b/packages/ardrive_uploader/lib/src/upload_controller.dart index 26c9e2ca05..30453a5bbc 100644 --- a/packages/ardrive_uploader/lib/src/upload_controller.dart +++ b/packages/ardrive_uploader/lib/src/upload_controller.dart @@ -110,7 +110,7 @@ class _UploadController implements UploadController { late StreamSubscription subscription; subscription = - _progressStream.stream.debounceTime(Duration(milliseconds: 50)).listen( + _progressStream.stream.debounceTime(Duration(milliseconds: 100)).listen( (event) async { _start ??= DateTime.now();