You've already forked AstralRinth
forked from didirus/AstralRinth
Search fixes (#134)
* Search fixes * Fix small instance ui * fix javaw issue * menu fix * Add confirm modal for deletion * fix build
This commit is contained in:
@@ -156,7 +156,7 @@ pub async fn auto_install_java(java_version: u32) -> crate::Result<PathBuf> {
|
||||
"Failed to extract java zip".to_string(),
|
||||
))
|
||||
})?;
|
||||
emit_loading(&loading_bar, 100.0, Some("Done extracting java")).await?;
|
||||
emit_loading(&loading_bar, 10.0, Some("Done extracting java")).await?;
|
||||
Ok(path
|
||||
.join(
|
||||
download
|
||||
|
||||
@@ -175,7 +175,7 @@ pub async fn emit_loading(
|
||||
);
|
||||
}
|
||||
|
||||
// Emit event to tauri
|
||||
//Emit event to tauri
|
||||
#[cfg(feature = "tauri")]
|
||||
event_state
|
||||
.app
|
||||
|
||||
@@ -94,51 +94,43 @@ impl Drop for LoadingBarId {
|
||||
let _event = LoadingBarType::StateInit;
|
||||
let _message = "finished".to_string();
|
||||
tokio::spawn(async move {
|
||||
if let Ok(event_state) = crate::EventState::get().await {
|
||||
{
|
||||
let mut bars = event_state.loading_bars.write().await;
|
||||
bars.remove(&loader_uuid);
|
||||
if let Ok(event_state) = EventState::get().await {
|
||||
let mut bars = event_state.loading_bars.write().await;
|
||||
|
||||
#[cfg(any(feature = "tauri", feature = "cli"))]
|
||||
if let Some(bar) = bars.remove(&loader_uuid) {
|
||||
#[cfg(feature = "tauri")]
|
||||
{
|
||||
let loader_uuid = bar.loading_bar_uuid;
|
||||
let event = bar.bar_type.clone();
|
||||
let fraction = bar.current / bar.total;
|
||||
|
||||
use tauri::Manager;
|
||||
let _ = event_state.app.emit_all(
|
||||
"loading",
|
||||
LoadingPayload {
|
||||
fraction: None,
|
||||
message: "Completed".to_string(),
|
||||
event,
|
||||
loader_uuid,
|
||||
},
|
||||
);
|
||||
tracing::debug!(
|
||||
"Exited at {fraction} for loading bar: {:?}",
|
||||
loader_uuid
|
||||
);
|
||||
}
|
||||
|
||||
// Emit event to indicatif progress bar arc
|
||||
#[cfg(feature = "cli")]
|
||||
{
|
||||
let cli_progress_bar = bar.cli_progress_bar.clone();
|
||||
cli_progress_bar.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// When Loading bar is dropped, should attempt to throw out one last event to indicate that the loading bar is done
|
||||
#[cfg(feature = "tauri")]
|
||||
impl Drop for LoadingBar {
|
||||
fn drop(&mut self) {
|
||||
let loader_uuid = self.loading_bar_uuid;
|
||||
let event = self.bar_type.clone();
|
||||
let fraction = self.current / self.total;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
let cli_progress_bar = self.cli_progress_bar.clone();
|
||||
|
||||
tokio::spawn(async move {
|
||||
#[cfg(feature = "tauri")]
|
||||
{
|
||||
use tauri::Manager;
|
||||
if let Ok(event_state) = crate::EventState::get().await {
|
||||
let _ = event_state.app.emit_all(
|
||||
"loading",
|
||||
LoadingPayload {
|
||||
fraction: None,
|
||||
message: "Completed".to_string(),
|
||||
event,
|
||||
loader_uuid,
|
||||
},
|
||||
);
|
||||
tracing::debug!(
|
||||
"Exited at {fraction} for loading bar: {:?}",
|
||||
loader_uuid
|
||||
);
|
||||
}
|
||||
}
|
||||
// Emit event to indicatif progress bar arc
|
||||
#[cfg(feature = "cli")]
|
||||
{
|
||||
cli_progress_bar.finish();
|
||||
#[cfg(not(any(feature = "tauri", feature = "cli")))]
|
||||
bars.remove(&loader_uuid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user