2 Commits
4.0.0 ... 4.0.2

Author SHA1 Message Date
ed50979397 Version 4.0.2
Fixed delete mode being on by default
2023-01-29 16:27:10 -08:00
762b2f61aa Version 4.0.1
Fix updater not installing new versions
2023-01-28 23:57:51 -08:00
2 changed files with 11 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "town-of-us-updater" name = "town-of-us-updater"
version = "4.0.0" version = "4.0.2"
edition = "2021" edition = "2021"
build = "src/build.rs" build = "src/build.rs"

View File

@@ -51,7 +51,7 @@ pub struct AppData {
pub among_us_path: String, pub among_us_path: String,
pub installs_path: String, pub installs_path: String,
pub version: SemVer, pub version: SemVer,
pub initialized: bool, pub delete_mode: bool,
pub among_us_version: AmongUsVersion, pub among_us_version: AmongUsVersion,
pub data_path: String, pub data_path: String,
pub app_state: GlobalAppState, pub app_state: GlobalAppState,
@@ -71,7 +71,7 @@ impl Default for AppData {
minor: 0, minor: 0,
patch: 0, patch: 0,
}, },
initialized: false, delete_mode: false,
among_us_version: AmongUsVersion::default(), among_us_version: AmongUsVersion::default(),
data_path: String::new(), data_path: String::new(),
app_state: GlobalAppState::Initialized, app_state: GlobalAppState::Initialized,
@@ -162,7 +162,7 @@ impl AppData {
} }
} }
if !self.initialized { if !self.delete_mode {
ui.set_visible(false); ui.set_visible(false);
} }
@@ -193,7 +193,7 @@ impl eframe::App for AppData {
self.update_installs_list = false; self.update_installs_list = false;
} }
egui::TopBottomPanel::bottom("bottom_panel").show(ctx, |ui| { egui::TopBottomPanel::bottom("bottom_panel").show(ctx, |ui| {
ui.checkbox(&mut self.initialized, "DELETE MODE"); ui.checkbox(&mut self.delete_mode, "DELETE MODE");
}); });
egui::CentralPanel::default().show(ctx, |ui| { egui::CentralPanel::default().show(ctx, |ui| {
self.draw_layout(ui); self.draw_layout(ui);
@@ -285,6 +285,10 @@ async fn _get_latest_updater_version() -> Result<(String, String), reqwest::Erro
impl AppData { impl AppData {
fn on_path_added(&mut self) { fn on_path_added(&mut self) {
if self.among_us_path.is_empty() {
return;
}
if let Some(among_us_version) = if let Some(among_us_version) =
determine_among_us_version(String::from(self.among_us_path.clone())) determine_among_us_version(String::from(self.among_us_path.clone()))
{ {
@@ -365,7 +369,6 @@ impl AppData {
new_installed_path.to_str().unwrap(), new_installed_path.to_str().unwrap(),
); );
} }
self.initialized = !self.initialized;
self.app_state = GlobalAppState::Initialized; self.app_state = GlobalAppState::Initialized;
self.update_installs_list = true; self.update_installs_list = true;
} }
@@ -514,7 +517,7 @@ fn main() {
among_us_path: String::from(among_us_folder.clone().to_str().unwrap()), among_us_path: String::from(among_us_folder.clone().to_str().unwrap()),
installs_path: String::from(installs_path.clone().to_str().unwrap()), installs_path: String::from(installs_path.clone().to_str().unwrap()),
version: SemVer::from(version), version: SemVer::from(version),
initialized: false, delete_mode: false,
among_us_version: AmongUsVersion::default(), among_us_version: AmongUsVersion::default(),
data_path: String::from(data_path.clone().to_str().unwrap()), data_path: String::from(data_path.clone().to_str().unwrap()),
app_state: GlobalAppState::Initializing(InitializingState::StartingGUI), app_state: GlobalAppState::Initializing(InitializingState::StartingGUI),
@@ -541,11 +544,10 @@ fn main() {
launch_better_crewlink().unwrap_or(()); launch_better_crewlink().unwrap_or(());
// let app_launcher = AppLauncher::with_window(main_window).delegate(Delegate {});
// app_launcher.launch(app_data).unwrap();
let mut native_options = eframe::NativeOptions::default(); let mut native_options = eframe::NativeOptions::default();
native_options.min_window_size = Some(egui::vec2(425.0, 400.0)); native_options.min_window_size = Some(egui::vec2(425.0, 400.0));
native_options.initial_window_size = Some(egui::vec2(425.0, 400.0)); native_options.initial_window_size = Some(egui::vec2(425.0, 400.0));
app_data.on_path_added();
app_data.detect_installs(); // Initial check since we only update every 10s app_data.detect_installs(); // Initial check since we only update every 10s
eframe::run_native( eframe::run_native(
title_string.as_str(), title_string.as_str(),