Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Added button to logout from Lockscreen

Aman Raj Singh Mouryae807712cdc2e
diff --git a/mobile/lib/ui/tools/lock_screen.dart b/mobile/lib/ui/tools/lock_screen.dart
index 18c407bb32..15f9d0250b 100644
--- a/mobile/lib/ui/tools/lock_screen.dart
+++ b/mobile/lib/ui/tools/lock_screen.dart
@@ -9,6 +9,7 @@ import 'package:logging/logging.dart';
import "package:photos/core/configuration.dart";
import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
+import "package:photos/services/user_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import 'package:photos/ui/tools/app_lock.dart';
@@ -60,6 +61,16 @@ class _LockScreenState extends State<LockScreen>
final colorTheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
return Scaffold(
+ appBar: AppBar(
+ elevation: 0,
+ leading: IconButton(
+ icon: const Icon(Icons.logout_outlined),
+ color: Theme.of(context).iconTheme.color,
+ onPressed: () {
+ _onLogoutTapped(context);
+ },
+ ),
+ ),
body: GestureDetector(
onTap: () {
isTimerRunning ? null : _showLockScreen(source: "tap");
@@ -194,6 +205,18 @@ class _LockScreenState extends State<LockScreen>
return shortestSide > 600 ? true : false;
}
+ void _onLogoutTapped(BuildContext context) {
+ showChoiceActionSheet(
+ context,
+ title: S.of(context).areYouSureYouWantToLogout,
+ firstButtonLabel: S.of(context).yesLogout,
+ isCritical: true,
+ firstButtonOnTap: () async {
+ await UserService.instance.logout(context);
+ },
+ );
+ }
+
Future<void> _autoLogoutOnMaxInvalidAttempts() async {
_logger.info("Auto logout on max invalid attempts");
Navigator.of(context).popUntil((route) => route.isFirst);