diff options
| author | anatawa12 <anatawa12@icloud.com> | 2024-07-28 14:44:15 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-28 14:44:15 +0900 |
| commit | 865b3039ccf6eec4f277dbb33296ab767d2ed7ce (patch) | |
| tree | 6757123ceaec4fe7006142b905ad317fbf4eaec4 | |
| parent | Bump version to 2024.7.0-beta.3 (diff) | |
| download | sharkey-865b3039ccf6eec4f277dbb33296ab767d2ed7ce.tar.gz sharkey-865b3039ccf6eec4f277dbb33296ab767d2ed7ce.tar.bz2 sharkey-865b3039ccf6eec4f277dbb33296ab767d2ed7ce.zip | |
fix: deck uiの通知音が重なる問題 (#14029)
* fix: deck uiの通知音が重なる
* docs: Fix: deck uiの通知音が重なる問題
* unexport internal function
* fix
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
* chore: improve condition
* docs: move js dco comment
---------
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | packages/frontend/src/scripts/sound.ts | 23 |
2 files changed, 17 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b35034cc8..c2e9c8e258 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - Fix: リアクションしたユーザー一覧のユーザー名がはみ出る問題を修正 (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/672) - Fix: `/share`ページにおいて絵文字ピッカーを開くことができない問題を修正 +- Fix: deck uiの通知音が重なる問題 (#14029) - Fix: ダイレクト投稿の"削除して編集"において、宛先が保持されていなかった問題を修正 - Fix: 投稿フォームへのURL貼り付けによる引用が下書きに保存されていなかった問題を修正 - Fix: "削除して編集"や下書きにおいて、リアクションの受け入れ設定が保持/保存されていなかった問題を修正 diff --git a/packages/frontend/src/scripts/sound.ts b/packages/frontend/src/scripts/sound.ts index bba855cd64..814e080811 100644 --- a/packages/frontend/src/scripts/sound.ts +++ b/packages/frontend/src/scripts/sound.ts @@ -124,10 +124,23 @@ 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); +} + +/** + * サウンド設定形式で指定された音声を再生する + * @param soundStore サウンド設定 + */ +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; - playMisskeySfxFile(sound).finally(() => { + playMisskeySfxFileInternal(soundStore).finally(() => { // ごく短時間に音が重複しないように setTimeout(() => { canPlay = true; @@ -135,11 +148,7 @@ export function playMisskeySfx(operationType: OperationType) { }); } -/** - * サウンド設定形式で指定された音声を再生する - * @param soundStore サウンド設定 - */ -export async function playMisskeySfxFile(soundStore: SoundStore) { +async function playMisskeySfxFileInternal(soundStore: SoundStore) { if (soundStore.type === null || (soundStore.type === '_driveFile_' && !soundStore.fileUrl)) { return; } |