fc69ae30ab
* feat: depot api downloads * feat: frontend fixes and experimental webview store * feat: sync downloader * feat: cleanup and fixes * feat: encrypted database and fixed resuming * feat: launch option selector * fix: autostart when no options * fix: clippy * fix: clippy x2 * feat: executor launch * feat: executor launch * feat: not installed error handling * feat: better offline handling * feat: dependency popup * fix: cancelation and resuming issues * feat: dedup by platform * feat: new ui for additional components and fix dl manager clog * feat: auto-queue dependencies * feat: depot scanning and ranking * feat: new library fetching stack * In-app store page (Windows + macOS) (#176) * feat: async store loading * feat: fix overscroll behaviour * fix: query params in server protocol * fix: clippy
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
#![feature(duration_millis_float)]
|
|
#![feature(nonpoison_mutex)]
|
|
#![feature(sync_nonpoison)]
|
|
|
|
use std::{ops::Deref, sync::OnceLock};
|
|
|
|
use tauri::AppHandle;
|
|
|
|
use crate::{
|
|
download_manager_builder::DownloadManagerBuilder, download_manager_frontend::DownloadManager,
|
|
};
|
|
|
|
pub mod download_manager_builder;
|
|
pub mod download_manager_frontend;
|
|
pub mod downloadable;
|
|
pub mod error;
|
|
pub mod frontend_updates;
|
|
pub mod util;
|
|
pub mod depot_manager;
|
|
|
|
pub static DOWNLOAD_MANAGER: DownloadManagerWrapper = DownloadManagerWrapper::new();
|
|
|
|
pub struct DownloadManagerWrapper(OnceLock<DownloadManager>);
|
|
impl DownloadManagerWrapper {
|
|
const fn new() -> Self {
|
|
DownloadManagerWrapper(OnceLock::new())
|
|
}
|
|
pub fn init(app_handle: AppHandle) {
|
|
DOWNLOAD_MANAGER
|
|
.0
|
|
.set(DownloadManagerBuilder::build(app_handle))
|
|
.expect("failed to initialise download manager");
|
|
}
|
|
}
|
|
|
|
impl Deref for DownloadManagerWrapper {
|
|
type Target = DownloadManager;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
match self.0.get() {
|
|
Some(download_manager) => download_manager,
|
|
None => unreachable!("Download manager should always be initialised"),
|
|
}
|
|
}
|
|
}
|