Fix android/ios muda cfg

This commit is contained in:
Jonathan Kelley committed 2024-01-05 23:37:10 -08:00
1 parent e9e7219b4b
commit 0ac8955bab
5 files changed
+16 -8

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
use crate::{ use crate::{
cfg::{Config, WindowCloseBehaviour}, config::{Config, WindowCloseBehaviour},
desktop_context::WindowEventHandlers, desktop_context::WindowEventHandlers,
element::DesktopElement, element::DesktopElement,
file_upload::FileDialogRequest, file_upload::FileDialogRequest,
File renamed without changes.
+7 -3
View File
@@ -5,7 +5,7 @@
mod app; mod app;
mod assets; mod assets;
mod cfg; mod config;
mod desktop_context; mod desktop_context;
mod edits; mod edits;
mod element; mod element;
@@ -15,7 +15,6 @@ mod events;
mod file_upload; mod file_upload;
mod hooks; mod hooks;
mod ipc; mod ipc;
mod menubar;
mod protocol; mod protocol;
mod query; mod query;
mod shortcut; mod shortcut;
@@ -25,9 +24,14 @@ mod webview;
#[cfg(feature = "collect-assets")] #[cfg(feature = "collect-assets")]
mod collect_assets; mod collect_assets;
// mobile shortcut is only supported on mobile platforms
#[cfg(any(target_os = "ios", target_os = "android"))] #[cfg(any(target_os = "ios", target_os = "android"))]
mod mobile_shortcut; mod mobile_shortcut;
// menu bar is only supported on desktop platforms
#[cfg(not(any(target_os = "android", target_os = "ios")))]
mod menubar;
// The main entrypoint for this crate // The main entrypoint for this crate
pub use launch::*; pub use launch::*;
mod launch; mod launch;
@@ -41,7 +45,7 @@ pub use wry;
// Public exports // Public exports
pub use assets::AssetRequest; pub use assets::AssetRequest;
pub use cfg::{Config, WindowCloseBehaviour}; pub use config::{Config, WindowCloseBehaviour};
pub use desktop_context::{ pub use desktop_context::{
window, DesktopContext, DesktopService, WryEventHandler, WryEventHandlerId, window, DesktopContext, DesktopService, WryEventHandler, WryEventHandlerId,
}; };
+6
View File
@@ -1,6 +1,12 @@
use muda::{Menu, PredefinedMenuItem, Submenu}; use muda::{Menu, PredefinedMenuItem, Submenu};
use tao::window::Window; use tao::window::Window;
pub fn build_menu(window: &Window, default_menu_bar: bool) {
if default_menu_bar {
build_menu_bar(build_default_menu_bar(), window)
}
}
#[allow(unused)] #[allow(unused)]
pub fn build_menu_bar(menu: Menu, window: &Window) { pub fn build_menu_bar(menu: Menu, window: &Window) {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
+2 -4
View File
@@ -28,10 +28,8 @@ impl WebviewInstance {
let window = cfg.window.clone().build(&shared.target).unwrap(); let window = cfg.window.clone().build(&shared.target).unwrap();
// TODO: allow users to specify their own menubars, again :/ // TODO: allow users to specify their own menubars, again :/
if cfg.enable_default_menu_bar { #[cfg(not(any(target_os = "android", target_os = "ios")))]
use crate::menubar::*; crate::menubar::build_menu(&window, cfg.enable_default_menu_bar);
build_menu_bar(build_default_menu_bar(), &window);
}
// We assume that if the icon is None in cfg, then the user just didnt set it // We assume that if the icon is None in cfg, then the user just didnt set it
if cfg.window.window.window_icon.is_none() { if cfg.window.window.window_icon.is_none() {