Skip to content
Merged
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
1 change: 1 addition & 0 deletions apps/maple-research/frontend/src-tauri/Cargo.lock

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

1 change: 1 addition & 0 deletions apps/maple-research/frontend/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std"
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSString"] }

[target.'cfg(target_os = "ios")'.dependencies]
objc2 = "0.6"
tauri-plugin-iap = { path = "plugins/tauri-plugin-iap" }
# We build ONNX Runtime 1.23.2 from source for iOS (see scripts/build-ios-onnxruntime.sh)
# We disable download-binaries and copy-dylibs since we link our own xcframework
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use objc2::{msg_send, runtime::AnyObject};
use tauri::{webview::PageLoadEvent, webview::PageLoadPayload, Runtime, Webview};

/// Lets WebKit paint the safe-area strips with the page background again.
///
/// wry 0.57 (tauri-apps/wry#1824) makes the iOS WKWebView non-opaque with a
/// `systemBackgroundColor` background. The page uses `viewport-fit=auto`, so
/// the strips beside the status bar and home indicator then show plain white
/// or black instead of the page background. An opaque WebView paints them
/// from the page, as it did before the Tauri 2.12 upgrade.
///
/// This waits for the first page load: an opaque WebView flashes white before
/// the page paints, which is what wry's change avoids at launch.
pub fn on_page_load<R: Runtime>(webview: &Webview<R>, payload: &PageLoadPayload<'_>) {
if payload.event() != PageLoadEvent::Finished {
return;
}

let result = webview.with_webview(|webview| {
let wk_webview = webview.inner().cast::<AnyObject>();
if wk_webview.is_null() {
return;
}
// SAFETY: on iOS `inner()` is the live WKWebView, and `with_webview`
// runs this closure on the main thread.
unsafe {
let _: () = msg_send![&*wk_webview, setOpaque: true];
}
});
if let Err(error) = result {
log::warn!("Failed to make webview {} opaque: {error}", webview.label());
}
}
3 changes: 3 additions & 0 deletions apps/maple-research/frontend/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use tauri_plugin_deep_link::DeepLinkExt;
mod desktop_app_profile;
#[cfg(test)]
mod ios_app_variant;
#[cfg(target_os = "ios")]
mod ios_webview_background;
#[cfg(any(desktop, target_os = "ios"))]
mod legacy_tts_cleanup;
mod native_oauth;
Expand Down Expand Up @@ -515,6 +517,7 @@ pub fn run() {
// iOS-specific configuration
#[cfg(all(not(desktop), target_os = "ios"))]
let app = builder
.on_page_load(ios_webview_background::on_page_load)
.invoke_handler(tauri::generate_handler![
storekit_experiment::storekit_experiment_enabled,
pdf_extractor::extract_document_content,
Expand Down
Loading