Skip to content

Commit bf69f5c

Browse files
refactor(Mountain/IPC): Update type annotations and method calls in Wind service handlers
This commit continues the ongoing refinement of Mountain's IPC layer by aligning type annotations and method calls with the latest API definitions in the Common crate. The changes ensure that Mountain's implementation correctly adheres to the abstract interfaces defined in Common, reinforcing the architectural separation between interface and implementation. Key updates include adding imports for ConfigurationOverridesDTO and ConfigurationTarget from Common, simplifying type annotations by using direct trait names (e.g., StorageProvider instead of full paths), and updating method calls to use the correct API signatures (e.g., changing SetStorageItem to UpdateStorageValue and using ConfigurationOverridesDTO::default() where appropriate). These adjustments improve code readability and maintainability while ensuring full compatibility with the IPC communication between Mountain and the Wind frontend service layer.
1 parent 107ee20 commit bf69f5c

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Source/IPC/WindServiceHandlers.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use Common::Environment::Requires::Requires;
2020
use Common::FileSystem::FileSystemReader::FileSystemReader;
2121
use Common::FileSystem::FileSystemWriter::FileSystemWriter;
2222
use Common::Configuration::ConfigurationProvider::ConfigurationProvider;
23+
use Common::Configuration::DTO::{ConfigurationOverridesDTO, ConfigurationTarget};
24+
use Common::Storage::StorageProvider::StorageProvider;
2325

2426
/// Handler for Wind's MainProcessService.invoke() calls
2527
/// Maps Tauri IPC commands to Mountain's internal command system
@@ -109,8 +111,8 @@ async fn handle_configuration_update(
109111
provider.UpdateConfigurationValue(
110112
key.to_string(),
111113
value,
112-
Common::Configuration::DTO::ConfigurationTarget::ConfigurationTarget::User,
113-
Value::Null,
114+
ConfigurationTarget::User,
115+
ConfigurationOverridesDTO::default(),
114116
None,
115117
)
116118
.await
@@ -199,7 +201,7 @@ async fn handle_storage_get(
199201
.ok_or("Storage key must be a string".to_string())?;
200202

201203
// Use Mountain's storage provider
202-
let provider: Arc<dyn Common::Storage::StorageProvider::StorageProvider> = runtime.Environment.Require();
204+
let provider: Arc<dyn StorageProvider> = runtime.Environment.Require();
203205

204206
let value = provider.GetStorageValue(false, key)
205207
.await
@@ -224,9 +226,9 @@ async fn handle_storage_set(
224226
.clone();
225227

226228
// Use Mountain's storage provider
227-
let provider: Arc<dyn Common::Storage::StorageProvider::StorageProvider> = runtime.Environment.Require();
229+
let provider: Arc<dyn StorageProvider> = runtime.Environment.Require();
228230

229-
provider.SetStorageItem(key.to_string(), value)
231+
provider.UpdateStorageValue(false, key.to_string(), Some(value))
230232
.await
231233
.map_err(|e| format!("Failed to set storage item: {}", e))?;
232234

@@ -432,7 +434,7 @@ async fn handle_workbench_configuration(
432434
// Get the complete workbench configuration
433435
let provider: Arc<dyn ConfigurationProvider> = runtime.Environment.Require();
434436

435-
let config = provider.GetConfiguration(None, Value::Null)
437+
let config = provider.GetConfigurationValue(None, ConfigurationOverridesDTO::default())
436438
.await
437439
.map_err(|e| format!("Failed to get workbench configuration: {}", e))?;
438440

0 commit comments

Comments
 (0)