mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-16 17:51:23 +10:00
feat(game): game uninstalling & partial compat
This commit is contained in:
@ -2,6 +2,7 @@ use std::{
|
||||
any::Any,
|
||||
collections::VecDeque,
|
||||
fmt::Debug,
|
||||
io,
|
||||
sync::{
|
||||
mpsc::{SendError, Sender},
|
||||
Arc, Mutex, MutexGuard,
|
||||
@ -41,8 +42,12 @@ pub enum DownloadManagerSignal {
|
||||
Error(GameDownloadError),
|
||||
/// Pushes UI update
|
||||
Update,
|
||||
/// Uninstall game
|
||||
/// Takes game ID
|
||||
Uninstall(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DownloadManagerStatus {
|
||||
Downloading,
|
||||
Paused,
|
||||
@ -51,6 +56,15 @@ pub enum DownloadManagerStatus {
|
||||
Finished,
|
||||
}
|
||||
|
||||
impl Serialize for DownloadManagerStatus {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&format!["{:?}", self])
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
pub enum GameDownloadStatus {
|
||||
Queued,
|
||||
@ -191,6 +205,11 @@ impl DownloadManager {
|
||||
.unwrap();
|
||||
self.terminator.join()
|
||||
}
|
||||
pub fn uninstall_game(&self, game_id: String) {
|
||||
self.command_sender
|
||||
.send(DownloadManagerSignal::Uninstall(game_id))
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// Takes in the locked value from .edit() and attempts to
|
||||
|
||||
Reference in New Issue
Block a user