mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 16:51:18 +10:00
feat(library): Reactive library updating
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
@ -38,7 +38,6 @@ pub fn uninstall_game(game_id: String, app_handle: AppHandle) -> Result<(), Libr
|
||||
Some(data) => data,
|
||||
None => return Err(LibraryError::MetaNotFound(game_id)),
|
||||
};
|
||||
println!("{:?}", meta);
|
||||
uninstall_game_logic(meta, &app_handle);
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -103,7 +103,6 @@ pub fn fetch_library_logic(
|
||||
drop(db_handle);
|
||||
cache_object("library", &games)?;
|
||||
|
||||
|
||||
Ok(games)
|
||||
}
|
||||
pub fn fetch_library_logic_offline(
|
||||
@ -137,8 +136,7 @@ pub fn fetch_game_logic(
|
||||
status,
|
||||
};
|
||||
|
||||
|
||||
cache_object(id, &data)?;
|
||||
cache_object(id, &data)?;
|
||||
|
||||
return Ok(data);
|
||||
}
|
||||
@ -261,8 +259,6 @@ pub fn uninstall_game_logic(meta: DownloadableMetadata, app_handle: &AppHandle)
|
||||
.entry(meta.clone())
|
||||
.and_modify(|v| *v = ApplicationTransientStatus::Uninstalling {});
|
||||
|
||||
db_handle.applications.installed_game_version.remove(&meta.id);
|
||||
|
||||
drop(db_handle);
|
||||
|
||||
let app_handle = app_handle.clone();
|
||||
@ -273,6 +269,10 @@ pub fn uninstall_game_logic(meta: DownloadableMetadata, app_handle: &AppHandle)
|
||||
Ok(_) => {
|
||||
let mut db_handle = borrow_db_mut_checked();
|
||||
db_handle.applications.transient_statuses.remove(&meta);
|
||||
db_handle
|
||||
.applications
|
||||
.installed_game_version
|
||||
.remove(&meta.id);
|
||||
db_handle
|
||||
.applications
|
||||
.game_statuses
|
||||
@ -282,6 +282,7 @@ pub fn uninstall_game_logic(meta: DownloadableMetadata, app_handle: &AppHandle)
|
||||
save_db();
|
||||
|
||||
debug!("uninstalled game id {}", &meta.id);
|
||||
app_handle.emit("update_library", {}).unwrap();
|
||||
|
||||
push_game_update(
|
||||
&app_handle,
|
||||
|
||||
Reference in New Issue
Block a user