From 925c2f43694540d476c140a2b1db30cced18d742 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 17 Jun 2024 09:50:26 +0900 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20deck=20ui=E3=81=AE=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=9F=B3=E3=81=8C=E9=87=8D=E3=81=AA=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/scripts/sound.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index fcd59510df18..5eb845e3afe4 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -127,9 +127,16 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; }) export function playMisskeySfx(operationType: OperationType) { const sound = defaultStore.state[`sound_${operationType}`]; if (sound.type == null || !canPlay || ('userActivation' in navigator && !navigator.userActivation.hasBeenActive)) return; + playMisskeySfxFile(sound); +} + +export async function playMisskeySfxFile(soundStore: SoundStore) { + if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { + return; + } canPlay = false; - playMisskeySfxFile(sound).finally(() => { + playMisskeySfxFileInternal(soundStore).finally(() => { // ごく短時間に音が重複しないように setTimeout(() => { canPlay = true; @@ -141,7 +148,7 @@ export function playMisskeySfx(operationType: OperationType) { * サウンド設定形式で指定された音声を再生する * @param soundStore サウンド設定 */ -export async function playMisskeySfxFile(soundStore: SoundStore) { +export async function playMisskeySfxFileInternal(soundStore: SoundStore) { if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { return; } From ef332f4df6e12c2d05e15378e3ec4f331c421080 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 17 Jun 2024 09:51:44 +0900 Subject: [PATCH 2/6] =?UTF-8?q?docs:=20Fix:=20deck=20ui=E3=81=AE=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E9=9F=B3=E3=81=8C=E9=87=8D=E3=81=AA=E3=82=8B=E5=95=8F?= =?UTF-8?q?=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76fed76b5651..eac8eb06199e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Client - Fix: `/about#federation` ページなどで各インスタンスのチャートが表示されなくなっていた問題を修正 - Fix: ユーザーページの追加情報のラベルを投稿者のサーバーの絵文字で表示する (#13968) +- Fix: deck uiの通知音が重なる問題 (#14029) ### Server - チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正 From 9b84a083a450b46dbb74c589bd8ea0ac1f9dff27 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 23 Jul 2024 18:30:15 +0900 Subject: [PATCH 3/6] unexport internal function --- packages/frontend/src/scripts/sound.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index e56fc67eaa51..c60e786e6f88 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -146,7 +146,7 @@ export async function playMisskeySfxFile(soundStore: SoundStore) { * サウンド設定形式で指定された音声を再生する * @param soundStore サウンド設定 */ -export async function playMisskeySfxFileInternal(soundStore: SoundStore) { +async function playMisskeySfxFileInternal(soundStore: SoundStore) { if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { return; } From 406e5ab22e3b866dffb5a0f226c59f09161c6741 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 25 Jul 2024 17:29:02 +0900 Subject: [PATCH 4/6] fix Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> --- packages/frontend/src/scripts/sound.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index c60e786e6f88..2db24fbc7de2 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -129,7 +129,7 @@ export function playMisskeySfx(operationType: OperationType) { } export async function playMisskeySfxFile(soundStore: SoundStore) { - if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { + if (soundStore.type === null || !canPlay || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { return; } From 5188872324775ebf0e05a8239f65408905e953c2 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 25 Jul 2024 17:51:05 +0900 Subject: [PATCH 5/6] chore: improve condition --- packages/frontend/src/scripts/sound.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index 2db24fbc7de2..7db4b49a7e6e 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -124,14 +124,16 @@ export async function loadAudio(url: string, options?: { useCache?: boolean; }) */ export function playMisskeySfx(operationType: OperationType) { const sound = defaultStore.state[`sound_${operationType}`]; - if (sound.type == null || !canPlay || ('userActivation' in navigator && !navigator.userActivation.hasBeenActive)) return; playMisskeySfxFile(sound); } -export async function playMisskeySfxFile(soundStore: SoundStore) { - if (soundStore.type === null || !canPlay || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { - return; - } +export function playMisskeySfxFile(soundStore: SoundStore) { + // 連続して再生しない + if (!canPlay) return; + // ユーザーアクティベーションが必要な場合はそれがない場合は再生しない + if ('userActivation' in navigator && !navigator.userActivation.hasBeenActive) return; + // サウンドがない場合は再生しない + if (soundStore.type === null || soundStore.type === '_driveFile_' && !soundStore.fileUrl) return; canPlay = false; playMisskeySfxFileInternal(soundStore).finally(() => { From 0478cd8f17b92aeb5be6eb99c497f3dc32aeb730 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Thu, 25 Jul 2024 17:53:23 +0900 Subject: [PATCH 6/6] docs: move js dco comment --- packages/frontend/src/scripts/sound.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index 7db4b49a7e6e..814e0808115e 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -127,6 +127,10 @@ export function playMisskeySfx(operationType: OperationType) { playMisskeySfxFile(sound); } +/** + * サウンド設定形式で指定された音声を再生する + * @param soundStore サウンド設定 + */ export function playMisskeySfxFile(soundStore: SoundStore) { // 連続して再生しない if (!canPlay) return; @@ -144,10 +148,6 @@ export function playMisskeySfxFile(soundStore: SoundStore) { }); } -/** - * サウンド設定形式で指定された音声を再生する - * @param soundStore サウンド設定 - */ async function playMisskeySfxFileInternal(soundStore: SoundStore) { if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { return;