Files
iiEsaywebUIapp/lib/core/persistence/persistence_keys.dart
cogwheel0 561e7dd616 feat(tts): server-backed TTS engine selection
Introduce server TTS support and engine selection while keeping
device TTS as the default.

- Add new persistence keys for storing TTS engine and selected
  server voice (ttsEngine, ttsServerVoiceId, ttsServerVoiceName).
- Extend TextToSpeechService to support two engines:
  TtsEngine.device (FlutterTts) and TtsEngine.server (remote audio).
- Wire in an AudioPlayer and optional ApiService to fetch raw
  audio bytes from the server and play them, with event hooks
  mapped to existing lifecycle callbacks.
- Implement fallback to device TTS on server errors or empty
  responses, and ensure player lifecycle (pause/stop/dispose)
  is handled when using server engine.
- Allow engine and preferred voice to be configured before
  initialization and updated at runtime via updateSettings.

This enables selecting a server-side voice and using a remote
TTS provider while preserving compatibility with the existing
device TTS implementation.
2025-10-23 16:31:15 +05:30

37 lines
1.8 KiB
Dart

/// Keys previously stored in SharedPreferences. Centralized so Hive-based
/// storage and migration logic stay aligned.
final class PreferenceKeys {
static const String reduceMotion = 'reduce_motion';
static const String animationSpeed = 'animation_speed';
static const String hapticFeedback = 'haptic_feedback';
static const String highContrast = 'high_contrast';
static const String largeText = 'large_text';
static const String darkMode = 'dark_mode';
static const String defaultModel = 'default_model';
static const String voiceLocaleId = 'voice_locale_id';
static const String voiceHoldToTalk = 'voice_hold_to_talk';
static const String voiceAutoSendFinal = 'voice_auto_send_final';
static const String socketTransportMode = 'socket_transport_mode';
static const String quickPills = 'quick_pills';
static const String sendOnEnterKey = 'send_on_enter';
static const String rememberCredentials = 'remember_credentials';
static const String activeServerId = 'active_server_id';
static const String themeMode = 'theme_mode';
static const String themePalette = 'theme_palette_v1';
static const String localeCode = 'locale_code_v1';
static const String onboardingSeen = 'onboarding_seen_v1';
static const String reviewerMode = 'reviewer_mode_v1';
static const String ttsVoice = 'tts_voice';
static const String ttsSpeechRate = 'tts_speech_rate';
static const String ttsPitch = 'tts_pitch';
static const String ttsVolume = 'tts_volume';
static const String ttsEngine = 'tts_engine'; // 'device' | 'server'
static const String ttsServerVoiceId = 'tts_server_voice_id';
static const String ttsServerVoiceName = 'tts_server_voice_name';
}
final class LegacyPreferenceKeys {
static const String attachmentUploadQueue = 'attachment_upload_queue';
static const String taskQueue = 'outbound_task_queue_v1';
}