Skip to content

Commit

Permalink
fix(mac): suppress duplicated media permission prompt (#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen authored Mar 11, 2024
1 parent b8fea39 commit ae64a09
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/wkwebview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,16 +804,10 @@ impl InnerWebView {
run_file_upload_panel as extern "C" fn(&Object, Sel, id, id, id, id),
);

// Only disable media dialogs on macOS < 14.0
// https://tauri.app/v1/references/webview-versions/
let webview_system_version = platform_webview_system_version()?.parse::<i32>();
if webview_system_version.is_err() || webview_system_version.unwrap() < 19 {
// Disable media dialogs
ctl.add_method(
sel!(webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:),
request_media_capture_permission as extern "C" fn(&Object, Sel, id, id, id, id, id),
);
}
ctl.add_method(
sel!(webView:requestMediaCapturePermissionForOrigin:initiatedByFrame:type:decisionHandler:),
request_media_capture_permission as extern "C" fn(&Object, Sel, id, id, id, id, id),
);

ctl.register()
}
Expand Down

0 comments on commit ae64a09

Please sign in to comment.