From 3ced38521bb5e9201f18fa3767fe5fe830511d98 Mon Sep 17 00:00:00 2001 From: Professional Date: Thu, 28 Sep 2023 09:26:44 -0300 Subject: [PATCH] feat(share file): allow to share file when the file is pending --- lib/blocs/file_share/file_share_cubit.dart | 4 +-- lib/blocs/file_share/file_share_state.dart | 3 +++ lib/components/file_share_dialog.dart | 30 ++++++++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/lib/blocs/file_share/file_share_cubit.dart b/lib/blocs/file_share/file_share_cubit.dart index 93fcac5bd0..02a1136ffe 100644 --- a/lib/blocs/file_share/file_share_cubit.dart +++ b/lib/blocs/file_share/file_share_cubit.dart @@ -45,9 +45,6 @@ class FileShareCubit extends Cubit { if (dataTxStatus == TransactionStatus.failed) { emit(FileShareLoadedFailedFile()); return; - } else if (dataTxStatus == TransactionStatus.pending) { - emit(FileShareLoadedPendingFile()); - return; } late Uri fileShareLink; @@ -87,6 +84,7 @@ class FileShareCubit extends Cubit { fileName: file.name, fileShareLink: fileShareLink, isPublicFile: drive.isPublic, + isPending: dataTxStatus == TransactionStatus.pending, ), ); } diff --git a/lib/blocs/file_share/file_share_state.dart b/lib/blocs/file_share/file_share_state.dart index 6bab74e769..5fb13bd996 100644 --- a/lib/blocs/file_share/file_share_state.dart +++ b/lib/blocs/file_share/file_share_state.dart @@ -25,10 +25,13 @@ class FileShareLoadSuccess extends FileShareState { /// Whether or not this file is public ie. not encrypted on the network. final bool isPublicFile; + final bool isPending; + const FileShareLoadSuccess({ required this.fileName, required this.fileShareLink, required this.isPublicFile, + required this.isPending, }); @override diff --git a/lib/components/file_share_dialog.dart b/lib/components/file_share_dialog.dart index 70be996c60..8b6883236b 100644 --- a/lib/components/file_share_dialog.dart +++ b/lib/components/file_share_dialog.dart @@ -58,9 +58,35 @@ class FileShareDialogState extends State { const Center(child: CircularProgressIndicator()) else if (state is FileShareLoadedFailedFile) Text(appLocalizationsOf(context).shareFailedFile) - else if (state is FileShareLoadedPendingFile) - Text(appLocalizationsOf(context).sharePendingFile) else if (state is FileShareLoadSuccess) ...{ + if (state.isPending) + Padding( + padding: const EdgeInsets.only(bottom: 8.0), + child: Row( + children: [ + ArDriveIcons.triangle( + color: ArDriveTheme.of(context) + .themeData + .colors + .themeWarningEmphasis, + ), + const SizedBox( + width: 8, + ), + Flexible( + child: Text( + 'Warning: This file is currently pending and may not be immediately accessible.', + style: ArDriveTypography.body.buttonNormalBold( + color: ArDriveTheme.of(context) + .themeData + .colors + .themeWarningEmphasis, + ), + ), + ), + ], + ), + ), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [