Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix photos lock screen iOS startup, logout, and privacy cover

Manav Rathi139a79404dd5
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 9accbe9f38..a1317c063a 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -154,6 +154,7 @@ Future<void> _runInForeground(
Configuration.instance,
authReasonBuilder: (context) =>
AppLocalizations.of(context).authToViewYourMemories,
+ onLogout: (context) => UserService.instance.logout(context),
),
enabled:
await LockScreenSettings.instance.shouldShowLockScreen() ||
@@ -424,17 +425,18 @@ Future<void> _init(
packageInfo,
);
+ _logger.info("Configuration init $tlog");
+ await Configuration.instance.init(preferences);
+ _logger.info("Configuration done $tlog");
+
_logger.info("Lockscreen init $tlog");
registerCryptoApi(const PhotosCryptoApiAdapter());
await LockScreenSettings.instance.init(
Configuration.instance,
useLegacyHashFallback: true,
+ hasOptedForOfflineMode: isLocalGalleryMode,
);
- _logger.info("Configuration init $tlog");
- await Configuration.instance.init(preferences);
- _logger.info("Configuration done $tlog");
-
await MemoryShareService.instance.init();
_logger.info("UserService init $tlog");
diff --git a/mobile/packages/lock_screen/lib/ui/lock_screen.dart b/mobile/packages/lock_screen/lib/ui/lock_screen.dart
index 3212d6c742..546eb9b42d 100644
--- a/mobile/packages/lock_screen/lib/ui/lock_screen.dart
+++ b/mobile/packages/lock_screen/lib/ui/lock_screen.dart
@@ -18,11 +18,16 @@ import 'package:logging/logging.dart';
class LockScreen extends StatefulWidget {
final LockScreenHost config;
- /// Overrides the biometric prompt reason. Resolved at auth time so consumers
- /// can supply an app-specific localized message; defaults to a shared string.
final String Function(BuildContext context)? authReasonBuilder;
- const LockScreen(this.config, {this.authReasonBuilder, super.key});
+ final Future<void> Function(BuildContext context)? onLogout;
+
+ const LockScreen(
+ this.config, {
+ this.authReasonBuilder,
+ this.onLogout,
+ super.key,
+ });
@override
State<LockScreen> createState() => _LockScreenState();
@@ -188,7 +193,11 @@ class _LockScreenState extends State<LockScreen> with WidgetsBindingObserver {
firstButtonLabel: context.strings.yesLogout,
isCritical: true,
firstButtonOnTap: () async {
- await UserService.instance.logout(context);
+ if (widget.onLogout != null) {
+ await widget.onLogout!(context);
+ } else {
+ await UserService.instance.logout(context);
+ }
// To start the app afresh, resetting all state.
Process.killPid(pid, ProcessSignal.sigkill);
},
diff --git a/mobile/packages/screen_cover/ios/Classes/EnteScreenCoverPlugin.swift b/mobile/packages/screen_cover/ios/Classes/EnteScreenCoverPlugin.swift
index c8e96f4238..f901f5183b 100644
--- a/mobile/packages/screen_cover/ios/Classes/EnteScreenCoverPlugin.swift
+++ b/mobile/packages/screen_cover/ios/Classes/EnteScreenCoverPlugin.swift
@@ -32,7 +32,7 @@ public class EnteScreenCoverPlugin: NSObject, FlutterPlugin {
observing = true
NotificationCenter.default.addObserver(
self, selector: #selector(showOverlay),
- name: UIApplication.willResignActiveNotification, object: nil
+ name: UIApplication.didEnterBackgroundNotification, object: nil
)
NotificationCenter.default.addObserver(
self, selector: #selector(hideOverlay),
@@ -49,8 +49,8 @@ public class EnteScreenCoverPlugin: NSObject, FlutterPlugin {
@objc private func showOverlay() {
guard overlay == nil, let window = keyWindow() else { return }
- let cover = UIView(frame: window.bounds)
- cover.backgroundColor = .black
+ let cover = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
+ cover.frame = window.bounds
cover.autoresizingMask = [.flexibleWidth, .flexibleHeight]
window.addSubview(cover)
overlay = cover