()
| 121 | #[tracing::instrument(level = "debug", skip())] |
| 122 | #[cfg_attr(mobile, tauri::mobile_entry_point)] |
| 123 | pub fn run() { |
| 124 | rustls::crypto::ring::default_provider() |
| 125 | .install_default() |
| 126 | .expect("Failed to install rustls crypto provider"); |
| 127 | |
| 128 | let filter = if cfg!(mobile) { |
| 129 | EnvFilter::try_new("debug").unwrap() |
| 130 | } else { |
| 131 | EnvFilter::from_env("MOOSYNC_LOG") |
| 132 | }; |
| 133 | |
| 134 | #[cfg(desktop)] |
| 135 | let args = Args::parse(); |
| 136 | |
| 137 | let mut builder = tauri::Builder::default(); |
| 138 | |
| 139 | #[cfg(desktop)] |
| 140 | { |
| 141 | // #[cfg(debug_assertions)] |
| 142 | // { |
| 143 | // builder = tauri::Builder::default().plugin(tauri_plugin_devtools::init()); |
| 144 | // } |
| 145 | |
| 146 | builder = builder |
| 147 | .plugin(tauri_plugin_updater::Builder::new().build()) |
| 148 | .plugin(tauri_plugin_single_instance::init(|app, argv, _cwd| { |
| 149 | if let Some(url) = argv.get(1) { |
| 150 | tracing::info!("Got url {}", url); |
| 151 | let state: State<OAuthHandler> = app.state(); |
| 152 | state.handle_oauth(app.clone(), url.to_string()).unwrap(); |
| 153 | } |
| 154 | })) |
| 155 | .plugin(tauri_plugin_dialog::init()) |
| 156 | .plugin(tauri_plugin_autostart::init( |
| 157 | tauri_plugin_autostart::MacosLauncher::LaunchAgent, |
| 158 | None, |
| 159 | )) |
| 160 | .on_window_event(|window, event| { |
| 161 | if let tauri::WindowEvent::CloseRequested { api, .. } = event { |
| 162 | if let Ok(should_close) = handle_window_close(window.app_handle()) { |
| 163 | if !should_close { |
| 164 | window.hide().unwrap(); |
| 165 | api.prevent_close(); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | }); |
| 170 | } |
| 171 | |
| 172 | #[cfg(mobile)] |
| 173 | { |
| 174 | builder = builder |
| 175 | .plugin(tauri_plugin_file_scanner::init()) |
| 176 | .plugin(tauri_plugin_audioplayer::init()); |
| 177 | } |
| 178 | |
| 179 | #[cfg(desktop)] |
| 180 | let is_mobile_init_script = format!( |
no test coverage detected