Merge pull request #37 from UnstoppableSwap/tauri-feature-flag

Introducing a feature flag in the swap crate that conditionally enables the tauri depencendy. This allows compiling the swap crate without the heavy tauri dependency. This also enables us to build arm binaries in the CI again.

This closes #32 and #34
This commit is contained in:
binarybaron 2024-08-28 14:32:18 +02:00 committed by binarybaron
parent 9f1d58d944
commit c7c7cf1886
No known key found for this signature in database
GPG key ID: 99B75D3E1476A26E
7 changed files with 40 additions and 28 deletions

View file

@ -19,5 +19,5 @@ anyhow = "1"
once_cell = "1"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
swap = { path = "../swap" }
swap = { path = "../swap", features = [ "tauri" ] }
tauri = { version = "2.0.0-rc.1", features = [ "config-json5" ] }

View file

@ -6,6 +6,7 @@ use swap::cli::{
BalanceArgs, BuyXmrArgs, GetHistoryArgs, GetSwapInfosAllArgs, ResumeSwapArgs,
SuspendCurrentSwapArgs, WithdrawBtcArgs,
},
tauri_bindings::TauriHandle,
Context, ContextBuilder,
},
command::{Bitcoin, Monero},
@ -86,7 +87,7 @@ tauri_command!(suspend_current_swap, SuspendCurrentSwapArgs, no_args);
tauri_command!(get_swap_infos_all, GetSwapInfosAllArgs, no_args);
tauri_command!(get_history, GetHistoryArgs, no_args);
fn setup<'a>(app: &'a mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
tauri::async_runtime::block_on(async {
let context = ContextBuilder::new(true)
.with_bitcoin(Bitcoin {
@ -98,7 +99,7 @@ fn setup<'a>(app: &'a mut tauri::App) -> Result<(), Box<dyn std::error::Error>>
})
.with_json(true)
.with_debug(true)
.with_tauri(app.app_handle().to_owned())
.with_tauri(TauriHandle::new(app.app_handle().to_owned()))
.build()
.await
.expect("failed to create context");