Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-4081: feat(share file): allow to share file when the file is pending #1392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -58,9 +58,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.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you create the translation key?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have one already. We need to change it on the localizely. It's not possible now because changing there, we'll update the same translation on other PRs

style: ArDriveTypography.body.buttonNormalBold(
color: ArDriveTheme.of(context)
.themeData
.colors
.themeWarningEmphasis,
),
),
),
],
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expand Down