From 4243a331a30db7b68b244f75dbb6e4c2af95d83a Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:35:26 +0530 Subject: [PATCH 1/3] [auth] Log error during init --- auth/lib/main.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/auth/lib/main.dart b/auth/lib/main.dart index e837892f8cb..00de05ca92f 100644 --- a/auth/lib/main.dart +++ b/auth/lib/main.dart @@ -33,6 +33,7 @@ import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:logging/logging.dart'; import 'package:path_provider/path_provider.dart'; import 'package:tray_manager/tray_manager.dart'; +import 'package:win32/win32.dart'; import 'package:window_manager/window_manager.dart'; final _logger = Logger("main"); @@ -104,7 +105,12 @@ Future _runInForeground() async { final savedThemeMode = _themeMode(await AdaptiveTheme.getThemeMode()); return await _runWithLogs(() async { _logger.info("Starting app in foreground"); - await _init(false, via: 'mainMethod'); + try { + await _init(false, via: 'mainMethod'); + } catch (e, s) { + _logger.severe("Failed to init", e, s); + rethrow; + } final Locale? locale = await getLocale(noFallback: true); unawaited(UpdateService.instance.showUpdateNotification()); runApp( @@ -156,7 +162,7 @@ void _registerWindowsProtocol() { Future _init(bool bool, {String? via}) async { _registerWindowsProtocol(); - await initCryptoUtil(); + await CryptoUtil.init(); await PreferenceService.instance.init(); await CodeStore.instance.init(); From bb4e42331b07217758e0850a11cf53ca3d998505 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:53:38 +0530 Subject: [PATCH 2/3] [auth] Update window min size/height --- .../lib/services/window_listener_service.dart | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/auth/lib/services/window_listener_service.dart b/auth/lib/services/window_listener_service.dart index 261b56f457d..73f431116f0 100644 --- a/auth/lib/services/window_listener_service.dart +++ b/auth/lib/services/window_listener_service.dart @@ -1,11 +1,12 @@ import 'dart:async'; import 'dart:ui'; +import 'package:flutter/widgets.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:window_manager/window_manager.dart'; class WindowListenerService { - static const double minWindowHeight = 600.0; + static const double minWindowHeight = 320.0; static const double minWindowWidth = 800.0; static const double maxWindowHeight = 8192.0; static const double maxWindowWidth = 8192.0; @@ -25,21 +26,16 @@ class WindowListenerService { _preferences.getDouble('windowWidth') ?? minWindowWidth; final double windowHeight = _preferences.getDouble('windowHeight') ?? minWindowHeight; - return Size( - windowWidth.clamp(minWindowWidth, maxWindowWidth), - windowHeight.clamp(minWindowHeight, maxWindowHeight), - ); + final w = windowWidth.clamp(200.0, maxWindowWidth); + final h = windowHeight.clamp(400.0, maxWindowHeight); + return Size(w, h); } Future onWindowResize() async { + final width = (await windowManager.getSize()).width; + final height = (await windowManager.getSize()).height; // Save the window size to shared preferences - await _preferences.setDouble( - 'windowWidth', - (await windowManager.getSize()).width, - ); - await _preferences.setDouble( - 'windowHeight', - (await windowManager.getSize()).height, - ); + await _preferences.setDouble('windowWidth', width); + await _preferences.setDouble('windowHeight', height); } } From 6c68052a55c4e4989dc95b8ab7af39211720eea4 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 21 Jan 2025 11:04:24 +0530 Subject: [PATCH 3/3] Lint fix --- auth/lib/main.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/auth/lib/main.dart b/auth/lib/main.dart index 00de05ca92f..c747ac41eb4 100644 --- a/auth/lib/main.dart +++ b/auth/lib/main.dart @@ -33,7 +33,6 @@ import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:logging/logging.dart'; import 'package:path_provider/path_provider.dart'; import 'package:tray_manager/tray_manager.dart'; -import 'package:win32/win32.dart'; import 'package:window_manager/window_manager.dart'; final _logger = Logger("main");