feat(cli+tauri): Send logs from host to guest (#90)

* feat(tauri): send logs from cli to tauri

---------

Co-authored-by: binarybaron <binarybaron@unstoppableswap.net>
Co-authored-by: binarybaron <86064887+binarybaron@users.noreply.github.com>
This commit is contained in:
Einliterflasche 2024-09-26 13:09:46 +02:00 committed by GitHub
parent 21608ce4f7
commit 7b79ad6abe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 206 additions and 136 deletions

View file

@ -138,15 +138,12 @@ fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
match context {
Ok(context) => {
let state = app_handle.state::<RwLock<State>>();
state.write().await.set_context(Arc::new(context));
// To display to the user that the setup is done, we emit an event to the Tauri frontend
tauri_handle.emit_context_init_progress_event(TauriContextStatusEvent::Available);
}
Err(e) => {
println!("Error while initializing context: {:?}", e);
// To display to the user that the setup failed, we emit an event to the Tauri frontend
tauri_handle.emit_context_init_progress_event(TauriContextStatusEvent::Failed);
}
@ -182,7 +179,8 @@ pub fn run() {
RunEvent::Exit | RunEvent::ExitRequested { .. } => {
// Here we cleanup the Context when the application is closed
// This is necessary to among other things stop the monero-wallet-rpc process
// If the application is forcibly closed, this may not be called
// If the application is forcibly closed, this may not be called.
// TODO: fix that
let context = app.state::<RwLock<State>>().inner().try_read();
match context {