Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { onMounted, onUnmounted, watch } from 'vue'
const show = defineModel('show', { type: Boolean, default: false })

const settingsAudioDeviceStore = useSettingsAudioDevice()
const { enabled, selectedAudioInput, stream, audioInputs } = storeToRefs(settingsAudioDeviceStore)
const { enabled, stream } = storeToRefs(settingsAudioDeviceStore)

const getMediaAccessStatus = useElectronEventaInvoke(electron.systemPreferences.getMediaAccessStatus)
const { state: mediaAccessStatus, execute: refreshMediaAccessStatus } = useAsyncState(() => getMediaAccessStatus(['microphone']), 'not-determined')
Expand Down Expand Up @@ -58,10 +58,7 @@ onUnmounted(async () => {
<template>
<HearingConfigDialog
v-model:show="show"
v-model:enabled="enabled"
v-model:selected-audio-input="selectedAudioInput"
:granted="mediaAccessStatus !== 'denied' && mediaAccessStatus !== 'restricted'"
:audio-inputs="audioInputs"
:volume-level="volumeLevel"
>
<slot />
Expand Down
3 changes: 3 additions & 0 deletions packages/stage-layouts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
"@proj-airi/stage-shared": "workspace:^",
"@types/audioworklet": "catalog:",
"@types/three": "^0.184.0",
"@vue/test-utils": "catalog:",
"@webgpu/types": "catalog:",
"jsdom": "catalog:",
"unplugin-info": "catalog:",
"vitest": "catalog:",
"vue-tsc": "^3.2.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { ChatHistoryItem } from '@proj-airi/stage-ui/types/chat'
import type { ChatProvider } from '@xsai-ext/providers/utils'

import { isStageTamagotchi } from '@proj-airi/stage-shared'
import { ChatHistory, HearingConfigDialog } from '@proj-airi/stage-ui/components'
import { useAudioAnalyzer } from '@proj-airi/stage-ui/composables'
import { useAudioContext } from '@proj-airi/stage-ui/stores/audio'
Expand All @@ -24,6 +25,7 @@ import ActionAbout from './InteractiveArea/Actions/About.vue'
import ActionViewControls from './InteractiveArea/Actions/ViewControls.vue'
import ViewControlInputs from './ViewControls/Inputs.vue'

import { useTranscriptions } from '../../composables/use-transcriptions'
import { BackgroundDialogPicker } from '../Backgrounds'

const { isDark, toggleDark } = useTheme()
Expand Down Expand Up @@ -66,6 +68,14 @@ function isMobileDevice() {
return /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
}

const { isListening } = useTranscriptions(
{
messageInputRef: messageInput,
sendMessage: handleSend,
isStageTamagotchi,
},
)

async function handleSubmit() {
if (!isMobileDevice()) {
await handleSend()
Expand Down Expand Up @@ -121,7 +131,7 @@ async function setupAnalyzer() {
analyzerSource.connect(analyser)
}

watch([hearingDialogOpen, enabled, stream], () => {
watch([enabled], () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Watch dialog and stream changes when setting up analyzer

setupAnalyzer() still gates on hearingDialogOpen and stream, but the watcher now only tracks enabled. If the mic is already enabled, opening the hearing dialog or receiving the stream later will no longer re-run setup, so the volume meter can remain inactive until enabled is toggled again. This is a regression from the previous dependency set and affects normal UI interaction on mobile.

Useful? React with 👍 / 👎.

setupAnalyzer()
}, { immediate: true })

Expand Down Expand Up @@ -191,7 +201,7 @@ onMounted(() => {
title="Hearing"
>
<Transition name="fade" mode="out-in">
<IndicatorMicVolume v-if="enabled" size-5 color-class="text-neutral-500 dark:text-neutral-400" />
<IndicatorMicVolume v-if="enabled" size-5 :color-class="isListening ? undefined : 'text-neutral-500 dark:text-neutral-400'" />
<div v-else i-solar:microphone-3-outline size-5 text="neutral-500 dark:neutral-400" />
</Transition>
</button>
Expand Down
Loading
Loading