From 2a451ebb572531f5dfa34a3f863e2b15d29e7355 Mon Sep 17 00:00:00 2001 From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:33:42 +0900 Subject: enhance(frontend): 通知音にドライブのファイルを使用できるように (#12447) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * (enhance) サウンドにドライブのファイルを使用できるように * Update Changelog * fix * fix design * fix design * Update store.ts * (fix) ファイル名表示 * refactor * (refactor) better types * operationTypeとsoundTypeの混同を防止 * (refactor) * (fix) * enhance jsdoc * driveFile -> _driveFile_ --- packages/frontend/src/store.ts | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'packages/frontend/src/store.ts') diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 40fb1dde76..70d2cf402d 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -6,6 +6,7 @@ import { markRaw, ref } from 'vue'; import * as Misskey from 'misskey-js'; import { miLocalStorage } from './local-storage.js'; +import type { SoundType } from '@/scripts/sound.js'; import { Storage } from '@/pizzax.js'; interface PostFormAction { @@ -35,6 +36,22 @@ interface PageViewInterruptor { handler: (page: Misskey.entities.Page) => unknown; } +/** サウンド設定 */ +export type SoundStore = { + type: Exclude; + volume: number; +} | { + type: '_driveFile_'; + + /** ドライブのファイルID */ + fileId: string; + + /** ファイルURL(こちらが優先される) */ + fileUrl: string; + + volume: number; +} + export const postFormActions: PostFormAction[] = []; export const userActions: UserAction[] = []; export const noteActions: NoteAction[] = []; @@ -401,27 +418,27 @@ export const defaultStore = markRaw(new Storage('base', { }, sound_note: { where: 'device', - default: { type: 'syuilo/n-aec', volume: 1 }, + default: { type: 'syuilo/n-aec', volume: 1 } as SoundStore, }, sound_noteMy: { where: 'device', - default: { type: 'syuilo/n-cea-4va', volume: 1 }, + default: { type: 'syuilo/n-cea-4va', volume: 1 } as SoundStore, }, sound_notification: { where: 'device', - default: { type: 'syuilo/n-ea', volume: 1 }, + default: { type: 'syuilo/n-ea', volume: 1 } as SoundStore, }, sound_antenna: { where: 'device', - default: { type: 'syuilo/triple', volume: 1 }, + default: { type: 'syuilo/triple', volume: 1 } as SoundStore, }, sound_channel: { where: 'device', - default: { type: 'syuilo/square-pico', volume: 1 }, + default: { type: 'syuilo/square-pico', volume: 1 } as SoundStore, }, sound_reaction: { where: 'device', - default: { type: 'syuilo/bubble2', volume: 1 }, + default: { type: 'syuilo/bubble2', volume: 1 } as SoundStore, }, })); -- cgit v1.3.1-freya