From 9dccdb0b0335f82aa9f2e63642f16ff0f2699528 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 18 Jul 2023 14:26:20 +0200 Subject: feat: Add basic Proton management (#383) Adds logic to install, remove, and check existing install of NorthstarProton. --- src-tauri/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src-tauri/Cargo.toml') diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ed523a4b..63ff51f7 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -33,7 +33,7 @@ steamlocate = "1.2" # Error messages anyhow = "1.0" # libthermite for Northstar/mod install handling -libthermite = "0.6.5" +libthermite = { version = "0.6.5", features = ["proton"] } # zip stuff zip = "0.6.2" # Regex @@ -62,6 +62,8 @@ zip-extract = "0.1.2" # open urls open = "3.2.0" semver = "1.0" +# simplified filesystem access +glob = "0.3.1" dirs = "5" [target.'cfg(windows)'.dependencies] -- cgit v1.2.3 From 8e733e5127463073aa90c566afdb5c242af64aa0 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 19 Jul 2023 02:06:38 +0200 Subject: feat: Replace MessageBoxW invocation with Tauri dialog (#418) --- src-tauri/Cargo.toml | 2 +- src-tauri/src/main.rs | 36 ++++++++++++++---------------------- 2 files changed, 15 insertions(+), 23 deletions(-) (limited to 'src-tauri/Cargo.toml') diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 63ff51f7..443a997b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -23,7 +23,7 @@ tauri-build = { version = "1.4", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.4", features = ["api-all", "updater"] } +tauri = { version = "1.4", features = ["api-all", "dialog", "updater"] } tokio = { version = "1", features = ["full"] } # Sentry (crash) logging sentry = "0.30" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a295f322..1067f5d3 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,11 +9,6 @@ use std::{ time::Duration, }; -#[cfg(target_os = "windows")] -use std::ptr::null_mut; -#[cfg(target_os = "windows")] -use winapi::um::winuser::{MessageBoxW, MB_ICONERROR, MB_OK, MB_USERICON}; - use crate::constants::REFRESH_DELAY; mod development; @@ -26,6 +21,10 @@ mod util; use semver::Version; use serde::{Deserialize, Serialize}; +#[cfg(target_os = "windows")] +use tauri::api::dialog::blocking::MessageDialogBuilder; +#[cfg(target_os = "windows")] +use tauri::api::dialog::{MessageDialogButtons, MessageDialogKind}; use tauri::{Manager, Runtime}; use tokio::time::sleep; use ts_rs::TS; @@ -175,23 +174,16 @@ fn main() { #[cfg(target_os = "windows")] { log::error!("WebView2 not installed: {err}"); - // Display a message box to the user with a button to open the installation instructions - let title = "WebView2 not found" - .encode_utf16() - .chain(Some(0)) - .collect::>(); - let message = "FlightCore requires WebView2 to run.\n\nClick OK to open installation instructions.".encode_utf16().chain(Some(0)).collect::>(); - unsafe { - let result = MessageBoxW( - null_mut(), - message.as_ptr(), - title.as_ptr(), - MB_OK | MB_ICONERROR | MB_USERICON, - ); - if result == 1 { - // Open the installation instructions URL in the user's default web browser - open::that("https://github.com/R2NorthstarTools/FlightCore/blob/main/docs/TROUBLESHOOTING.md#flightcore-wont-launch").unwrap(); - } + let dialog = MessageDialogBuilder::new( + "WebView2 not found", + "FlightCore requires WebView2 to run.\n\nClick OK to open installation instructions." + ) + .kind(MessageDialogKind::Error) + .buttons(MessageDialogButtons::Ok); + + if dialog.show() { + // Open the installation instructions URL in the user's default web browser + open::that("https://github.com/R2NorthstarTools/FlightCore/blob/main/docs/TROUBLESHOOTING.md#flightcore-wont-launch").unwrap(); } } } -- cgit v1.2.3 From 085ed68999db7ceb16b2d38a258f752e621e4981 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Wed, 19 Jul 2023 15:24:12 +0200 Subject: chore: Bump FlightCore version to 1.24.0 --- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src-tauri/Cargo.toml') diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 968d523b..cd380a27 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -76,7 +76,7 @@ checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" [[package]] name = "app" -version = "1.23.0" +version = "1.24.0" dependencies = [ "anyhow", "async-recursion", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 443a997b..03eb8e9e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "1.23.0" +version = "1.24.0" description = "A Tauri App" authors = ["you"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 820b6d9b..b801b9a6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "FlightCore", - "version": "1.23.0" + "version": "1.24.0" }, "tauri": { "allowlist": { -- cgit v1.2.3