Fix auto updater, add failure message, fix modals (#2335)

* Fix auto updater, add failure message, fix modals

* Fix ads hiding, updater UI

* dummy version, fix gh actions cache

* fix release conf

* actual version bump

* Fix ads hiding sometimes

* Fix event state init

* fix remaining bugs

* Fix lint on linux

* Fix deep linking on Windows

* Fix ad links opening multiple times
This commit is contained in:
Geometrically
2024-08-30 10:42:58 -07:00
committed by GitHub
parent 016c3d779b
commit bd61f5d591
70 changed files with 941 additions and 310 deletions

View File

@@ -45,21 +45,14 @@ impl EventState {
.cloned()
}
#[cfg(feature = "tauri")]
pub async fn get() -> crate::Result<Arc<Self>> {
pub fn get() -> crate::Result<Arc<Self>> {
Ok(EVENT_STATE.get().ok_or(EventError::NotInitialized)?.clone())
}
// Initialization requires no app handle in non-tauri mode, so we can just use the same function
#[cfg(not(feature = "tauri"))]
pub async fn get() -> crate::Result<Arc<Self>> {
Self::init().await
}
// Values provided should not be used directly, as they are clones and are not guaranteed to be up-to-date
pub async fn list_progress_bars() -> crate::Result<DashMap<Uuid, LoadingBar>>
{
let value = Self::get().await?;
let value = Self::get()?;
Ok(value.loading_bars.clone())
}
@@ -67,7 +60,7 @@ impl EventState {
pub async fn get_main_window() -> crate::Result<Option<tauri::WebviewWindow>>
{
use tauri::Manager;
let value = Self::get().await?;
let value = Self::get()?;
Ok(value.app.get_webview_window("main"))
}
}
@@ -95,7 +88,7 @@ impl Drop for LoadingBarId {
fn drop(&mut self) {
let loader_uuid = self.0;
tokio::spawn(async move {
if let Ok(event_state) = EventState::get().await {
if let Ok(event_state) = EventState::get() {
#[cfg(any(feature = "tauri", feature = "cli"))]
if let Some((_, bar)) =
event_state.loading_bars.remove(&loader_uuid)
@@ -180,6 +173,11 @@ pub enum LoadingBarType {
import_location: PathBuf,
profile_name: String,
},
CheckingForUpdates,
LauncherUpdate {
version: String,
current_version: String,
},
}
#[derive(Serialize, Clone)]