mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 12:11:28 -07:00
84 lines
2.4 KiB
TypeScript
84 lines
2.4 KiB
TypeScript
export function createResolveTrayIconPathHandler(deps: {
|
|
resolveTrayIconPathRuntime: (options: {
|
|
platform: string;
|
|
resourcesPath: string;
|
|
appPath: string;
|
|
dirname: string;
|
|
joinPath: (...parts: string[]) => string;
|
|
fileExists: (path: string) => boolean;
|
|
}) => string | null;
|
|
platform: string;
|
|
resourcesPath: string;
|
|
appPath: string;
|
|
dirname: string;
|
|
joinPath: (...parts: string[]) => string;
|
|
fileExists: (path: string) => boolean;
|
|
}) {
|
|
return (): string | null => {
|
|
return deps.resolveTrayIconPathRuntime({
|
|
platform: deps.platform,
|
|
resourcesPath: deps.resourcesPath,
|
|
appPath: deps.appPath,
|
|
dirname: deps.dirname,
|
|
joinPath: deps.joinPath,
|
|
fileExists: deps.fileExists,
|
|
});
|
|
};
|
|
}
|
|
|
|
export function createBuildTrayMenuTemplateHandler<TMenuItem>(deps: {
|
|
buildTrayMenuTemplateRuntime: (handlers: {
|
|
openOverlay: () => void;
|
|
openFirstRunSetup: () => void;
|
|
showFirstRunSetup: boolean;
|
|
openYomitanSettings: () => void;
|
|
openRuntimeOptions: () => void;
|
|
openJellyfinSetup: () => void;
|
|
openAnilistSetup: () => void;
|
|
quitApp: () => void;
|
|
}) => TMenuItem[];
|
|
initializeOverlayRuntime: () => void;
|
|
isOverlayRuntimeInitialized: () => boolean;
|
|
setVisibleOverlayVisible: (visible: boolean) => void;
|
|
showFirstRunSetup: () => boolean;
|
|
openFirstRunSetupWindow: () => void;
|
|
openYomitanSettings: () => void;
|
|
openRuntimeOptionsPalette: () => void;
|
|
openJellyfinSetupWindow: () => void;
|
|
openAnilistSetupWindow: () => void;
|
|
quitApp: () => void;
|
|
}) {
|
|
return (): TMenuItem[] => {
|
|
return deps.buildTrayMenuTemplateRuntime({
|
|
openOverlay: () => {
|
|
if (!deps.isOverlayRuntimeInitialized()) {
|
|
deps.initializeOverlayRuntime();
|
|
}
|
|
deps.setVisibleOverlayVisible(true);
|
|
},
|
|
openFirstRunSetup: () => {
|
|
deps.openFirstRunSetupWindow();
|
|
},
|
|
showFirstRunSetup: deps.showFirstRunSetup(),
|
|
openYomitanSettings: () => {
|
|
deps.openYomitanSettings();
|
|
},
|
|
openRuntimeOptions: () => {
|
|
if (!deps.isOverlayRuntimeInitialized()) {
|
|
deps.initializeOverlayRuntime();
|
|
}
|
|
deps.openRuntimeOptionsPalette();
|
|
},
|
|
openJellyfinSetup: () => {
|
|
deps.openJellyfinSetupWindow();
|
|
},
|
|
openAnilistSetup: () => {
|
|
deps.openAnilistSetupWindow();
|
|
},
|
|
quitApp: () => {
|
|
deps.quitApp();
|
|
},
|
|
});
|
|
};
|
|
}
|