chore: Various formatting

This commit is contained in:
quexeky
2025-02-06 18:39:27 +11:00
parent 2a1a7326d0
commit 2690c3019d
2 changed files with 19 additions and 8 deletions

View File

@ -135,7 +135,7 @@ impl GameDownloadAgent {
&[("id", &self.id), ("version", &self.version)], &[("id", &self.id), ("version", &self.version)],
|f| f.header("Authorization", header), |f| f.header("Authorization", header),
) )
.map_err(|e| ApplicationDownloadError::Communication(e))? .map_err(ApplicationDownloadError::Communication)?
.send() .send()
.map_err(|e| ApplicationDownloadError::Communication(e.into()))?; .map_err(|e| ApplicationDownloadError::Communication(e.into()))?;
@ -280,9 +280,13 @@ impl GameDownloadAgent {
) { ) {
Ok(request) => request, Ok(request) => request,
Err(e) => { Err(e) => {
sender.send(DownloadManagerSignal::Error(ApplicationDownloadError::Communication(e))).unwrap(); sender
.send(DownloadManagerSignal::Error(
ApplicationDownloadError::Communication(e),
))
.unwrap();
continue; continue;
}, }
}; };
scope.spawn(move |_| { scope.spawn(move |_| {

View File

@ -67,7 +67,9 @@ pub struct StatsUpdateEvent {
pub time: usize, pub time: usize,
} }
pub fn fetch_library_logic(state: tauri::State<'_, Mutex<AppState>>) -> Result<Vec<Game>, RemoteAccessError> { pub fn fetch_library_logic(
state: tauri::State<'_, Mutex<AppState>>,
) -> Result<Vec<Game>, RemoteAccessError> {
let header = generate_authorization_header(); let header = generate_authorization_header();
let client = reqwest::blocking::Client::new(); let client = reqwest::blocking::Client::new();
@ -108,20 +110,25 @@ pub fn fetch_library_logic(state: tauri::State<'_, Mutex<AppState>>) -> Result<V
Ok(games) Ok(games)
} }
pub fn fetch_library_logic_offline(_state: tauri::State<'_, Mutex<AppState>>) -> Result<Vec<Game>, RemoteAccessError> { pub fn fetch_library_logic_offline(
_state: tauri::State<'_, Mutex<AppState>>,
) -> Result<Vec<Game>, RemoteAccessError> {
let mut games: Vec<Game> = get_cached_object("library")?; let mut games: Vec<Game> = get_cached_object("library")?;
let db_handle = borrow_db_checked(); let db_handle = borrow_db_checked();
games.retain(|game| { games.retain(|game| {
db_handle.applications.installed_game_version.contains_key(&game.id) db_handle
.applications
.installed_game_version
.contains_key(&game.id)
}); });
Ok(games) Ok(games)
} }
pub fn fetch_game_logic( pub fn fetch_game_logic(
id: String, id: String,
state: tauri::State<'_, Mutex<AppState>> state: tauri::State<'_, Mutex<AppState>>,
) -> Result<FetchGameStruct, RemoteAccessError> { ) -> Result<FetchGameStruct, RemoteAccessError> {
let mut state_handle = state.lock().unwrap(); let mut state_handle = state.lock().unwrap();
@ -177,7 +184,7 @@ pub fn fetch_game_logic(
pub fn fetch_game_logic_offline( pub fn fetch_game_logic_offline(
id: String, id: String,
_state: tauri::State<'_, Mutex<AppState>> _state: tauri::State<'_, Mutex<AppState>>,
) -> Result<FetchGameStruct, RemoteAccessError> { ) -> Result<FetchGameStruct, RemoteAccessError> {
get_cached_object(id) get_cached_object(id)
} }