Skip to content

Commit

Permalink
revert: showImportFileDialog周りを戻す
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Feb 8, 2025
1 parent 458980e commit 3897273
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
7 changes: 5 additions & 2 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
EngineId,
EngineSettingType,
EngineSettings,
ShowImportFileDialogOptions,
Sandbox,
} from "@/type/preload";
import { AssetTextFileNames } from "@/type/staticResources";
Expand Down Expand Up @@ -116,7 +115,11 @@ export const api: Sandbox = {
],
});
},
async showImportFileDialog(obj: ShowImportFileDialogOptions) {
async showImportFileDialog(obj: {
name?: string;
extensions?: string[];
title: string;
}) {
const fileHandle = await showOpenFilePickerImpl({
multiple: false,
fileTypes: [
Expand Down
16 changes: 11 additions & 5 deletions src/backend/vst/ipc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { toBase64, toBytes } from "fast-base64";
import { Routing } from "./type";
import { Metadata } from "@/backend/common/ConfigManager";
import { ShowImportFileDialogOptions, TrackId } from "@/type/preload";
import { TrackId } from "@/type/preload";
import { createLogger } from "@/helpers/log";
import { UnreachableError } from "@/type/utility";
import { SingingVoiceKey, Track } from "@/store/type";
Expand Down Expand Up @@ -158,7 +158,11 @@ const ipcSetProject =
const ipcGetProjectName = createMessageFunction<() => string>("getProjectName");
const ipcGetVersion = createMessageFunction<() => string>("getVersion");
const ipcShowImportFileDialog = createMessageFunction<
(options: ShowImportFileDialogOptions) => string | null
(options: {
name?: string;
extensions?: string[];
title: string;
}) => string | null
>("showImportFileDialog");
const ipcShowExportFileDialog = createMessageFunction<
(obj: {
Expand Down Expand Up @@ -265,9 +269,11 @@ export async function setVoices(voices: Record<SingingVoiceKey, string>) {
await ipcSetVoices(voices);
}

export async function showImportFileDialog(
options: ShowImportFileDialogOptions,
): Promise<string | undefined> {
export async function showImportFileDialog(options: {
name?: string;
extensions?: string[];
title: string;
}): Promise<string | undefined> {
return await ipcShowImportFileDialog(options).then(
(result) => result || undefined,
);
Expand Down
14 changes: 5 additions & 9 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ export const defaultToolbarButtonSetting: ToolbarSettingType = [
"REDO",
];

export type ShowImportFileDialogOptions = {
title: string;
name?: string;
extensions?: string[];
};

export type TextAsset = {
Contact: string;
HowToUse: string;
Expand All @@ -90,9 +84,11 @@ export interface Sandbox {
defaultPath?: string;
}): Promise<string | undefined>;
showProjectLoadDialog(obj: { title: string }): Promise<string[] | undefined>;
showImportFileDialog(
obj: ShowImportFileDialogOptions,
): Promise<string | undefined>;
showImportFileDialog(obj: {
name?: string;
extensions?: string[];
title: string;
}): Promise<string | undefined>;
showExportFileDialog(obj: {
title: string;
defaultPath?: string;
Expand Down

0 comments on commit 3897273

Please sign in to comment.