mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Replace all uses of stopServicesAndExitApp with requestQuitOfApp
- Also updated tests with new behaviour Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
4ff3186ca7
commit
2c4a7ecfb4
8 files changed
+43
-110
No files matched your search
+10
-27
@@ -5,37 +5,20 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { trayMenuItemInjectionToken } from "../tray-menu-item-injection-token";
|
||||
import { computed } from "mobx";
|
||||
import stopServicesAndExitAppInjectable from "../../../stop-services-and-exit-app.injectable";
|
||||
import { withErrorSuppression } from "../../../../common/utils/with-error-suppression/with-error-suppression";
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import withErrorLoggingInjectable from "../../../../common/utils/with-error-logging/with-error-logging.injectable";
|
||||
import requestQuitOfAppInjectable from "../../../electron-app/features/require-quit.injectable";
|
||||
|
||||
const quitAppTrayItemInjectable = getInjectable({
|
||||
id: "quit-app-tray-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
||||
const withErrorLoggingFor = di.inject(withErrorLoggingInjectable);
|
||||
|
||||
return {
|
||||
id: "quit-app",
|
||||
parentId: null,
|
||||
orderNumber: 150,
|
||||
label: computed(() => "Quit App"),
|
||||
enabled: computed(() => true),
|
||||
visible: computed(() => true),
|
||||
|
||||
click: pipeline(
|
||||
stopServicesAndExitApp,
|
||||
|
||||
withErrorLoggingFor(() => "[TRAY]: Quitting application failed."),
|
||||
|
||||
// TODO: Find out how to improve typing so that instead of
|
||||
// x => withErrorSuppression(x) there could only be withErrorSuppression
|
||||
(x) => withErrorSuppression(x),
|
||||
),
|
||||
};
|
||||
},
|
||||
instantiate: (di) => ({
|
||||
id: "quit-app",
|
||||
parentId: null,
|
||||
orderNumber: 150,
|
||||
label: computed(() => "Quit App"),
|
||||
enabled: computed(() => true),
|
||||
visible: computed(() => true),
|
||||
click: di.inject(requestQuitOfAppInjectable),
|
||||
}),
|
||||
|
||||
injectionToken: trayMenuItemInjectionToken,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user