fix: update backup failed dialog to make UX better

This commit is contained in:
Prateek Sunal
2025-05-02 15:35:43 +05:30
parent 3d924ab514
commit 05a42efb1b
2 changed files with 36 additions and 12 deletions

View File

@@ -721,6 +721,7 @@
"type": "text"
},
"backupFailed": "Backup failed",
"sorryBackupFailedDesc": "Sorry, we could not backup this file right now, we will retry later.",
"couldNotBackUpTryLater": "We could not backup your data.\nWe will retry later.",
"enteCanEncryptAndPreserveFilesOnlyIfYouGrant": "Ente can encrypt and preserve files only if you grant access to them",
"pleaseGrantPermissions": "Please grant permissions",

View File

@@ -1,12 +1,16 @@
import "dart:async";
import 'package:flutter/material.dart';
import "package:photos/generated/l10n.dart";
import "package:photos/models/backup/backup_item.dart";
import "package:photos/models/backup/backup_item_status.dart";
import 'package:photos/theme/ente_theme.dart';
import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/dialog_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/viewer/file/detail_page.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/email_util.dart";
import "package:photos/utils/file_uploader.dart";
import "package:photos/utils/navigation_util.dart";
@@ -137,17 +141,36 @@ class _BackupItemCardState extends State<BackupItemCard> {
color: getEnteColorScheme(context).fillBase,
),
onPressed: () {
String errorMessage = "";
if (widget.item.error is Exception) {
final Exception ex = widget.item.error as Exception;
errorMessage = "Error: " +
ex.runtimeType.toString() +
" - " +
ex.toString();
} else if (widget.item.error != null) {
errorMessage = widget.item.error.toString();
}
showErrorDialog(context, 'Upload failed', errorMessage);
showDialogWidget(
context: context,
body: S.of(context).sorryBackupFailedDesc,
title: S.of(context).backupFailed,
icon: Icons.error_outline_outlined,
isDismissible: true,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: S.of(context).contactSupport,
buttonAction: ButtonAction.second,
onTap: () async {
await sendLogs(
context,
S.of(context).contactSupport,
"support@ente.io",
postShare: () {},
);
},
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: S.of(context).ok,
buttonAction: ButtonAction.first,
onTap: () async {
Navigator.of(context).pop();
},
),
],
);
},
),
),