diff options
author | Anuj Solanki <anuj603362@gmail.com> | 2024-10-17 22:12:56 +0530 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2024-10-22 11:49:11 +0000 |
commit | f8b39a2902e73422259965e724a44c56f49ce103 (patch) | |
tree | 3e95c7f307a57615780a5ba652e90c3a5f5ad377 /lib/data | |
parent | 3f1370ada560d824e1cf2258e7c475a32b750e95 (diff) |
Make Voice Assistant Toggle Conditional
- Removed the Voice Assistant toggle button from the settings page
when agl-offline-voice-agent feature is not enabled.
Bug-AGL: SPEC-5265
Change-Id: I65aa011cffe90663106a0d8e4fab021972f51e87
Signed-off-by: Anuj Solanki <anuj603362@gmail.com>
Diffstat (limited to 'lib/data')
-rw-r--r-- | lib/data/data_providers/app_config_provider.dart | 18 | ||||
-rw-r--r-- | lib/data/data_providers/voice_agent_client.dart | 2 |
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); } |