Skip to content

Commit 2dabf6d

Browse files
refactor(ipc): Refactor module exports and fix async setup
Refactored the IPC module to use public module declarations instead of re-exporting all items, simplifying the code structure and improving maintainability. Additionally, fixed several issues in the setup process: - Made the setup hook asynchronous to handle operations better. - Corrected variable name from 'RunTime' to 'Runtime' for consistency. - Set the initialization script to empty, removing previous content. - Fixed a cloning issue in the extension scanner by adding '.clone()' to 'full_path'. These changes enhance code clarity and fix minor bugs introduced in recent IPC developments.
1 parent f950356 commit 2dabf6d

3 files changed

Lines changed: 14 additions & 81 deletions

File tree

Source/Binary.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ pub fn Fn() {
556556
.setup({
557557
let LocalhostUrl = LocalhostUrl.clone();
558558

559-
move |Application| {
559+
move |Application| async move {
560560
info!("[Lifecycle] [Setup] Setup hook started.");
561561

562562
debug!("[Lifecycle] [Setup] LocalhostUrl={}", LocalhostUrl);
@@ -601,7 +601,7 @@ pub fn Fn() {
601601
// ---------------------------------------------------------
602602
debug!("[Lifecycle] [IPC] Initializing Status Reporter...");
603603

604-
let status_reporter = initialize_status_reporter(&ApplicationHandle, RunTime.clone())?;
604+
let status_reporter = initialize_status_reporter(&ApplicationHandle, Runtime.clone())?;
605605
status_reporter.set_ipc_server(ipc_server);
606606

607607
// Start periodic status reporting
@@ -616,7 +616,7 @@ pub fn Fn() {
616616
// ---------------------------------------------------------
617617
debug!("[Lifecycle] [IPC] Initializing Advanced Features...");
618618

619-
if let Err(e) = initialize_advanced_features(&ApplicationHandle, RunTime.clone()) {
619+
if let Err(e) = initialize_advanced_features(&ApplicationHandle, Runtime.clone()) {
620620
error!("[Lifecycle] [IPC] Failed to initialize advanced features: {}", e);
621621
}
622622

@@ -627,12 +627,12 @@ pub fn Fn() {
627627
// ---------------------------------------------------------
628628
debug!("[Lifecycle] [IPC] Initializing Wind Advanced Sync...");
629629

630-
if let Err(e) = initialize_wind_advanced_sync(&ApplicationHandle, RunTime.clone()) {
630+
if let Err(e) = initialize_wind_advanced_sync(&ApplicationHandle, Runtime.clone()) {
631631
error!("[Lifecycle] [IPC] Failed to initialize Wind advanced sync: {}", e);
632632
}
633633

634634
debug!("[Lifecycle] [IPC] Wind Advanced Sync initialized.");
635-
TraceStep!("[UI] [Window] InitScript bytes={}", InitScript.len());
635+
TraceStep!("[UI] [Window] InitScript bytes=0");
636636

637637
debug!("[UI] [Window] Creating window builder...");
638638

@@ -644,7 +644,7 @@ pub fn Fn() {
644644
),
645645
)
646646
.use_https_scheme(false)
647-
.initialization_script(&InitScript)
647+
.initialization_script("")
648648
.zoom_hotkeys_enabled(true)
649649
.browser_extensions_enabled(false);
650650

Source/ExtensionManagement/Scanner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn process_configuration_properties(
160160
)?;
161161
} else if let Some(default_value) = prop_details.get("default") {
162162
// Handle regular property with default value
163-
merged_defaults.insert(full_path, default_value.clone());
163+
merged_defaults.insert(full_path.clone(), default_value.clone());
164164
}
165165
}
166166

Source/IPC/mod.rs

Lines changed: 7 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,10 @@
55
66
#![allow(non_snake_case, non_camel_case_types)]
77

8-
pub use TauriIPCServer::{
9-
TauriIPCServer,
10-
TauriIPCMessage,
11-
ConnectionStatus,
12-
mountain_ipc_receive_message,
13-
mountain_ipc_get_status,
14-
};
15-
16-
pub use WindServiceHandlers::{
17-
mountain_ipc_invoke,
18-
register_wind_ipc_handlers,
19-
};
20-
21-
pub use WindServiceAdapters::{
22-
WindServiceAdapter,
23-
WindDesktopConfiguration,
24-
WindEnvironmentService,
25-
WindFileService,
26-
WindStorageService,
27-
WindConfigurationService,
28-
};
29-
30-
pub use ConfigurationBridge::{
31-
ConfigurationBridge,
32-
ConfigurationStatus,
33-
mountain_get_wind_desktop_configuration,
34-
mountain_update_configuration_from_wind,
35-
mountain_synchronize_configuration,
36-
mountain_get_configuration_status,
37-
};
38-
39-
pub use StatusReporter::{
40-
StatusReporter,
41-
IPCStatusReport,
42-
mountain_get_ipc_status,
43-
mountain_get_ipc_status_history,
44-
mountain_start_ipc_status_reporting,
45-
initialize_status_reporter,
46-
};
47-
48-
pub use AdvancedFeatures::{
49-
AdvancedFeatures,
50-
PerformanceStats,
51-
CollaborationSession,
52-
CollaborationPermissions,
53-
MessageCache,
54-
mountain_get_performance_stats,
55-
mountain_get_cache_stats,
56-
mountain_create_collaboration_session,
57-
mountain_get_collaboration_sessions,
58-
initialize_advanced_features,
59-
};
60-
61-
pub use WindAdvancedSync::{
62-
WindAdvancedSync,
63-
DocumentSynchronization,
64-
SynchronizedDocument,
65-
DocumentChange,
66-
ChangeType,
67-
SyncState,
68-
SyncStatus,
69-
UIStateSynchronization,
70-
CursorPosition,
71-
SelectionRange,
72-
ViewState,
73-
LayoutState,
74-
RealTimeUpdates,
75-
RealTimeUpdate,
76-
UpdateType,
77-
mountain_add_document_for_sync,
78-
mountain_get_sync_status,
79-
mountain_subscribe_to_updates,
80-
initialize_wind_advanced_sync,
81-
};
8+
pub mod TauriIPCServer;
9+
pub mod WindServiceHandlers;
10+
pub mod WindServiceAdapters;
11+
pub mod ConfigurationBridge;
12+
pub mod StatusReporter;
13+
pub mod AdvancedFeatures;
14+
pub mod WindAdvancedSync;

0 commit comments

Comments
 (0)