From 46302d208d8b95ffb7270643fbe5f28d5f43086d Mon Sep 17 00:00:00 2001 From: Giuliano Bellini s294739 Date: Wed, 26 Apr 2023 12:56:46 +0200 Subject: [PATCH] Revert "Fixed a couple of bugs" This reverts commit ec71cd5854c5fefb917323174f7ed2608173e74f. --- src/gui/components/footer.rs | 9 ++------- src/gui/styles/fonts.rs | 12 ++++-------- src/utils/formatted_strings.rs | 9 ++++----- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/gui/components/footer.rs b/src/gui/components/footer.rs index 6ea3a7fb..1e253876 100644 --- a/src/gui/components/footer.rs +++ b/src/gui/components/footer.rs @@ -28,8 +28,6 @@ pub fn footer( let release_details_row = get_release_details(language, style, font_footer, newer_release_available); - let symbols_font = get_symbols_font(); - let footer_row = Row::new() .width(Length::Fill) .padding([0, 20]) @@ -49,11 +47,8 @@ pub fn footer( .push( Text::new("❤") .width(Length::Fixed(14.0)) - .size(FONT_SIZE_FOOTER + match symbols_font { - Font::Default => 0.0, - _ => 4.0 - }) - .font(symbols_font) + .size(FONT_SIZE_FOOTER + 4.0) + .font(get_symbols_font()) ) .push( Text::new(" by Giuliano Bellini") diff --git a/src/gui/styles/fonts.rs b/src/gui/styles/fonts.rs index b93f13c7..73f830e5 100644 --- a/src/gui/styles/fonts.rs +++ b/src/gui/styles/fonts.rs @@ -1,8 +1,7 @@ use iced::Font; use once_cell::sync::OnceCell; -use plotters::style::RGBColor; use std::collections::HashMap; - +use plotters::style::RGBColor; use crate::translations::types::language::Language; pub type FontsMap = HashMap<&'static str, Font>; @@ -28,12 +27,9 @@ const FONT_METADATA: [FontMetadata; 9] = [ async fn download_font(base_url: &str, metadata: &FontMetadata) -> Result { let url = format!("{}/{}", base_url, metadata.file); - let client = reqwest::Client::builder().redirect(reqwest::redirect::Policy::none()).build()?; - let response = client.get(url).send().await?; - let content_type = response.headers().get(reqwest::header::CONTENT_TYPE).map(|ct| ct.to_str().unwrap_or("")).unwrap_or(""); + let response = reqwest::get(url).await?; - if response.status() != reqwest::StatusCode::OK - || content_type != "application/octet-stream" { + if response.status() == reqwest::StatusCode::NOT_FOUND { return Ok(Font::Default); } @@ -41,7 +37,7 @@ async fn download_font(base_url: &str, metadata: &FontMetadata) -> Result String { } pub fn print_cli_welcome_message() { - let ver = format!("{:<8}", APP_VERSION); - - println!( + print!( r" ╔════════════════════════════════════════════════════════════════════╗ ║ ███████╗███╗ ██╗██╗███████╗███████╗███╗ ██╗███████╗████████╗ ║ @@ -223,11 +221,12 @@ pub fn print_cli_welcome_message() { ║ ▁▁▁▁▁▁▁▁▁▁▁▁▁ ║ ║ ┃┌───────────┐┃ ║ ║ ┃│ $ ver │┃ ║ - ║ ┃│ v{ver} │┃ ║ + ║ ┃│ v{APP_VERSION} │┃ ║ ║ ┃└───────────┘┃________________________ ║ ║ / ▭▭▭▭▭▭▭▭▭ ▣ \ by Giuliano Bellini ) ║ ║ / ◻◻◻◻◻◻◻◻◻◻◻◻◻ \ / ║ ║ (▁▁▁▁▁▁▁▭▭▭▁▁▁▁▁▁▁) =D-' ║ - ╚════════════════════════════════════════════════════════════════════╝" + ╚════════════════════════════════════════════════════════════════════╝ + " ); }