Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add unlock localization key

Prateek Sunal55fefed927c5
diff --git a/mobile/apps/auth/scripts/internal_changes.txt b/mobile/apps/auth/scripts/internal_changes.txt
index 8b13789179..662344bebd 100644
--- a/mobile/apps/auth/scripts/internal_changes.txt
+++ b/mobile/apps/auth/scripts/internal_changes.txt
@@ -1 +1,2 @@
-
+- Fixed system authentication prompt phrasing to read naturally as "... is trying to unlock ..."
+- Added shared `unlock` localization key in `ente_strings` for lock-screen auth reason
diff --git a/mobile/packages/lock_screen/lib/auth_util.dart b/mobile/packages/lock_screen/lib/auth_util.dart
index 0361a9bbfd..eda15edd92 100644
--- a/mobile/packages/lock_screen/lib/auth_util.dart
+++ b/mobile/packages/lock_screen/lib/auth_util.dart
@@ -4,6 +4,7 @@ import 'package:ente_lock_screen/local_authentication_service.dart';
import 'package:ente_lock_screen/lock_screen_settings.dart';
import 'package:ente_strings/ente_strings.dart';
import 'package:flutter/cupertino.dart';
+import 'package:flutter_local_authentication/flutter_local_authentication.dart';
import 'package:local_auth/local_auth.dart';
import 'package:local_auth_android/local_auth_android.dart';
import 'package:local_auth_darwin/types/auth_messages_ios.dart';
@@ -30,8 +31,8 @@ Future<bool> requestAuthentication(
);
}
if (Platform.isLinux) {
- // Device lock is temporarily disabled on Linux.
- return true;
+ // Linux uses flutter_local_authentication
+ return await FlutterLocalAuthentication().authenticate();
} else {
await LocalAuthentication().stopAuthentication();
final l10n = context.strings;
diff --git a/mobile/packages/lock_screen/lib/local_authentication_service.dart b/mobile/packages/lock_screen/lib/local_authentication_service.dart
index 5742b86b3a..b265255108 100644
--- a/mobile/packages/lock_screen/lib/local_authentication_service.dart
+++ b/mobile/packages/lock_screen/lib/local_authentication_service.dart
@@ -11,6 +11,7 @@ import 'package:ente_utils/platform_util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_local_authentication/flutter_local_authentication.dart';
import 'package:local_auth/local_auth.dart';
import 'package:logging/logging.dart';
@@ -138,10 +139,9 @@ class LocalAuthenticationService {
Future<bool> isLocalAuthSupportedOnDevice() async {
try {
- if (Platform.isLinux) {
- return false;
- }
- return await LocalAuthentication().isDeviceSupported();
+ return Platform.isLinux
+ ? await FlutterLocalAuthentication().canAuthenticate()
+ : await LocalAuthentication().isDeviceSupported();
} on MissingPluginException {
return false;
}
diff --git a/mobile/packages/lock_screen/lib/lock_screen_settings.dart b/mobile/packages/lock_screen/lib/lock_screen_settings.dart
index ca33934c4f..95e5a82f66 100644
--- a/mobile/packages/lock_screen/lib/lock_screen_settings.dart
+++ b/mobile/packages/lock_screen/lib/lock_screen_settings.dart
@@ -227,9 +227,6 @@ class LockScreenSettings {
}
bool shouldShowSystemLockScreen() {
- if (Platform.isLinux) {
- return false;
- }
if (_preferences.containsKey(keyShouldShowLockScreen)) {
return _preferences.getBool(keyShouldShowLockScreen)!;
} else {
@@ -238,9 +235,6 @@ class LockScreenSettings {
}
Future<void> setSystemLockScreen(bool value) {
- if (Platform.isLinux) {
- return _preferences.setBool(keyShouldShowLockScreen, false);
- }
return _preferences.setBool(keyShouldShowLockScreen, value);
}
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart b/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart
index 0eb2391473..12c5cb9427 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen_options.dart
@@ -174,7 +174,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final bool showDeviceLockOption = !Platform.isLinux;
return Scaffold(
body: ConstrainedCustomScrollView(
slivers: <Widget>[
@@ -240,37 +239,32 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (showDeviceLockOption) ...[
- MenuItemWidget(
- captionedTextWidget:
- CaptionedTextWidget(
- title: context.strings.deviceLock,
- ),
- surfaceExecutionStates: false,
- alignCaptionedTextToLeft: true,
- isTopBorderRadiusRemoved: false,
- isBottomBorderRadiusRemoved: true,
- menuItemColor: colorTheme.fillFaint,
- trailingIcon: isSystemLockEnabled
- ? Icons.check
- : null,
- trailingIconColor:
- colorTheme.textBase,
- onTap: () => _deviceLock(),
- ),
- DividerWidget(
- dividerType: DividerType.menuNoIcon,
- bgColor: colorTheme.fillFaint,
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: context.strings.deviceLock,
),
- ],
+ surfaceExecutionStates: false,
+ alignCaptionedTextToLeft: true,
+ isTopBorderRadiusRemoved: false,
+ isBottomBorderRadiusRemoved: true,
+ menuItemColor: colorTheme.fillFaint,
+ trailingIcon: isSystemLockEnabled
+ ? Icons.check
+ : null,
+ trailingIconColor: colorTheme.textBase,
+ onTap: () => _deviceLock(),
+ ),
+ DividerWidget(
+ dividerType: DividerType.menuNoIcon,
+ bgColor: colorTheme.fillFaint,
+ ),
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: context.strings.pinLock,
),
surfaceExecutionStates: false,
alignCaptionedTextToLeft: true,
- isTopBorderRadiusRemoved:
- showDeviceLockOption,
+ isTopBorderRadiusRemoved: true,
isBottomBorderRadiusRemoved: true,
menuItemColor: colorTheme.fillFaint,
trailingIcon: