mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-20 03:31:23 +10:00
refactor(downloads): Moved all files relevant to game downloads to their own directory
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
32
src-tauri/src/games/state.rs
Normal file
32
src-tauri/src/games/state.rs
Normal file
@ -0,0 +1,32 @@
|
||||
use crate::{
|
||||
db::{ApplicationTransientStatus, GameDownloadStatus}, download_manager::downloadable_metadata::{DownloadType, DownloadableMetadata}, fetch_state, DB
|
||||
};
|
||||
|
||||
pub type GameStatusWithTransient = (Option<GameDownloadStatus>, Option<ApplicationTransientStatus>);
|
||||
pub struct GameStatusManager {}
|
||||
|
||||
impl GameStatusManager {
|
||||
pub fn fetch_state(game_id: &String) -> GameStatusWithTransient {
|
||||
let db_lock = DB.borrow_data().unwrap();
|
||||
let online_state = match db_lock.applications.installed_game_version.get(game_id) {
|
||||
Some(meta) => db_lock
|
||||
.applications
|
||||
.transient_statuses
|
||||
.get(meta)
|
||||
.cloned(),
|
||||
None => None,
|
||||
};
|
||||
let offline_state = db_lock.applications.game_statuses.get(game_id).cloned();
|
||||
drop(db_lock);
|
||||
|
||||
if online_state.is_some() {
|
||||
return (None, online_state);
|
||||
}
|
||||
|
||||
if offline_state.is_some() {
|
||||
return (offline_state, None);
|
||||
}
|
||||
|
||||
(None, None)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user