M4
This commit is contained in:
@@ -7,6 +7,7 @@ use tauri_plugin_opener::OpenerExt;
|
||||
use crate::launcher::{Launcher, Status};
|
||||
use crate::settings::Settings;
|
||||
use crate::stack::StackEvent;
|
||||
use crate::sync::Conflict;
|
||||
|
||||
type CmdResult<T> = Result<T, String>;
|
||||
|
||||
@@ -89,6 +90,29 @@ pub async fn get_stack(launcher: State<'_, Launcher>) -> CmdResult<Vec<StackEven
|
||||
Ok(launcher.stack_states())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn sync_now(app: AppHandle, launcher: State<'_, Launcher>) -> CmdResult<()> {
|
||||
launcher.sync_now(&app).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_sync_conflicts(app: AppHandle, launcher: State<'_, Launcher>) -> CmdResult<Vec<Conflict>> {
|
||||
launcher.sync_conflicts(&app).await
|
||||
}
|
||||
|
||||
/// `choice`: "theirs", "mine", "value" (with `value`) or "dismiss" (refused edits only).
|
||||
#[tauri::command]
|
||||
pub async fn resolve_sync_conflict(
|
||||
app: AppHandle,
|
||||
launcher: State<'_, Launcher>,
|
||||
tbl: String,
|
||||
key: serde_json::Value,
|
||||
choice: String,
|
||||
value: Option<serde_json::Value>,
|
||||
) -> CmdResult<Vec<Conflict>> {
|
||||
launcher.resolve_sync_conflict(&app, tbl, key, choice, value).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_settings(launcher: State<'_, Launcher>) -> CmdResult<Settings> {
|
||||
Ok(launcher.settings().await)
|
||||
|
||||
Reference in New Issue
Block a user