Skip to content

Commit

Permalink
Fixed a couple of bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
4r7if3x committed Apr 25, 2023
1 parent e9434d9 commit ec71cd5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
9 changes: 7 additions & 2 deletions src/gui/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ 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])
Expand All @@ -47,8 +49,11 @@ pub fn footer(
.push(
Text::new("❀")
.width(Length::Fixed(14.0))
.size(FONT_SIZE_FOOTER + 4.0)
.font(get_symbols_font())
.size(FONT_SIZE_FOOTER + match symbols_font {
Font::Default => 0.0,
_ => 4.0
})
.font(symbols_font)
)
.push(
Text::new(" by Giuliano Bellini")
Expand Down
12 changes: 8 additions & 4 deletions src/gui/styles/fonts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use iced::Font;
use once_cell::sync::OnceCell;
use std::collections::HashMap;
use plotters::style::RGBColor;
use std::collections::HashMap;

use crate::translations::types::language::Language;

pub type FontsMap = HashMap<&'static str, Font>;
Expand All @@ -27,17 +28,20 @@ const FONT_METADATA: [FontMetadata; 9] = [

async fn download_font(base_url: &str, metadata: &FontMetadata) -> Result<Font, reqwest::Error> {
let url = format!("{}/{}", base_url, metadata.file);
let response = reqwest::get(url).await?;
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("");

if response.status() == reqwest::StatusCode::NOT_FOUND {
if response.status() != reqwest::StatusCode::OK
|| content_type != "application/octet-stream" {
return Ok(Font::Default);
}

let bytes = response.bytes().await?;
let font_data = Box::new(bytes);
let font = Font::External {
name: metadata.name,
bytes: &*Box::leak(font_data),
bytes: &*Box::leak(font_data)
};
Ok(font)
}
Expand Down
9 changes: 5 additions & 4 deletions src/utils/formatted_strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ pub fn get_open_report_tooltip(language: Language) -> String {
}

pub fn print_cli_welcome_message() {
print!(
let ver = format!("{:<8}", APP_VERSION);

println!(
r"
╔════════════════════════════════════════════════════════════════════╗
β•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•‘
Expand All @@ -221,12 +223,11 @@ pub fn print_cli_welcome_message() {
β•‘ ▁▁▁▁▁▁▁▁▁▁▁▁▁ β•‘
β•‘ β”ƒβ”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”ƒ β•‘
β•‘ ┃│ $ ver │┃ β•‘
β•‘ ┃│ v{APP_VERSION} │┃ β•‘
β•‘ ┃│ v{ver} │┃ β•‘
β•‘ β”ƒβ””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”ƒ________________________ β•‘
β•‘ / β–­β–­β–­β–­β–­β–­β–­β–­β–­ β–£ \ by Giuliano Bellini ) β•‘
β•‘ / β—»β—»β—»β—»β—»β—»β—»β—»β—»β—»β—»β—»β—» \ / β•‘
β•‘ (▁▁▁▁▁▁▁▭▭▭▁▁▁▁▁▁▁) =D-' β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
"
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•"
);
}

0 comments on commit ec71cd5

Please sign in to comment.