Skip to content

Commit

Permalink
add webview check
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jan 8, 2025
1 parent 6baece0 commit 3ea87fd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use std::env;
use tauri::{
menu::{MenuBuilder, MenuItemBuilder},
tray::{MouseButton, MouseButtonState, TrayIconEvent},
Emitter, Manager,
webview_version, Emitter, Manager,
};
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};

mod auto_launch;
mod encryption;
Expand Down Expand Up @@ -59,6 +60,22 @@ fn main() {
window.set_focus().unwrap();
}))
.setup(|app| {
let webview_version = webview_version();

if webview_version.is_err() {
app.dialog()
.message(
"Please install Microsoft Edge WebView2 Runtime! \
(https://developer.microsoft.com/en-gb/microsoft-edge/webview2)",
)
.title("Failed to get webview version")
.kind(MessageDialogKind::Error)
.buttons(MessageDialogButtons::OkCustom("Exit".to_string()))
.blocking_show();

app.app_handle().exit(0);
}

let window = app.get_webview_window("main").unwrap();

// Launch args
Expand Down

0 comments on commit 3ea87fd

Please sign in to comment.