π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][auth] review fixes: per-display popover anchoring, one-off window workspace behavior
Ivn Nv1ee66e266c6b
diff --git a/mobile/apps/auth/lib/services/window_listener_service.dart b/mobile/apps/auth/lib/services/window_listener_service.dartindex 16d3ee766e..9dbb5d6d29 100644--- a/mobile/apps/auth/lib/services/window_listener_service.dart+++ b/mobile/apps/auth/lib/services/window_listener_service.dart@@ -1,9 +1,9 @@import 'dart:async';import 'dart:io';-import 'dart:ui';import 'package:ente_auth/services/preference_service.dart';import 'package:flutter/widgets.dart';+import 'package:screen_retriever/screen_retriever.dart';import 'package:shared_preferences/shared_preferences.dart';import 'package:tray_manager/tray_manager.dart';import 'package:win32/win32.dart';@@ -122,14 +122,37 @@ class WindowListenerService with WindowListener, TrayListener {if (tray != null) {double x = tray.center.dx - w / 2;final y = tray.bottom + 4;- final display = PlatformDispatcher.instance.displays.first;- final screenW = display.size.width / display.devicePixelRatio;- x = x.clamp(8.0, screenW - w - 8.0);+ final displayBounds = await _boundsOfDisplayContaining(tray.center);+ if (displayBounds != null) {+ x = x.clamp(+ displayBounds.left + 8.0,+ displayBounds.right - w - 8.0,+ );+ }await windowManager.setBounds(Rect.fromLTWH(x, y, w, h));}await windowManager.show();}+ Future<Rect?> _boundsOfDisplayContaining(Offset point) async {+ try {+ final displays = await screenRetriever.getAllDisplays();+ Rect? fallback;+ for (final display in displays) {+ final position = display.visiblePosition;+ final size = display.visibleSize ?? display.size;+ if (position == null) continue;+ final bounds =+ Rect.fromLTWH(position.dx, position.dy, size.width, size.height);+ fallback ??= bounds;+ if (bounds.contains(point)) return bounds;+ }+ return fallback;+ } catch (_) {+ return null;+ }+ }+@overridevoid onWindowFocus() {if (Platform.isWindows || Platform.isLinux) {@@ -202,6 +225,10 @@ class WindowListenerService with WindowListener, TrayListener {Future<void> _showAsWindow() async {_isOneOffWindowed = true;await windowManager.setAlwaysOnTop(false);+ await windowManager.setVisibleOnAllWorkspaces(+ false,+ visibleOnFullScreen: false,+ );await windowManager.setTitleBarStyle(TitleBarStyle.normal);await windowManager.setMinimumSize(const Size(200, 400));await windowManager.setMaximumSize(const Size(maxWindowWidth, maxWindowHeight));@@ -222,6 +249,10 @@ class WindowListenerService with WindowListener, TrayListener {await windowManager.setMinimumSize(popoverSize);await windowManager.setMaximumSize(popoverSize);await windowManager.setAlwaysOnTop(true);+ await windowManager.setVisibleOnAllWorkspaces(+ true,+ visibleOnFullScreen: true,+ );}Future<void> _showWindow() async {diff --git a/mobile/apps/auth/pubspec.yaml b/mobile/apps/auth/pubspec.yamlindex cccf4b5f98..a39d580442 100644--- a/mobile/apps/auth/pubspec.yaml+++ b/mobile/apps/auth/pubspec.yaml@@ -117,6 +117,7 @@ dependencies:path: ../../packages/scoped_dir_accesssentry: 8.14.2sentry_flutter: 8.14.2+ screen_retriever: 0.2.1share_plus: 11.1.0shared_preferences: 2.5.3sqflite: 2.4.2