mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-18 18:51:16 +10:00
* feat: add new template options, asahi support, and refactoring * feat: install dir scanning, validation fixes, progress fixes, download manager refactor This kind of ballooned out of scope, but I implemented some much needed fixes for the download manager. First off, I cleanup the Downloadable trait, there was some duplication of function. Second, I refactored the "validate" into the GameDownloadAgent, which calls a 'validate_chunk_logic' yada, same structure as downloading. Third, I fixed the progress and validation issues. Fourth, I added game scanning * feat: out of box support for Asahi Linux * fix: clippy * fix: don't break database
28 lines
869 B
Rust
28 lines
869 B
Rust
use crate::database::models::data::{ApplicationTransientStatus, Database, GameDownloadStatus};
|
|
|
|
pub type GameStatusWithTransient = (
|
|
Option<GameDownloadStatus>,
|
|
Option<ApplicationTransientStatus>,
|
|
);
|
|
pub struct GameStatusManager {}
|
|
|
|
impl GameStatusManager {
|
|
pub fn fetch_state(game_id: &String, database: &Database) -> GameStatusWithTransient {
|
|
let online_state = match database.applications.installed_game_version.get(game_id) {
|
|
Some(meta) => database.applications.transient_statuses.get(meta).cloned(),
|
|
None => None,
|
|
};
|
|
let offline_state = database.applications.game_statuses.get(game_id).cloned();
|
|
|
|
if online_state.is_some() {
|
|
return (None, online_state);
|
|
}
|
|
|
|
if offline_state.is_some() {
|
|
return (offline_state, None);
|
|
}
|
|
|
|
(None, None)
|
|
}
|
|
}
|