feat(tts): Improve text-to-speech service with enhanced error handling and state management

This commit is contained in:
cogwheel0
2025-10-30 21:42:35 +05:30
parent d7f58498f9
commit de0f195aea
5 changed files with 238 additions and 58 deletions

View File

@@ -99,12 +99,19 @@ class VoiceCallNotificationService {
required String modelName,
required bool isMuted,
required bool isSpeaking,
required bool isPaused,
}) async {
if (!_initialized) {
await initialize();
}
final status = isSpeaking ? 'Speaking...' : 'Listening...';
final status = isSpeaking
? 'Speaking...'
: isMuted
? 'Muted'
: isPaused
? 'Paused'
: 'Listening...';
final muteAction = isMuted ? 'Unmute' : 'Mute';
final muteActionId = isMuted ? _actionUnmute : _actionMute;
@@ -131,7 +138,7 @@ class VoiceCallNotificationService {
muteActionId,
muteAction,
icon: DrawableResourceAndroidBitmap(
isMuted ? '@drawable/ic_mic_on' : '@drawable/ic_mic_off',
isMuted ? '@drawable/ic_mic_off' : '@drawable/ic_mic_on',
),
showsUserInterface: false,
cancelNotification: false,
@@ -176,11 +183,13 @@ class VoiceCallNotificationService {
required String modelName,
required bool isMuted,
required bool isSpeaking,
required bool isPaused,
}) async {
await showCallNotification(
modelName: modelName,
isMuted: isMuted,
isSpeaking: isSpeaking,
isPaused: isPaused,
);
}