Browse Source

fix(examples): Update web example to latest dialog plugin (#8567)

Fabian-Lars 1 year ago
parent
commit
5cb196976e

File diff suppressed because it is too large
+ 531 - 162
examples/web/core/Cargo.lock


+ 5 - 0
examples/web/core/Cargo.toml

@@ -4,3 +4,8 @@ members = [
   "tauri",
   "wasm"
 ]
+resolver = "2"
+
+# Patching the dialog plugin to use the local copy of tauri
+[patch.crates-io]
+tauri = { path = "../../../core/tauri" }

+ 1 - 1
examples/web/core/tauri/Cargo.toml

@@ -15,7 +15,7 @@ tauri-build = { path = "../../../../core/tauri-build", features = [] }
 [dependencies]
 api = { path = "../api" }
 tauri = { path = "../../../../core/tauri" }
-tauri-plugin-dialog = "2.0.0-alpha.2"
+tauri-plugin-dialog = "2.0.0-alpha.7"
 
 [features]
 custom-protocol = ["tauri/custom-protocol"]

+ 10 - 5
examples/web/core/tauri/src/main.rs

@@ -3,13 +3,18 @@
 // SPDX-License-Identifier: MIT
 
 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
-use tauri_plugin_dialog::DialogExt;
+
+use tauri_plugin_dialog::{DialogExt, MessageDialogBuilder};
 
 #[tauri::command]
-fn greet(window: tauri::Window, name: String) {
-  MessageDialogBuilder::new(window.dialog(), "Tauri Example")
-    .parent(&window)
-    .show();
+async fn greet(window: tauri::Window, name: String) -> bool {
+  MessageDialogBuilder::new(
+    window.dialog().to_owned(),
+    "Tauri Example",
+    format!("Hello {name}"),
+  )
+  .parent(&window)
+  .blocking_show()
 }
 
 fn main() {

Some files were not shown because too many files changed in this diff