diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a98eb3b..35b46b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,7 +59,7 @@ jobs: run: cargo build --release --verbose - name: install cargo nextest - run: cargo install cargo-nextest + run: cargo install cargo-nextest@0.9.82 - name: test run: cargo nextest run --no-fail-fast @@ -84,5 +84,9 @@ jobs: with: use-flakehub: false + - name: install_dependencies + run: sudo apt install libdbus-1-dev pkg-config + + - name: Build default package run: nix build diff --git a/src/backend/tracker.rs b/src/backend/tracker.rs index 198578c..3afb9ab 100644 --- a/src/backend/tracker.rs +++ b/src/backend/tracker.rs @@ -35,7 +35,7 @@ pub async fn update_reading_progress( manga_title: SearchTerm, chapter_number: u32, volume_number: Option, - tracker: impl MangaTracker + Send, + tracker: impl MangaTracker, ) -> Result<(), Box> { let response = tracker.search_manga_by_title(manga_title).await?; if let Some(manga) = response { @@ -53,7 +53,7 @@ pub async fn update_reading_progress( pub fn track_manga(tracker: Option, manga_title: String, chapter_number: u32, volume_number: Option, on_error: F) where T: MangaTracker, - F: Fn(String) -> () + Send + 'static, + F: Fn(String) + Send + 'static, { if let Some(tracker) = tracker { tokio::spawn(async move { diff --git a/src/cli.rs b/src/cli.rs index 0795672..a1f584d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -103,8 +103,8 @@ impl CliArgs { self.save_anilist_credentials( AnilistCredentialsProvided { - access_token: &access_token, - client_id: &client_id, + access_token, + client_id, }, storage, )?; diff --git a/src/common.rs b/src/common.rs index 3dcb4dc..8800934 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,15 +1,11 @@ use std::collections::HashMap; -use std::error::Error; use std::fmt::Display; -use manga_tui::SearchTerm; use ratatui::layout::Rect; use ratatui_image::protocol::Protocol; use strum::{Display, EnumIter}; use crate::backend::filter::Languages; -use crate::backend::tracker::{MangaTracker, MarkAsRead}; - #[derive(Default, Clone, Debug, PartialEq)] pub struct Author { pub id: String, diff --git a/src/view/pages/manga.rs b/src/view/pages/manga.rs index 278f98d..fedfc9f 100644 --- a/src/view/pages/manga.rs +++ b/src/view/pages/manga.rs @@ -1,7 +1,6 @@ use std::error::Error; use std::future::Future; use std::io::Cursor; -use std::u32; use crossterm::event::{KeyCode, KeyEvent, MouseEvent, MouseEventKind}; use image::io::Reader; @@ -867,7 +866,7 @@ impl MangaPage { // This conversion is needed so that we take into account chapters // like 1.2, 10.1 etc number.parse::().unwrap_or(0.0) as u32, - volume_number.map(|vol| vol.parse().ok()).flatten(), + volume_number.and_then(|vol| vol.parse().ok()), move |error| { write_to_error_log( format_error_message_tracking_reading_history( @@ -1214,7 +1213,7 @@ impl MangaPage { }, MangaPageEvents::ReadSuccesful(chapter_to_read, manga_to_read) => { self.state = PageState::DisplayingChapters; - let volume = chapter_to_read.clone().volume_number.map(|vol| vol.parse::().ok()).flatten(); + let volume = chapter_to_read.clone().volume_number.and_then(|vol| vol.parse::().ok()); self.track_manga(self.manga_tracker.clone(), self.manga.title.clone(), chapter_to_read.number as u32, volume); self.local_event_tx.send(MangaPageEvents::CheckChapterStatus).ok(); diff --git a/src/view/pages/reader.rs b/src/view/pages/reader.rs index 5879b75..4312af1 100644 --- a/src/view/pages/reader.rs +++ b/src/view/pages/reader.rs @@ -899,7 +899,6 @@ mod test { use self::mpsc::unbounded_channel; use super::*; use crate::backend::database::{ChapterToBookmark, Database}; - use crate::common::format_error_message_tracking_reading_history; use crate::global::test_utils::TrackerTest; use crate::view::widgets::press_key; diff --git a/src/view/tasks/manga.rs b/src/view/tasks/manga.rs index 2493cca..fb03711 100644 --- a/src/view/tasks/manga.rs +++ b/src/view/tasks/manga.rs @@ -3,7 +3,6 @@ use std::path::{Path, PathBuf}; use std::thread::sleep; use std::time::{Duration, Instant}; -use manga_tui::SearchTerm; use reqwest::Url; use tokio::sync::mpsc::UnboundedSender; @@ -17,8 +16,6 @@ use crate::backend::fetch::ApiClient; #[cfg(not(test))] use crate::backend::fetch::MangadexClient; use crate::backend::filter::Languages; -use crate::backend::tracker::anilist::MarkMangaAsReadQuery; -use crate::backend::tracker::{MangaTracker, MarkAsRead}; use crate::config::{DownloadType, ImageQuality, MangaTuiConfig}; use crate::view::app::MangaToRead; use crate::view::pages::manga::{ChapterOrder, MangaPageEvents};