Skip to content

Commit

Permalink
Merge pull request #1392 from ardriveapp/PE-4081-allow-user-to-share-…
Browse files Browse the repository at this point in the history
…file-if-the-file-is-pending

PE-4081: feat(share file): allow to share file when the file is pending
  • Loading branch information
thiagocarvalhodev authored Sep 28, 2023
2 parents 42a98e6 + 3ced385 commit 9f41b9b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/blocs/file_share/file_share_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class FileShareCubit extends Cubit<FileShareState> {
if (dataTxStatus == TransactionStatus.failed) {
emit(FileShareLoadedFailedFile());
return;
} else if (dataTxStatus == TransactionStatus.pending) {
emit(FileShareLoadedPendingFile());
return;
}

late Uri fileShareLink;
Expand Down Expand Up @@ -87,6 +84,7 @@ class FileShareCubit extends Cubit<FileShareState> {
fileName: file.name,
fileShareLink: fileShareLink,
isPublicFile: drive.isPublic,
isPending: dataTxStatus == TransactionStatus.pending,
),
);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/blocs/file_share/file_share_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 28 additions & 2 deletions lib/components/file_share_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,35 @@ class FileShareDialogState extends State<FileShareDialog> {
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: [
Expand Down

0 comments on commit 9f41b9b

Please sign in to comment.