Files
jrshikoku/lib/migrateLegacyVoicepeakSettings.ts

31 lines
848 B
TypeScript

import { STORAGE_KEYS } from "@/constants";
import { AS } from "@/storageControl";
const LEGACY_VOICEPEAK_STORAGE_KEYS = [
STORAGE_KEYS.VOICEPEAK_BASE_URL,
STORAGE_KEYS.VOICEPEAK_API_TOKEN,
STORAGE_KEYS.VOICEPEAK_SPEAKER,
"voicepeakSpeed",
"voicepeakPitch",
"voicepeakPause",
"voicepeakVolume",
"voicepeakHightension",
"voicepeakNarration",
"voicepeakParameters",
"voicepeakParams",
"voicepeakEmotions",
"voicepeakEmotion",
] as const;
/**
* 公開APIへの移行後は、端末へ管理用APIの設定を保持しない。
* removeItemは対象が存在しない場合も安全なため、起動ごとに実行できる。
*/
export const migrateLegacyVoicepeakSettings = async () => {
await Promise.all(
LEGACY_VOICEPEAK_STORAGE_KEYS.map((key) =>
AS.removeItem(key).catch(() => undefined)
)
);
};