mirror of
https://gitlab.com/vyla-entertainment/go.git
synced 2026-11-14 23:47:23 -05:00
add Android edge-to-edge display support and emulator testing instructions
This commit is contained in:
@@ -626,9 +626,37 @@ const ANDROID_VIDEO_FIX_SCRIPT: &str = r#"
|
||||
})();
|
||||
"#;
|
||||
|
||||
const EDGE_TO_EDGE_SCRIPT: &str = r#"
|
||||
(function() {
|
||||
var m = document.querySelector('meta[name=viewport]');
|
||||
if (m && m.content.indexOf('viewport-fit') === -1) {
|
||||
m.content += ', viewport-fit=cover';
|
||||
}
|
||||
function apply(t, r, b, l) {
|
||||
var s = document.documentElement.style;
|
||||
s.setProperty('--safe-top', t + 'px');
|
||||
s.setProperty('--safe-right', r + 'px');
|
||||
s.setProperty('--safe-bottom', b + 'px');
|
||||
s.setProperty('--safe-left', l + 'px');
|
||||
}
|
||||
window.__vylaApplyInsets = apply;
|
||||
try {
|
||||
if (window.VylaInsets) {
|
||||
var v = JSON.parse(window.VylaInsets.get());
|
||||
apply(v.top, v.right, v.bottom, v.left);
|
||||
}
|
||||
} catch (e) {}
|
||||
})();
|
||||
"#;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.on_page_load(|webview, payload| {
|
||||
if payload.event() == tauri::webview::PageLoadEvent::Finished {
|
||||
let _ = webview.eval(EDGE_TO_EDGE_SCRIPT);
|
||||
}
|
||||
})
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
|
||||
Reference in New Issue
Block a user