Skip to content

Commit

Permalink
Refactor: いらないhotkeyデフォルト設定取得関数を失くす (#2393)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Dec 15, 2024
1 parent 85f488a commit 4233089
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 27 deletions.
4 changes: 0 additions & 4 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { getConfigManager } from "./browserConfig";
import { IpcSOData } from "@/type/ipc";
import {
defaultHotkeySettings,
defaultToolbarButtonSetting,
EngineId,
EngineSettingType,
Expand Down Expand Up @@ -247,9 +246,6 @@ export const api: Sandbox = {
changePinWindow() {
throw new Error(`Not supported on Browser version: changePinWindow`);
},
getDefaultHotkeySettings() {
return Promise.resolve(defaultHotkeySettings);
},
getDefaultToolbarSetting() {
return Promise.resolve(defaultToolbarButtonSetting);
},
Expand Down
5 changes: 0 additions & 5 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { AssetTextFileNames } from "@/type/staticResources";
import {
EngineInfo,
SystemError,
defaultHotkeySettings,
defaultToolbarButtonSetting,
EngineId,
TextAsset,
Expand Down Expand Up @@ -695,10 +694,6 @@ registerIpcMainHandle<IpcMainHandle>({
}
},

GET_DEFAULT_HOTKEY_SETTINGS: () => {
return defaultHotkeySettings;
},

GET_DEFAULT_TOOLBAR_SETTING: () => {
return defaultToolbarButtonSetting;
},
Expand Down
4 changes: 0 additions & 4 deletions src/backend/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ const api: Sandbox = {
return ipcRendererInvokeProxy.HOTKEY_SETTINGS({ newData });
},

getDefaultHotkeySettings: async () => {
return await ipcRendererInvokeProxy.GET_DEFAULT_HOTKEY_SETTINGS();
},

getDefaultToolbarSetting: async () => {
return await ipcRendererInvokeProxy.GET_DEFAULT_TOOLBAR_SETTING();
},
Expand Down
11 changes: 3 additions & 8 deletions src/components/Dialog/HotkeySettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ import BaseIconButton from "@/components/Base/BaseIconButton.vue";
import BaseScrollArea from "@/components/Base/BaseScrollArea.vue";
import { useStore } from "@/store";
import {
defaultHotkeySettings,
HotkeyActionNameType,
HotkeyCombination,
HotkeySettingType,
} from "@/type/preload";
import { useHotkeyManager, eventToCombination } from "@/plugins/hotkeyPlugin";
Expand Down Expand Up @@ -225,13 +225,8 @@ const setHotkeyDialogOpened = () => {
document.removeEventListener("keydown", recordCombination);
};
const defaultSettings = ref<HotkeySettingType[]>([]);
void window.backend
.getDefaultHotkeySettings()
.then((settings) => (defaultSettings.value = settings));
const isDefaultCombination = (action: string) => {
const defaultSetting = defaultSettings.value.find(
const defaultSetting = defaultHotkeySettings.find(
(value) => value.action === action,
);
const hotkeySetting = hotkeySettings.value.find(
Expand All @@ -249,7 +244,7 @@ const resetHotkey = async (action: string) => {
if (result !== "OK") return;
const setting = defaultSettings.value.find((value) => value.action == action);
const setting = defaultHotkeySettings.find((value) => value.action == action);
if (setting == undefined) {
return;
}
Expand Down
5 changes: 0 additions & 5 deletions src/type/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ export type IpcIHData = {
return: HotkeySettingType[];
};

GET_DEFAULT_HOTKEY_SETTINGS: {
args: [];
return: HotkeySettingType[];
};

GET_DEFAULT_TOOLBAR_SETTING: {
args: [];
return: ToolbarSettingType;
Expand Down
1 change: 0 additions & 1 deletion src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ export interface Sandbox {
hotkeySettings(newData?: HotkeySettingType): Promise<HotkeySettingType[]>;
checkFileExists(file: string): Promise<boolean>;
changePinWindow(): void;
getDefaultHotkeySettings(): Promise<HotkeySettingType[]>;
getDefaultToolbarSetting(): Promise<ToolbarSettingType>;
setNativeTheme(source: NativeThemeType): void;
vuexReady(): void;
Expand Down

0 comments on commit 4233089

Please sign in to comment.