Skip to content

Commit

Permalink
[FIX] Auth Desk (#1262)
Browse files Browse the repository at this point in the history
## Description

- Don't hide but close app on exit
- Hide window option
- Fix translation of labels of context menu
  • Loading branch information
prateekmedia committed Mar 30, 2024
2 parents 7950f1e + 1391cff commit e1ac5e7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
21 changes: 10 additions & 11 deletions auth/lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class _AppState extends State<App> with WindowListener, TrayListener {

Future<void> initWindowManager() async {
windowManager.addListener(this);
await windowManager.setPreventClose(true);
}

Future<void> initTrayManager() async {
Expand Down Expand Up @@ -154,11 +153,6 @@ class _AppState extends State<App> with WindowListener, TrayListener {
};
}

@override
void onWindowClose() async {
await windowManager.hide();
}

@override
void onWindowResize() {
WindowListenerService.instance.onWindowResize().ignore();
Expand Down Expand Up @@ -187,11 +181,16 @@ class _AppState extends State<App> with WindowListener, TrayListener {

@override
void onTrayMenuItemClick(MenuItem menuItem) {
if (menuItem.key == 'show_window') {
windowManager.show();
} else if (menuItem.key == 'exit_app') {
windowManager.setPreventClose(false);
windowManager.close();
switch (menuItem.key) {
case 'hide_window':
windowManager.hide();
break;
case 'show_window':
windowManager.show();
break;
case 'exit_app':
windowManager.close();
break;
}
}
}
4 changes: 4 additions & 0 deletions auth/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Future<void> initSystemTray() async {
await trayManager.setIcon(path);
Menu menu = Menu(
items: [
MenuItem(
key: 'hide_window',
label: 'Hide Window',
),
MenuItem(
key: 'show_window',
label: 'Show Window',
Expand Down
4 changes: 2 additions & 2 deletions auth/lib/ui/code_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ class _CodeWidgetState extends State<CodeWidget> {
onSelected: () => _onShowQrPressed(null),
),
MenuItem(
label: 'Edit',
label: l10n.edit,
icon: Icons.edit,
onSelected: () => _onEditPressed(null),
),
const MenuDivider(),
MenuItem(
label: 'Delete',
label: l10n.delete,
value: "Delete",
icon: Icons.delete,
onSelected: () => _onDeletePressed(null),
Expand Down
10 changes: 5 additions & 5 deletions auth/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PODS:
- sqlite3/fts5
- sqlite3/perf-threadsafe
- sqlite3/rtree
- system_tray (0.0.1):
- tray_manager (0.0.1):
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
Expand Down Expand Up @@ -91,7 +91,7 @@ DEPENDENCIES:
- sodium_libs (from `Flutter/ephemeral/.symlinks/plugins/sodium_libs/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos`)
- system_tray (from `Flutter/ephemeral/.symlinks/plugins/system_tray/macos`)
- tray_manager (from `Flutter/ephemeral/.symlinks/plugins/tray_manager/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)

Expand Down Expand Up @@ -144,8 +144,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
sqlite3_flutter_libs:
:path: Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos
system_tray:
:path: Flutter/ephemeral/.symlinks/plugins/system_tray/macos
tray_manager:
:path: Flutter/ephemeral/.symlinks/plugins/tray_manager/macos
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
window_manager:
Expand Down Expand Up @@ -177,7 +177,7 @@ SPEC CHECKSUMS:
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
sqlite3: 73b7fc691fdc43277614250e04d183740cb15078
sqlite3_flutter_libs: 06a05802529659a272beac4ee1350bfec294f386
system_tray: e53c972838c69589ff2e77d6d3abfd71332f9e5d
tray_manager: 9064e219c56d75c476e46b9a21182087930baf90
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8

Expand Down

0 comments on commit e1ac5e7

Please sign in to comment.