Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add auto-logout on session expiration

AmanRajSinghMourya294cb798b455
diff --cc mobile/apps/locker/lib/ui/pages/home_page.dart
index 6960d09af2,ed1447a215..6b435ae47d
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@@ -298,41 -289,6 +298,40 @@@ class _HomePageState extends UploaderPa
super.dispose();
}
+ Future<void> _autoLogoutAlert() async {
+ if (!mounted) return;
+
- final AlertDialog alert = AlertDialog(
- title: Text(context.l10n.sessionExpired),
- content: Text(context.l10n.pleaseLoginAgain),
- actions: [
- TextButton(
- onPressed: () async {
- Navigator.of(context).pop();
- final dialog = createProgressDialog(
- context,
- context.l10n.pleaseWait,
- );
- await dialog.show();
- await Configuration.instance.logout();
- await dialog.hide();
- if (mounted) {
- Navigator.of(context).popUntil((route) => route.isFirst);
- }
- },
- child: Text(context.l10n.ok),
- ),
- ],
- );
++ final navigator = Navigator.of(context);
++ final l10n = context.l10n;
+
+ await showDialog(
+ context: context,
+ barrierDismissible: false,
- builder: (BuildContext context) {
- return alert;
++ builder: (BuildContext dialogContext) {
++ return AlertDialog(
++ title: Text(l10n.sessionExpired),
++ content: Text(l10n.pleaseLoginAgain),
++ actions: [
++ TextButton(
++ onPressed: () async {
++ Navigator.of(dialogContext).pop();
++ final dialog = createProgressDialog(
++ dialogContext,
++ l10n.pleaseWait,
++ );
++ await dialog.show();
++ await Configuration.instance.logout();
++ await dialog.hide();
++ navigator.popUntil((route) => route.isFirst);
++ },
++ child: Text(l10n.ok),
++ ),
++ ],
++ );
+ },
+ );
+ }
+
void initializeSharing() {
_logger.info('Initializing sharing functionality...');
@@@ -595,7 -551,7 +594,9 @@@
floatingActionButton: isSearchActive
? null
: FloatingActionButton(
-- onPressed: _openSavePage,
++ onPressed: () {
++ Bus.instance.fire(TriggerLogoutEvent());
++ },
shape: const CircleBorder(),
backgroundColor: colorScheme.primary700,
elevation: 0,