[passkey] Add additional logs
This commit is contained in:
parent
6a6cc6b2ba
commit
ce94a17b8a
2 changed files with 32 additions and 16 deletions
|
@ -4,6 +4,7 @@ import 'package:ente_auth/core/configuration.dart';
|
|||
import 'package:ente_auth/ente_theme_data.dart';
|
||||
import 'package:ente_auth/l10n/l10n.dart';
|
||||
import 'package:ente_auth/services/user_service.dart';
|
||||
import 'package:ente_auth/utils/dialog_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
|
@ -49,14 +50,24 @@ class _PasskeyPageState extends State<PasskeyPage> {
|
|||
if (!context.mounted ||
|
||||
Configuration.instance.hasConfiguredAccount() ||
|
||||
link == null) {
|
||||
_logger.warning(
|
||||
'ignored deeplink: $link contextMounted ${context.mounted} hasConfiguredAccount ${Configuration.instance.hasConfiguredAccount()}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (mounted && link.toLowerCase().startsWith("enteauth://passkey")) {
|
||||
final uri = Uri.parse(link).queryParameters['response'];
|
||||
// response to json
|
||||
final res = utf8.decode(base64.decode(uri!));
|
||||
final json = jsonDecode(res) as Map<String, dynamic>;
|
||||
await UserService.instance.onPassKeyVerified(context, json);
|
||||
try {
|
||||
if (mounted && link.toLowerCase().startsWith("enteauth://passkey")) {
|
||||
final uri = Uri.parse(link).queryParameters['response'];
|
||||
// response to json
|
||||
final res = utf8.decode(base64.decode(uri!));
|
||||
final json = jsonDecode(res) as Map<String, dynamic>;
|
||||
await UserService.instance.onPassKeyVerified(context, json);
|
||||
} else {
|
||||
_logger.info('ignored deeplink: $link mounted $mounted');
|
||||
}
|
||||
} catch (e) {
|
||||
_logger.severe('passKey: failed to handle deeplink', e);
|
||||
showGenericErrorDialog(context: context).ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:photos/core/configuration.dart';
|
|||
import 'package:photos/ente_theme_data.dart';
|
||||
import "package:photos/generated/l10n.dart";
|
||||
import 'package:photos/services/user_service.dart';
|
||||
import "package:photos/utils/dialog_util.dart";
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
|
@ -49,20 +50,24 @@ class _PasskeyPageState extends State<PasskeyPage> {
|
|||
if (!context.mounted ||
|
||||
Configuration.instance.hasConfiguredAccount() ||
|
||||
link == null) {
|
||||
_logger.warning(
|
||||
'ignored deeplink: $link contextMounted ${context.mounted} hasConfiguredAccount ${Configuration.instance.hasConfiguredAccount()}',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (mounted && link.toLowerCase().startsWith("ente://passkey")) {
|
||||
final uri = Uri.parse(link).queryParameters['response'];
|
||||
|
||||
// response to json
|
||||
final res = utf8.decode(base64.decode(uri!));
|
||||
final json = jsonDecode(res) as Map<String, dynamic>;
|
||||
|
||||
try {
|
||||
try {
|
||||
if (mounted && link.toLowerCase().startsWith("ente://passkey")) {
|
||||
final uri = Uri.parse(link).queryParameters['response'];
|
||||
// response to json
|
||||
final res = utf8.decode(base64.decode(uri!));
|
||||
final json = jsonDecode(res) as Map<String, dynamic>;
|
||||
await UserService.instance.onPassKeyVerified(context, json);
|
||||
} catch (e) {
|
||||
_logger.severe(e);
|
||||
} else {
|
||||
_logger.info('ignored deeplink: $link mounted $mounted');
|
||||
}
|
||||
} catch (e) {
|
||||
_logger.severe('passKey: failed to handle deeplink', e);
|
||||
showGenericErrorDialog(context: context, error: e).ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue