mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-07-26 09:44:47 +10:00
87bbe1da49
* chore: Major refactoring Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example Signed-off-by: quexeky <git@quexeky.dev> * fix: Remote tauri dependency from process Signed-off-by: quexeky <git@quexeky.dev> * refactor: Improvements to src-tauri Signed-off-by: quexeky <git@quexeky.dev> * refactor: Builds, but some logic still left to move back Signed-off-by: quexeky <git@quexeky.dev> * refactor: Finish refactor Signed-off-by: quexeky <git@quexeky.dev> * chore: Run cargo clippy && cargo fmt Signed-off-by: quexeky <git@quexeky.dev> * refactor: Move everything into src-tauri Signed-off-by: quexeky <git@quexeky.dev> --------- Signed-off-by: quexeky <git@quexeky.dev>
32 lines
1.1 KiB
Rust
32 lines
1.1 KiB
Rust
use std::sync::Arc;
|
|
|
|
use database::DownloadableMetadata;
|
|
use tauri::AppHandle;
|
|
|
|
use crate::error::ApplicationDownloadError;
|
|
|
|
use super::{
|
|
download_manager_frontend::DownloadStatus,
|
|
util::{download_thread_control_flag::DownloadThreadControl, progress_object::ProgressObject},
|
|
};
|
|
|
|
/**
|
|
* Downloadables are responsible for managing their specific object's download state
|
|
* e.g, the GameDownloadAgent is responsible for pushing game updates
|
|
*
|
|
* But the download manager manages the queue state
|
|
*/
|
|
pub trait Downloadable: Send + Sync {
|
|
fn download(&self, app_handle: &AppHandle) -> Result<bool, ApplicationDownloadError>;
|
|
fn validate(&self, app_handle: &AppHandle) -> Result<bool, ApplicationDownloadError>;
|
|
|
|
fn progress(&self) -> Arc<ProgressObject>;
|
|
fn control_flag(&self) -> DownloadThreadControl;
|
|
fn status(&self) -> DownloadStatus;
|
|
fn metadata(&self) -> DownloadableMetadata;
|
|
fn on_queued(&self, app_handle: &AppHandle);
|
|
fn on_error(&self, app_handle: &AppHandle, error: &ApplicationDownloadError);
|
|
fn on_complete(&self, app_handle: &AppHandle);
|
|
fn on_cancelled(&self, app_handle: &AppHandle);
|
|
}
|