use std::io::Read;
pub struct AssetFileEntry<'a> {
pub path: String,
pub reader: Box<dyn Read + 'a>,
}
#[derive(Debug, Clone)]
pub struct DeviceInfo {
pub brand: String,
pub model: String,
pub market_name: String,
pub os_name: String,
pub os_version: String,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct ScreenInfo {
pub width: f64,
pub height: f64,
pub scale: f64,
}
mod banner_background;
pub mod control_session;
pub(crate) mod rt;
pub mod traits;
#[cfg(feature = "capture-contract")]
pub mod capture;
#[cfg(target_os = "android")]
mod android;
#[cfg(any(target_os = "ios", target_os = "macos"))]
mod apple;
#[cfg(target_env = "ohos")]
pub mod harmony;
#[cfg(target_os = "windows")]
pub mod windows;
#[cfg(not(any(
target_os = "android",
target_os = "ios",
target_os = "macos",
target_os = "windows",
target_env = "ohos"
)))]
mod unsupported;
#[cfg(any(target_os = "macos", target_os = "windows"))]
pub mod desktop;
pub fn os_label() -> &'static str {
#[cfg(any(target_os = "ios", target_os = "macos"))]
{
if cfg!(target_os = "macos") {
"macOS"
} else {
"iOS"
}
}
#[cfg(target_os = "android")]
{
"Android"
}
#[cfg(target_os = "windows")]
{
"Windows"
}
#[cfg(all(target_os = "linux", target_env = "ohos"))]
{
"Harmony"
}
#[cfg(not(any(
target_os = "ios",
target_os = "macos",
target_os = "android",
target_os = "windows",
all(target_os = "linux", target_env = "ohos"),
)))]
{
"unknown"
}
}
#[cfg(any(
target_os = "macos",
target_os = "windows",
target_os = "ios",
target_os = "android",
all(target_os = "linux", target_env = "ohos"),
))]
pub fn notification_supported() -> bool {
true
}
#[cfg(any(target_os = "macos", target_os = "windows"))]
pub fn banner_supported() -> bool {
true
}
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
pub fn banner_supported() -> bool {
false
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct BadgeSurfaces {
pub app_icon: bool,
pub tray: bool,
pub numeric_only: bool,
}
pub fn badge_surfaces() -> BadgeSurfaces {
#[cfg(target_os = "macos")]
{
BadgeSurfaces {
app_icon: true,
tray: true,
numeric_only: false,
}
}
#[cfg(target_os = "ios")]
{
BadgeSurfaces {
app_icon: true,
tray: false,
numeric_only: true,
}
}
#[cfg(target_os = "windows")]
{
BadgeSurfaces {
app_icon: true,
tray: false,
numeric_only: true,
}
}
#[cfg(target_env = "ohos")]
{
BadgeSurfaces {
app_icon: true,
tray: false,
numeric_only: true,
}
}
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "windows",
target_env = "ohos"
)))]
{
BadgeSurfaces::default()
}
}
#[cfg(any(target_os = "macos", target_os = "windows"))]
pub fn autostart_supported() -> bool {
#[cfg(target_os = "macos")]
{
apple::autostart_probe_supported()
}
#[cfg(target_os = "windows")]
{
true
}
}
#[cfg(target_os = "android")]
pub use android::{
CachedClass, Platform, get_android_id, get_api_level, get_system_property,
has_telephony_feature, init_cached_class, initialize_jni, read_external_storage_text,
write_external_storage_text,
};
pub use control_session::{
ControlSessionStopHandler, request_control_session_stop, set_control_session_stop_handler,
};
#[cfg(any(target_os = "ios", target_os = "macos"))]
pub use apple::Platform;
#[cfg(any(target_os = "ios", target_os = "macos"))]
pub use apple::apply_staged_macos_update;
#[cfg(target_env = "ohos")]
pub use harmony::Platform;
#[cfg(target_os = "windows")]
pub use windows::{
Platform, WindowsMediaPreviewCancel, WindowsMediaPreviewOpen, WindowsUrlSurfaceWebTag,
WindowsVideoCommandDispatcher, apply_staged_windows_update, ensure_toast_activator,
install_windows_aside_panel_bridge, register_windows_media_preview_host,
register_windows_video_command_dispatcher, remove_toast_registration,
replay_windows_exclusive_update_ready, set_toast_activate_handler,
set_windows_activate_browser_tab_handler, set_windows_app_exit_handler,
set_windows_builtin_browser_downloads_handler, set_windows_capsule_rect_provider,
set_windows_close_browser_tab_handler, set_windows_exclusive_update_ready_handler,
set_windows_home_first_ready_handler, set_windows_host_appearance_dark,
set_windows_host_color_mode_handler, set_windows_layout_plan_handler,
set_windows_lxapp_hidden_handler, set_windows_lxapp_main_activation_handler,
set_windows_managed_aside_event_handler, set_windows_managed_native_surface_open_handler,
set_windows_managed_surface_close_handler, set_windows_managed_surface_visible_handler,
set_windows_open_url_handler, set_windows_page_visibility_handler,
set_windows_pull_to_refresh_handler, set_windows_shell_pins_handler,
set_windows_sidebar_actions_handler, set_windows_surface_closed_handler,
set_windows_surface_dispose_handler, set_windows_tray_click_intercept_handler,
set_windows_tray_menu_handler, set_windows_ui_update_async_handler,
set_windows_ui_update_handler, set_windows_url_surface_handler, sync_windows_ui,
};
#[cfg(not(any(
target_os = "android",
target_os = "ios",
target_os = "macos",
target_os = "windows",
target_env = "ohos"
)))]
pub use unsupported::Platform;
pub mod error;
pub use error::*;
pub mod i18n;