fix: mobile nostr signer detection, mobile TTS auto-unlock, button loaders
- Nostr signer: poll for window.nostr up to 3s on mobile (Amber injects late). Both login() and handleSignerLogin() now wait before failing. - Mobile TTS: install global one-time click/touch/keydown handler to auto-unlock AudioContext when fight pages mount. Previously only triggered by explicit sound toggle, so mobile TTS silently failed. - Add loading spinners to "I BUILD BOTS" and "I FIGHT MYSELF" buttons. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
4897335686
commit
dd3cbdae7f
@@ -16,6 +16,27 @@ export function stopAllAudio() {
|
||||
resetGainNodes()
|
||||
}
|
||||
|
||||
// === CROSS-CUTTING: auto-unlock AudioContext on first user gesture ===
|
||||
// Mobile browsers require a user gesture to unlock AudioContext. Instead of
|
||||
// relying solely on the sound toggle button, install a one-time listener on
|
||||
// the first click/tap/keydown anywhere on the page.
|
||||
|
||||
let _autoUnlockInstalled = false
|
||||
|
||||
export function installAutoUnlock() {
|
||||
if (_autoUnlockInstalled) return
|
||||
_autoUnlockInstalled = true
|
||||
const handler = () => {
|
||||
ensureAudioContext()
|
||||
document.removeEventListener('click', handler, true)
|
||||
document.removeEventListener('touchstart', handler, true)
|
||||
document.removeEventListener('keydown', handler, true)
|
||||
}
|
||||
document.addEventListener('click', handler, true)
|
||||
document.addEventListener('touchstart', handler, true)
|
||||
document.addEventListener('keydown', handler, true)
|
||||
}
|
||||
|
||||
// === CROSS-CUTTING: ensureAudioContext ===
|
||||
// Must be called from user gesture (click/tap) to unlock audio on mobile browsers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user