Skip to content

Commit

Permalink
fix(core): update scope usage following #7944 (#7946)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Oct 3, 2023
1 parent 44e8a56 commit 68e7319
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion core/tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
8 changes: 3 additions & 5 deletions core/tauri/src/protocol/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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),
Expand All @@ -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 `/`
Expand Down
2 changes: 1 addition & 1 deletion examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/api/src-tauri/src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 68e7319

Please sign in to comment.