mirror of
https://github.com/StarCitizenToolBox/app.git
synced 2026-01-13 19:50:28 +00:00
fix: webview
This commit is contained in:
parent
39d571960b
commit
c8962d509c
@ -166,6 +166,7 @@ class HomeGameLoginUIModel extends _$HomeGameLoginUIModel {
|
||||
applicationSupportDir: appGlobalState.applicationSupportDir!,
|
||||
appVersionData: appGlobalState.networkVersionData!,
|
||||
);
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
await webViewModel.launch(url, appGlobalState.networkVersionData!);
|
||||
}
|
||||
|
||||
|
||||
@ -434,6 +434,16 @@ fn run_webview_loop(
|
||||
let proxy = proxy.clone();
|
||||
move |event, url| {
|
||||
if url == "about:blank" {
|
||||
if matches!(event, PageLoadEvent::Finished) {
|
||||
// if url is about:blank, show loading
|
||||
let loading_script = format!(
|
||||
r#"document.open(); document.write({}); document.close();"#,
|
||||
serde_json::to_string(LOADING_PAGE_HTML).unwrap_or_default()
|
||||
);
|
||||
let _ = proxy.send_event(UserEvent::Command(
|
||||
WebViewCommand::ExecuteScript(loading_script),
|
||||
));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -603,13 +613,6 @@ fn run_webview_loop(
|
||||
.build(&window)
|
||||
.expect("Failed to create webview");
|
||||
|
||||
// Show loading page while waiting for Navigate command
|
||||
let loading_script = format!(
|
||||
r#"document.open(); document.write({}); document.close();"#,
|
||||
serde_json::to_string(LOADING_PAGE_HTML).unwrap_or_default()
|
||||
);
|
||||
let _ = webview.evaluate_script(&loading_script);
|
||||
|
||||
let webview = Arc::new(webview);
|
||||
let webview_cmd = Arc::clone(&webview);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user