feat(tauri): add single instance plugin and improve code formatting
This update introduces the tauri-plugin-single-instance to ensure that only one instance of the application can run at a time. Additionally, the code has been reformatted for better readability, with consistent line breaks and spacing. - Added single instance plugin to prevent multiple app instances - Improved code formatting for better readability and maintenance - Updated dependencies in Cargo.toml for new plugin integration
This commit is contained in:
+15
-7
@@ -19,7 +19,7 @@ use git::{
|
||||
restore_to_commit, search_code_introductions, stage_files, stash_apply, stash_drop, stash_pop,
|
||||
stash_push, undo_last_commit, unstage_files,
|
||||
};
|
||||
use tauri::Manager;
|
||||
use tauri::{Manager, AppHandle};
|
||||
|
||||
#[tauri::command]
|
||||
fn close_splashscreen(app: tauri::AppHandle) -> Result<(), String> {
|
||||
@@ -43,13 +43,21 @@ fn close_splashscreen(app: tauri::AppHandle) -> Result<(), String> {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _, _| {
|
||||
#[cfg(desktop)]
|
||||
let _ = app.get_webview_window("main")
|
||||
.expect("no main window")
|
||||
.set_focus();
|
||||
}))
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_aptabase::Builder::new("A-SH-1344793789").with_options(
|
||||
tauri_plugin_aptabase::InitOptions {
|
||||
host: Some("https://aptabase.cbsk-tech.de".to_string()),
|
||||
flush_interval:None
|
||||
}
|
||||
).build())
|
||||
.plugin(
|
||||
tauri_plugin_aptabase::Builder::new("A-SH-1344793789")
|
||||
.with_options(tauri_plugin_aptabase::InitOptions {
|
||||
host: Some("https://aptabase.cbsk-tech.de".to_string()),
|
||||
flush_interval: None,
|
||||
})
|
||||
.build(),
|
||||
)
|
||||
.manage(SearchCancellationState::default())
|
||||
.manage(commit_ai::CommitAiEngine::new())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
|
||||
Reference in New Issue
Block a user