From 3ea87fd64d31c0ce45abce1e655842618ff2080b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rik=20Levente?= <33373714+Levminer@users.noreply.github.com> Date: Wed, 8 Jan 2025 17:14:47 +0100 Subject: [PATCH] add webview check --- core/src/main.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/core/src/main.rs b/core/src/main.rs index 6a07744..e032a14 100644 --- a/core/src/main.rs +++ b/core/src/main.rs @@ -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; @@ -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