aboutsummaryrefslogtreecommitdiffstats
path: root/lib/data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/data')
-rw-r--r--lib/data/data_providers/app_config_provider.dart18
-rw-r--r--lib/data/data_providers/voice_agent_client.dart2
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/data/data_providers/app_config_provider.dart b/lib/data/data_providers/app_config_provider.dart
index 9e187a9..4052164 100644
--- a/lib/data/data_providers/app_config_provider.dart
+++ b/lib/data/data_providers/app_config_provider.dart
@@ -112,6 +112,7 @@ class AppConfig {
final StorageConfig storageConfig;
final MpdConfig mpdConfig;
final VoiceAgentConfig voiceAgentConfig;
+ final bool enableVoiceAssistant;
static String configFilePath = '/etc/xdg/AGL/ics-homescreen.yaml';
@@ -123,7 +124,8 @@ class AppConfig {
required this.radioConfig,
required this.storageConfig,
required this.mpdConfig,
- required this.voiceAgentConfig});
+ required this.voiceAgentConfig,
+ required this.enableVoiceAssistant});
static KuksaConfig parseKuksaConfig(YamlMap kuksaMap) {
try {
@@ -324,6 +326,14 @@ final appConfigProvider = Provider((ref) {
voiceAgentConfig = VoiceAgentConfig.defaultConfig();
}
+ bool enableVoiceAssistant = enableVoiceAssistantDefault;
+ if (yamlMap.containsKey('enable-voice-assistant')) {
+ var value = yamlMap['enable-voice-assistant'];
+ if (value is bool) {
+ enableVoiceAssistant = value;
+ }
+ }
+
bool disableBkgAnimation = disableBkgAnimationDefault;
if (yamlMap.containsKey('disable-bg-animation')) {
var value = yamlMap['disable-bg-animation'];
@@ -356,7 +366,8 @@ final appConfigProvider = Provider((ref) {
radioConfig: radioConfig,
storageConfig: storageConfig,
mpdConfig: mpdConfig,
- voiceAgentConfig: voiceAgentConfig);
+ voiceAgentConfig: voiceAgentConfig,
+ enableVoiceAssistant: enableVoiceAssistant);
} catch (_) {
return AppConfig(
disableBkgAnimation: false,
@@ -366,6 +377,7 @@ final appConfigProvider = Provider((ref) {
radioConfig: RadioConfig.defaultConfig(),
storageConfig: StorageConfig.defaultConfig(),
mpdConfig: MpdConfig.defaultConfig(),
- voiceAgentConfig: VoiceAgentConfig.defaultConfig());
+ voiceAgentConfig: VoiceAgentConfig.defaultConfig(),
+ enableVoiceAssistant: false);
}
});
diff --git a/lib/data/data_providers/voice_agent_client.dart b/lib/data/data_providers/voice_agent_client.dart
index 295e138..903a5d0 100644
--- a/lib/data/data_providers/voice_agent_client.dart
+++ b/lib/data/data_providers/voice_agent_client.dart
@@ -13,6 +13,7 @@ class VoiceAgentClient {
VoiceAgentClient({required this.config,required this.ref}) {
// Initialize the client channel without connecting immediately
+ debugPrint("Connecting to Voice Assistant at ${config.hostname}:${config.port}");
String host = config.hostname;
int port = config.port;
_channel = ClientChannel(
@@ -22,7 +23,6 @@ class VoiceAgentClient {
credentials: ChannelCredentials.insecure(),
),
);
- debugPrint("Connecting to Voice Assistant");
_client = VoiceAgentServiceClient(_channel);
}