Compare commits
1 Commits
8e61c8a2f2
...
3.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| ff311475dc |
@@ -1,8 +1,8 @@
|
||||
use crate::AmongUsVersion;
|
||||
use crate::AppData;
|
||||
use druid::{
|
||||
widget::*, BoxConstraints, Env, Event, EventCtx, FileDialogOptions, LayoutCtx, LifeCycle,
|
||||
LifeCycleCtx, PaintCtx, Selector, Size, UpdateCtx, WidgetExt, WidgetPod,
|
||||
widget::*, BoxConstraints, Color, Env, Event, EventCtx, FileDialogOptions, LayoutCtx,
|
||||
LifeCycle, LifeCycleCtx, PaintCtx, Selector, Size, UpdateCtx, WidgetExt, WidgetPod,
|
||||
};
|
||||
use std::{fs, io, path::PathBuf};
|
||||
|
||||
@@ -87,18 +87,28 @@ impl AmongUsLauncherWidget {
|
||||
for i in collection {
|
||||
let existing_ver_smash = i.unwrap().file_name();
|
||||
let mut ver_smash_split = existing_ver_smash.to_str().unwrap().split('-');
|
||||
let mut blessed_split = data.blessed_version.as_str().split('-');
|
||||
let blessed_version = AmongUsVersion::from(blessed_split.next().unwrap());
|
||||
let among_us_version = AmongUsVersion::from(ver_smash_split.next().unwrap());
|
||||
let button_string: String =
|
||||
format!("Town of Us {}", ver_smash_split.next().unwrap());
|
||||
let tou_version = ver_smash_split.next().unwrap();
|
||||
let blessed_tou_version = blessed_split.next().unwrap();
|
||||
let button_string: String = format!("Town of Us {}", tou_version);
|
||||
|
||||
for (index, j) in auv_array.iter().enumerate() {
|
||||
if j == &among_us_version {
|
||||
let mut clone: PathBuf = PathBuf::from(data.installs_path.clone());
|
||||
clone.push(existing_ver_smash.clone());
|
||||
|
||||
let mut button_label: Label<AppData> =
|
||||
Label::new(button_string.as_str()).with_text_size(24.0);
|
||||
|
||||
if j == &blessed_version && tou_version == blessed_tou_version {
|
||||
button_label.set_text_color(Color::GREEN);
|
||||
}
|
||||
|
||||
let mut button_row: Flex<AppData> = Flex::row();
|
||||
|
||||
let fybutton = druid::widget::Button::new(button_string.as_str())
|
||||
let fybutton = druid::widget::Button::from_label(button_label)
|
||||
.fix_height(45.0)
|
||||
.center()
|
||||
.on_click(move |_, _: &mut AppData, _| {
|
||||
|
||||
13
src/main.rs
13
src/main.rs
@@ -28,6 +28,8 @@ use druid::{
|
||||
WidgetPod, WindowDesc, WindowId,
|
||||
};
|
||||
|
||||
use reqwest::StatusCode;
|
||||
|
||||
#[derive(PartialEq, Eq, Data, Clone, Debug)]
|
||||
pub enum InitializingState {
|
||||
StartingGUI,
|
||||
@@ -58,6 +60,7 @@ pub struct AppData {
|
||||
pub among_us_version: AmongUsVersion,
|
||||
pub data_path: String,
|
||||
pub app_state: GlobalAppState,
|
||||
pub blessed_version: String,
|
||||
}
|
||||
|
||||
static AMONG_US_APPID: &str = "945360";
|
||||
@@ -268,6 +271,15 @@ impl AppDelegate<AppData> for Delegate {
|
||||
fn main() {
|
||||
let version = env!("CARGO_PKG_VERSION");
|
||||
let title_string: String = format!("Town of Us Updater - {}", version);
|
||||
let blessed_body = reqwest::blocking::get("https://tou.dormedas.com/blessed");
|
||||
let response = blessed_body.unwrap();
|
||||
|
||||
let blessed_version: String = match response.status() {
|
||||
StatusCode::OK => response.text().unwrap(),
|
||||
_ => String::from("0.0.0-v0.0.0"),
|
||||
};
|
||||
|
||||
println!("Blessed Version: {}", blessed_version);
|
||||
|
||||
// println!("Updater Version: {}", version);
|
||||
// get_latest_updater_version().await.unwrap();
|
||||
@@ -310,6 +322,7 @@ fn main() {
|
||||
among_us_version: AmongUsVersion::default(),
|
||||
data_path: String::from(data_path.clone().to_str().unwrap()),
|
||||
app_state: GlobalAppState::Initializing(InitializingState::StartingGUI),
|
||||
blessed_version,
|
||||
};
|
||||
|
||||
let mut root_column: druid::widget::Flex<AppData> = druid::widget::Flex::column();
|
||||
|
||||
Reference in New Issue
Block a user