Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changes/permission-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"tauri": patch
"tauri-runtime": patch
"tauri-runtime-wry": patch
---

Expand the `PermissionKind` and `PermissionResponse` enums to match the updated `wry` API.
This includes support for permission types such as `DisplayCapture`, `Midi`, `Sensors`, `MediaKeySystemAccess`, `LocalFonts`, `WindowManagement`, `PointerLock`, `AutomaticDownloads`, `FileSystemAccess`, and `Autoplay`.
Added `PermissionResponse::Prompt` to explicitly trigger system dialogs.
Added Android support for geolocation, microphone, camera, protected media, and MIDI requests via JNI.
Updated Linux DisplayCapture support for WebKitGTK versions older than 2.42.
111 changes: 94 additions & 17 deletions 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 crates/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition.workspace = true
rust-version.workspace = true

[dependencies]
wry = { version = "0.55.0", default-features = false, features = [
wry = { git = "https://github.com/F0RLE/wry", rev = "d0559d061a4ada67790a10839d8cd613e1cc6bea", default-features = false, features = [
"protocol",
"os-webview",
"linux-body",
Expand Down
43 changes: 43 additions & 0 deletions crates/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4966,6 +4966,49 @@ You may have it installed on another user account, but it is not available for t
webview_builder.with_document_title_changed_handler(document_title_changed_handler)
}

if let Some(permission_request_handler) = pending.permission_request_handler {
webview_builder = webview_builder.with_permission_handler(move |kind| {
let kind = match kind {
wry::PermissionKind::Microphone => tauri_runtime::webview::PermissionKind::Microphone,
wry::PermissionKind::Camera => tauri_runtime::webview::PermissionKind::Camera,
wry::PermissionKind::Geolocation => tauri_runtime::webview::PermissionKind::Geolocation,
wry::PermissionKind::Notifications => tauri_runtime::webview::PermissionKind::Notifications,
wry::PermissionKind::ClipboardRead => tauri_runtime::webview::PermissionKind::ClipboardRead,
wry::PermissionKind::DisplayCapture => {
tauri_runtime::webview::PermissionKind::DisplayCapture
}
wry::PermissionKind::Midi => tauri_runtime::webview::PermissionKind::Midi,
wry::PermissionKind::Sensors => tauri_runtime::webview::PermissionKind::Sensors,
wry::PermissionKind::MediaKeySystemAccess => {
tauri_runtime::webview::PermissionKind::MediaKeySystemAccess
}
wry::PermissionKind::LocalFonts => tauri_runtime::webview::PermissionKind::LocalFonts,
wry::PermissionKind::WindowManagement => {
tauri_runtime::webview::PermissionKind::WindowManagement
}
wry::PermissionKind::PointerLock => tauri_runtime::webview::PermissionKind::PointerLock,
wry::PermissionKind::AutomaticDownloads => {
tauri_runtime::webview::PermissionKind::AutomaticDownloads
}
wry::PermissionKind::FileSystemAccess => {
tauri_runtime::webview::PermissionKind::FileSystemAccess
}
wry::PermissionKind::Autoplay => tauri_runtime::webview::PermissionKind::Autoplay,
wry::PermissionKind::Other => tauri_runtime::webview::PermissionKind::Other,
_ => tauri_runtime::webview::PermissionKind::Other,
};

let response = permission_request_handler(kind);

match response {
tauri_runtime::webview::PermissionResponse::Allow => wry::PermissionResponse::Allow,
tauri_runtime::webview::PermissionResponse::Deny => wry::PermissionResponse::Deny,
tauri_runtime::webview::PermissionResponse::Default => wry::PermissionResponse::Default,
tauri_runtime::webview::PermissionResponse::Prompt => wry::PermissionResponse::Prompt,
}
});
}

let webview_bounds = if let Some(bounds) = webview_attributes.bounds {
let bounds: RectWrapper = bounds.into();
let bounds = bounds.0;
Expand Down
Loading