Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(auth): update parse error message

Prateek Sunalb714392fb279
diff --git a/auth/lib/l10n/arb/app_en.arb b/auth/lib/l10n/arb/app_en.arb
index f6c8c7cc7e..e4d1a07a50 100644
--- a/auth/lib/l10n/arb/app_en.arb
+++ b/auth/lib/l10n/arb/app_en.arb
@@ -435,6 +435,6 @@
"editTag": "Edit Tag",
"deleteTagTitle": "Delete tag?",
"deleteTagMessage": "Are you sure you want to delete this tag? This action is irreversible.",
- "somethingWentWrongUpdateApp": "Something went wrong, please update the app",
+ "somethingWentWrongParsingCode": "We were unable to parse {x} codes.",
"updateNotAvailable": "Update not available"
}
\ No newline at end of file
diff --git a/auth/lib/store/code_store.dart b/auth/lib/store/code_store.dart
index a5e17e249b..7995aea1e5 100644
--- a/auth/lib/store/code_store.dart
+++ b/auth/lib/store/code_store.dart
@@ -26,7 +26,7 @@ class CodeStore {
final mode = accountMode ?? _authenticatorService.getAccountMode();
final List<EntityResult> entities =
await _authenticatorService.getEntities(mode);
- final List<Code> codes = [];
+ final List<Code> codes = [Code.withError("error", "gsd")];
for (final entity in entities) {
late Code code;
diff --git a/auth/lib/ui/code_error_widget.dart b/auth/lib/ui/code_error_widget.dart
index 6aaa96436b..ec532ccba2 100644
--- a/auth/lib/ui/code_error_widget.dart
+++ b/auth/lib/ui/code_error_widget.dart
@@ -1,15 +1,18 @@
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
-import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/common/gradient_button.dart';
import 'package:ente_auth/ui/linear_progress_widget.dart';
-import 'package:ente_auth/ui/settings/app_update_dialog.dart';
-import 'package:ente_auth/utils/toast_util.dart';
+import 'package:ente_auth/utils/dialog_util.dart';
import 'package:flutter/material.dart';
class CodeErrorWidget extends StatelessWidget {
- const CodeErrorWidget({super.key});
+ const CodeErrorWidget({
+ super.key,
+ required this.errors,
+ });
+
+ final int errors;
@override
Widget build(BuildContext context) {
@@ -40,7 +43,7 @@ class CodeErrorWidget extends StatelessWidget {
fractionOfStorage: 1,
),
),
- const SizedBox(height: 24),
+ const SizedBox(height: 16),
Row(
children: [
const SizedBox(width: 8),
@@ -67,44 +70,30 @@ class CodeErrorWidget extends StatelessWidget {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
- context.l10n.somethingWentWrongUpdateApp,
+ context.l10n.somethingWentWrongParsingCode(errors),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
- const SizedBox(height: 12),
+ const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
- width: 76,
+ width: 102,
height: 28,
child: GradientButton(
- text: context.l10n.update,
+ text: context.l10n.contactSupport,
fontSize: 10,
onTap: () async {
- try {
- await UpdateService.instance.shouldUpdate();
- assert(
- UpdateService.instance.getLatestVersionInfo() != null,
- );
- await showDialog(
- context: context,
- builder: (BuildContext context) {
- return AppUpdateDialog(
- UpdateService.instance.getLatestVersionInfo(),
- );
- },
- barrierColor: Colors.black.withOpacity(0.85),
- );
- } catch (e) {
- showToast(
- context,
- context.l10n.updateNotAvailable,
- );
- }
+ await showErrorDialog(
+ context,
+ context.l10n.contactSupport,
+ context.l10n
+ .contactSupportViaEmailMessage("[email protected]"),
+ );
},
borderWidth: 0.6,
borderRadius: 6,
@@ -113,6 +102,7 @@ class CodeErrorWidget extends StatelessWidget {
const SizedBox(width: 6),
],
),
+ const SizedBox(height: 12),
],
),
),
diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dart
index 7dbcb2c8fc..2650d334a3 100644
--- a/auth/lib/ui/home_page.dart
+++ b/auth/lib/ui/home_page.dart
@@ -356,7 +356,12 @@ class _HomePageState extends State<HomePage> {
padding: const EdgeInsets.only(bottom: 80),
itemBuilder: ((context, index) {
if (index == 0 && anyCodeHasError) {
- return const CodeErrorWidget();
+ return CodeErrorWidget(
+ errors: _allCodes
+ ?.where((element) => element.hasError)
+ .length ??
+ 0,
+ );
}
final newIndex = index - indexOffset;