Browse Source

fix(core): update scope usage following #7944 (#7946)

Lucas Fernandes Nogueira 1 year ago
parent
commit
68e7319305

+ 1 - 1
core/tauri/src/lib.rs

@@ -827,7 +827,7 @@ pub trait Manager<R: Runtime>: sealed::ManagerBase<R> {
 
   /// Gets the scope for the asset protocol.
   #[cfg(feature = "protocol-asset")]
-  fn asset_protocol_scope(&self) -> FsScope {
+  fn asset_protocol_scope(&self) -> scope::fs::Scope {
     self.state::<Scopes>().inner().asset_protocol.clone()
   }
 

+ 3 - 5
core/tauri/src/protocol/asset.rs

@@ -2,9 +2,7 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
-use crate::path::SafePathBuf;
-use crate::scope::FsScope;
-use crate::window::UriSchemeProtocolHandler;
+use crate::{path::SafePathBuf, scope, window::UriSchemeProtocolHandler};
 use http::{header::*, status::StatusCode, Request, Response};
 use http_range::HttpRange;
 use rand::RngCore;
@@ -14,7 +12,7 @@ use tauri_utils::mime_type::MimeType;
 use tokio::fs::File;
 use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};
 
-pub fn get(scope: FsScope, window_origin: String) -> UriSchemeProtocolHandler {
+pub fn get(scope: scope::fs::Scope, window_origin: String) -> UriSchemeProtocolHandler {
   Box::new(
     move |request, responder| match get_response(request, &scope, &window_origin) {
       Ok(response) => responder.respond(response),
@@ -31,7 +29,7 @@ pub fn get(scope: FsScope, window_origin: String) -> UriSchemeProtocolHandler {
 
 fn get_response(
   request: Request<Vec<u8>>,
-  scope: &FsScope,
+  scope: &scope::fs::Scope,
   window_origin: &str,
 ) -> Result<Response<Cow<'static, [u8]>>, Box<dyn std::error::Error>> {
   // skip leading `/`

+ 1 - 1
examples/api/src-tauri/Cargo.lock

@@ -3555,7 +3555,6 @@ dependencies = [
  "gtk",
  "http",
  "jni",
- "rand 0.8.5",
  "raw-window-handle",
  "serde",
  "serde_json",
@@ -3601,6 +3600,7 @@ dependencies = [
  "infer 0.12.0",
  "json-patch",
  "kuchikiki",
+ "log",
  "memchr",
  "phf 0.10.1",
  "proc-macro2",

+ 1 - 1
examples/api/src-tauri/src/tray.rs

@@ -101,7 +101,7 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
 
       _ => {}
     })
-    .on_tray_event(|tray, event| {
+    .on_tray_icon_event(|tray, event| {
       if event.click_type == ClickType::Left {
         let app = tray.app_handle();
         if let Some(window) = app.get_window("main") {