Skip to content

armgit / ente

Public Imported from GitHub
0

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

Align macOS auth reason

Prateek Sunal8ca635438fd6
diff --git a/mobile/packages/lock_screen/lib/auth_util.dart b/mobile/packages/lock_screen/lib/auth_util.dart
index eda15edd92..97cb55ee1b 100644
--- a/mobile/packages/lock_screen/lib/auth_util.dart
+++ b/mobile/packages/lock_screen/lib/auth_util.dart
@@ -12,7 +12,8 @@ import 'package:logging/logging.dart';
Future<bool> requestAuthentication(
BuildContext context,
- String reason, {
+ String defaultReason, {
+ required String macOSReason,
bool isOpeningApp = false,
bool isAuthenticatingForInAppChange = false,
}) async {
@@ -37,7 +38,7 @@ Future<bool> requestAuthentication(
await LocalAuthentication().stopAuthentication();
final l10n = context.strings;
return await LocalAuthentication().authenticate(
- localizedReason: reason,
+ localizedReason: Platform.isMacOS ? macOSReason : defaultReason,
authMessages: [
AndroidAuthMessages(
biometricHint: l10n.androidBiometricHint,
diff --git a/mobile/packages/lock_screen/lib/local_authentication_service.dart b/mobile/packages/lock_screen/lib/local_authentication_service.dart
index b265255108..3ba48c7ceb 100644
--- a/mobile/packages/lock_screen/lib/local_authentication_service.dart
+++ b/mobile/packages/lock_screen/lib/local_authentication_service.dart
@@ -5,6 +5,7 @@ import 'package:ente_lock_screen/lock_screen_settings.dart';
import 'package:ente_lock_screen/ui/app_lock.dart';
import 'package:ente_lock_screen/ui/lock_screen_password.dart';
import 'package:ente_lock_screen/ui/lock_screen_pin.dart';
+import 'package:ente_strings/ente_strings.dart';
import 'package:ente_ui/utils/dialog_util.dart';
import 'package:ente_ui/utils/toast_util.dart';
import 'package:ente_utils/platform_util.dart';
@@ -40,6 +41,7 @@ class LocalAuthenticationService {
final result = await requestAuthentication(
context,
infoMessage,
+ macOSReason: context.strings.unlock,
isAuthenticatingForInAppChange: true,
);
AppLock.of(context)!.setEnabled(
@@ -115,6 +117,7 @@ class LocalAuthenticationService {
final result = await requestAuthentication(
context,
infoMessage,
+ macOSReason: context.strings.unlock,
);
if (result) {
AppLock.of(context)!.setEnabled(shouldEnableLockScreen);
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen.dart b/mobile/packages/lock_screen/lib/ui/lock_screen.dart
index 788ac11bf4..8dfc721c42 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen.dart
@@ -323,7 +323,8 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
? false
: await requestAuthentication(
context,
- context.strings.unlock,
+ context.strings.authToViewSecrets,
+ macOSReason: context.strings.unlock,
isOpeningApp: true,
);
_logger.finest("LockScreen Result $result $currentTimestamp");