Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: いらないhotkeyデフォルト設定取得関数を失くす #2393

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -250,7 +245,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
Loading