Преглед на файлове

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

Fabian-Lars преди 1 година
родител
ревизия
5cb196976e
променени са 4 файла, в които са добавени 547 реда и са изтрити 168 реда
  1. 531 162
      examples/web/core/Cargo.lock
  2. 5 0
      examples/web/core/Cargo.toml
  3. 1 1
      examples/web/core/tauri/Cargo.toml
  4. 10 5
      examples/web/core/tauri/src/main.rs

Файловите разлики са ограничени, защото са твърде много
+ 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() {

Някои файлове не бяха показани, защото твърде много файлове са промени