Skip to content

armgit / ente

Public Imported from GitHub
0

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

[passkey][mob] Minor fixes

Neeraj Guptaf5c9fa3d6c5e
diff --git a/auth/lib/ui/passkey_page.dart b/auth/lib/ui/passkey_page.dart
index 5479e79fe9..2380ebbc7c 100644
--- a/auth/lib/ui/passkey_page.dart
+++ b/auth/lib/ui/passkey_page.dart
@@ -58,6 +58,7 @@ class _PasskeyPageState extends State<PasskeyPage> {
.getTokenForPasskeySession(widget.sessionID);
} on PassKeySessionNotVerifiedError catch (e) {
showToast(context, context.l10n.passKeyPendingVerification);
+ return;
} on PassKeySessionExpiredError catch (e) {
await showErrorDialog(
context,
@@ -156,7 +157,14 @@ class _PasskeyPageState extends State<PasskeyPage> {
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.checkStatus,
- onTap: checkStatus,
+ onTap: () async {
+ try {
+ await checkStatus();
+ } catch (e) {
+ debugPrint('failed to check status %e');
+ showGenericErrorDialog(context: context).ignore();
+ }
+ },
shouldSurfaceExecutionStates: true,
),
const Padding(padding: EdgeInsets.all(30)),
diff --git a/mobile/lib/services/user_service.dart b/mobile/lib/services/user_service.dart
index 1a58a3328a..511627ba9a 100644
--- a/mobile/lib/services/user_service.dart
+++ b/mobile/lib/services/user_service.dart
@@ -16,6 +16,7 @@ import "package:photos/events/account_configured_event.dart";
import 'package:photos/events/two_factor_status_change_event.dart';
import 'package:photos/events/user_details_changed_event.dart';
import "package:photos/generated/l10n.dart";
+import "package:photos/l10n/l10n.dart";
import "package:photos/models/account/two_factor.dart";
import "package:photos/models/api/user/srp.dart";
import 'package:photos/models/delete_account.dart';
@@ -334,22 +335,31 @@ class UserService {
}
Future<void> onPassKeyVerified(BuildContext context, Map response) async {
- final userPassword = Configuration.instance.getVolatilePassword();
- if (userPassword == null) throw Exception("volatile password is null");
+ final ProgressDialog dialog =
+ createProgressDialog(context, context.l10n.pleaseWait);
+ await dialog.show();
+ try {
+ final userPassword = Configuration.instance.getVolatilePassword();
+ if (userPassword == null) throw Exception("volatile password is null");
- await _saveConfiguration(response);
+ await _saveConfiguration(response);
- if (Configuration.instance.getEncryptedToken() != null) {
- await Configuration.instance.decryptSecretsAndGetKeyEncKey(
- userPassword,
- Configuration.instance.getKeyAttributes()!,
- );
- } else {
- throw Exception("unexpected response during passkey verification");
+ if (Configuration.instance.getEncryptedToken() != null) {
+ await Configuration.instance.decryptSecretsAndGetKeyEncKey(
+ userPassword,
+ Configuration.instance.getKeyAttributes()!,
+ );
+ } else {
+ throw Exception("unexpected response during passkey verification");
+ }
+ await dialog.hide();
+ Navigator.of(context).popUntil((route) => route.isFirst);
+ Bus.instance.fire(AccountConfiguredEvent());
+ } catch (e) {
+ _logger.severe(e);
+ await dialog.hide();
+ await showGenericErrorDialog(context: context, error: e);
}
-
- Navigator.of(context).popUntil((route) => route.isFirst);
- Bus.instance.fire(AccountConfiguredEvent());
}
Future<void> verifyEmail(
diff --git a/mobile/lib/ui/account/passkey_page.dart b/mobile/lib/ui/account/passkey_page.dart
index 073f27693a..499512edda 100644
--- a/mobile/lib/ui/account/passkey_page.dart
+++ b/mobile/lib/ui/account/passkey_page.dart
@@ -58,6 +58,7 @@ class _PasskeyPageState extends State<PasskeyPage> {
.getTokenForPasskeySession(widget.sessionID);
} on PassKeySessionNotVerifiedError catch (e) {
showToast(context, context.l10n.passKeyPendingVerification);
+ return;
} on PassKeySessionExpiredError catch (e) {
await showErrorDialog(
context,
@@ -155,7 +156,14 @@ class _PasskeyPageState extends State<PasskeyPage> {
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.checkStatus,
- onTap: checkStatus,
+ onTap: () async {
+ try {
+ await checkStatus();
+ } catch (e) {
+ debugPrint('failed to check status %e');
+ showGenericErrorDialog(context: context, error: e).ignore();
+ }
+ },
shouldSurfaceExecutionStates: true,
),
const Padding(padding: EdgeInsets.all(30)),