Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge conflict: Resolved

Muhammed Ayimen4cfbe91ad464
diff --cc lib/ui/settings/data/import/import_service.dart
index 514eb9362f,0be1f572e3..79f047c7fd
--- a/lib/ui/settings/data/import/import_service.dart
+++ b/lib/ui/settings/data/import/import_service.dart
@@@ -1,5 -1,5 +1,6 @@@
import 'package:ente_auth/ui/settings/data/import/aegis_import.dart';
+import 'package:ente_auth/ui/settings/data/import/analyze_qr_code.dart';
+ import 'package:ente_auth/ui/settings/data/import/bitwarden_import.dart';
import 'package:ente_auth/ui/settings/data/import/encrypted_ente_import.dart';
import 'package:ente_auth/ui/settings/data/import/google_auth_import.dart';
import 'package:ente_auth/ui/settings/data/import/plain_text_import.dart';
@@@ -32,14 -32,8 +33,16 @@@ class ImportService
case ImportType.aegis:
showAegisImportInstruction(context);
break;
+ case ImportType.googleAuthenticatorImage:
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return const QrScanner();
+ },
+ ),
+ );
+ case ImportType.bitwarden:
+ showBitwardenImportInstruction(context);
break;
}
}
diff --cc lib/ui/settings/data/import_page.dart
index b7e1211b01,fb8c55d1ce..bebcb0a89c
--- a/lib/ui/settings/data/import_page.dart
+++ b/lib/ui/settings/data/import_page.dart
@@@ -15,7 -15,7 +15,8 @@@ enum ImportType
ravio,
googleAuthenticator,
aegis,
- googleAuthenticatorImage
++ googleAuthenticatorImage,
+ bitwarden,
}
class ImportCodePage extends StatelessWidget {
@@@ -25,7 -25,7 +26,8 @@@
ImportType.ravio,
ImportType.aegis,
ImportType.googleAuthenticator,
+ ImportType.googleAuthenticatorImage,
+ ImportType.bitwarden,
];
ImportCodePage({super.key});
@@@ -43,8 -42,8 +45,10 @@@
return 'Google Authenticator';
case ImportType.aegis:
return 'Aegis Authenticator';
+ case ImportType.googleAuthenticatorImage:
+ return 'Google Authenticator (saved image)';
+ case ImportType.bitwarden:
+ return 'Bitwarden';
}
}
diff --cc lib/ui/tools/lock_screen.dart
index a1389fc4ec,0262de56a8..202a8291e2
--- a/lib/ui/tools/lock_screen.dart
+++ b/lib/ui/tools/lock_screen.dart
@@@ -55,16 -60,65 +60,67 @@@ class _LockScreenState extends State<Lo
);
}
- Future<void> _showLockScreen() async {
- _logger.info("Showing lockscreen");
+ @override
+ void didChangeAppLifecycleState(AppLifecycleState state) {
+ _logger.info(state.toString());
+ if (state == AppLifecycleState.resumed && !_isShowingLockScreen) {
+ // This is triggered either when the lock screen is dismissed or when
+ // the app is brought to foreground
+ _hasPlacedAppInBackground = false;
+ final bool didAuthInLast5Seconds = lastAuthenticatingTime != null &&
+ DateTime.now().millisecondsSinceEpoch - lastAuthenticatingTime! <
+ 5000;
+ if (!_hasAuthenticationFailed && !didAuthInLast5Seconds) {
+ // Show the lock screen again only if the app is resuming from the
+ // background, and not when the lock screen was explicitly dismissed
+ Future.delayed(
- Duration.zero, () => _showLockScreen(source: "lifeCycle"));
++ Duration.zero,
++ () => _showLockScreen(source: "lifeCycle"),
++ );
+ } else {
+ _hasAuthenticationFailed = false; // Reset failure state
+ }
+ } else if (state == AppLifecycleState.paused ||
+ state == AppLifecycleState.inactive) {
+ // This is triggered either when the lock screen pops up or when
+ // the app is pushed to background
+ if (!_isShowingLockScreen) {
+ _hasPlacedAppInBackground = true;
+ _hasAuthenticationFailed = false; // reset failure state
+ }
+ }
+ }
+
+ @override
+ void dispose() {
+ WidgetsBinding.instance.removeObserver(this);
+ super.dispose();
+ }
+
+ Future<void> _showLockScreen({String source = ''}) async {
+ final int id = DateTime.now().millisecondsSinceEpoch;
+ _logger.info("Showing lock screen $source $id");
try {
+ _isShowingLockScreen = true;
final result = await requestAuthentication(
- "Please authenticate to view your secrets",
+ context,
+ context.l10n.authToViewSecrets,
);
+ _logger.finest("LockScreen Result $result $id");
+ _isShowingLockScreen = false;
if (result) {
+ lastAuthenticatingTime = DateTime.now().millisecondsSinceEpoch;
AppLock.of(context)!.didUnlock();
+ } else {
+ if (!_hasPlacedAppInBackground) {
+ // Treat this as a failure only if user did not explicitly
+ // put the app in background
+ _hasAuthenticationFailed = true;
+ _logger.info("Authentication failed");
+ }
}
} catch (e, s) {
+ _isShowingLockScreen = false;
_logger.severe(e, s);
}
}
diff --cc pubspec.yaml
index fc8bba25fa,82eceba351..811900f44d
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@@ -54,8 -54,10 +54,11 @@@ dependencies
intl: ^0.18.0
json_annotation: ^4.5.0
local_auth: ^2.1.7
+
+ local_auth_android: ^1.0.31
+ local_auth_ios: ^1.1.3
logging: ^1.0.1
+ mobile_scanner: ^3.5.2
modal_bottom_sheet: ^3.0.0-pre
move_to_background: ^1.0.2
open_filex: ^4.3.2