(
state: &State<'_, AppState>,
app: &AppHandle,
workspace_info: &bitfun_core::service::workspace::manager::WorkspaceInfo,
startup_trace: Option<&DesktopStartupTrace>,
)
| 929 | } |
| 930 | |
| 931 | async fn apply_active_workspace_context( |
| 932 | state: &State<'_, AppState>, |
| 933 | app: &AppHandle, |
| 934 | workspace_info: &bitfun_core::service::workspace::manager::WorkspaceInfo, |
| 935 | startup_trace: Option<&DesktopStartupTrace>, |
| 936 | ) { |
| 937 | #[cfg(not(target_os = "macos"))] |
| 938 | let _ = app; |
| 939 | |
| 940 | let step_started = Instant::now(); |
| 941 | clear_active_workspace_context(state, app, startup_trace).await; |
| 942 | if let Some(trace) = startup_trace { |
| 943 | trace.record_elapsed_step( |
| 944 | "tauri_command", |
| 945 | "initialize_global_state.clear_active_workspace_context", |
| 946 | step_started, |
| 947 | ); |
| 948 | } |
| 949 | |
| 950 | let step_started = Instant::now(); |
| 951 | *state.workspace_path.write().await = Some(workspace_info.root_path.clone()); |
| 952 | if let Some(trace) = startup_trace { |
| 953 | trace.record_elapsed_step( |
| 954 | "tauri_command", |
| 955 | "initialize_global_state.set_active_workspace_path", |
| 956 | step_started, |
| 957 | ); |
| 958 | } |
| 959 | |
| 960 | let step_started = Instant::now(); |
| 961 | spawn_workspace_background_warmup(&*state, workspace_info.clone()); |
| 962 | if let Some(trace) = startup_trace { |
| 963 | trace.record_elapsed_step( |
| 964 | "tauri_command", |
| 965 | "initialize_global_state.spawn_workspace_background_warmup", |
| 966 | step_started, |
| 967 | ); |
| 968 | } |
| 969 | |
| 970 | #[cfg(target_os = "macos")] |
| 971 | { |
| 972 | let step_started = Instant::now(); |
| 973 | let language = state |
| 974 | .config_service |
| 975 | .get_config::<String>(Some("app.language")) |
| 976 | .await |
| 977 | .unwrap_or_else(|_| "zh-CN".to_string()); |
| 978 | let edit_mode = *state.macos_edit_menu_mode.read().await; |
| 979 | let _ = crate::macos_menubar::set_macos_menubar_with_mode( |
| 980 | app, |
| 981 | &language, |
| 982 | crate::macos_menubar::MenubarMode::Workspace, |
| 983 | edit_mode, |
| 984 | ); |
| 985 | if let Some(trace) = startup_trace { |
| 986 | trace.record_elapsed_step( |
| 987 | "tauri_command", |
| 988 | "initialize_global_state.set_macos_workspace_menubar", |
no test coverage detected