1use std::io::Read;
6
7pub struct AssetFileEntry<'a> {
9 pub path: String,
10 pub reader: Box<dyn Read + 'a>,
11}
12
13#[derive(Debug, Clone)]
15pub struct DeviceInfo {
16 pub brand: String,
17 pub model: String,
18 pub market_name: String,
19 pub os_name: String,
20 pub os_version: String,
21}
22
23#[derive(Debug, Clone, serde::Serialize)]
25pub struct ScreenInfo {
26 pub width: f64,
27 pub height: f64,
28 pub scale: f64,
29}
30
31pub(crate) mod rt;
32pub mod traits;
33
34#[cfg(target_os = "android")]
35mod android;
36
37#[cfg(any(target_os = "ios", target_os = "macos"))]
38mod apple;
39
40#[cfg(target_env = "ohos")]
41pub mod harmony;
42
43#[cfg(target_os = "windows")]
44pub mod windows;
45
46#[cfg(not(any(
47 target_os = "android",
48 target_os = "ios",
49 target_os = "macos",
50 target_os = "windows",
51 target_env = "ohos"
52)))]
53mod unsupported;
54
55#[cfg(any(target_os = "macos", target_os = "windows"))]
56pub mod desktop;
57
58pub fn os_label() -> &'static str {
64 #[cfg(any(target_os = "ios", target_os = "macos"))]
65 {
66 if cfg!(target_os = "macos") {
67 "macOS"
68 } else {
69 "iOS"
70 }
71 }
72 #[cfg(target_os = "android")]
73 {
74 "Android"
75 }
76 #[cfg(target_os = "windows")]
77 {
78 "Windows"
79 }
80 #[cfg(all(target_os = "linux", target_env = "ohos"))]
81 {
82 "Harmony"
83 }
84 #[cfg(not(any(
85 target_os = "ios",
86 target_os = "macos",
87 target_os = "android",
88 target_os = "windows",
89 all(target_os = "linux", target_env = "ohos"),
90 )))]
91 {
92 "unknown"
93 }
94}
95
96#[cfg(any(target_os = "macos", target_os = "windows"))]
101pub fn autostart_supported() -> bool {
102 #[cfg(target_os = "macos")]
103 {
104 apple::autostart_probe_supported()
105 }
106 #[cfg(target_os = "windows")]
107 {
108 true
109 }
110}
111
112#[cfg(target_os = "android")]
113pub use android::{
114 CachedClass, Platform, get_android_id, get_api_level, get_system_property,
115 has_telephony_feature, init_cached_class, initialize_jni, read_external_storage_text,
116 write_external_storage_text,
117};
118
119#[cfg(any(target_os = "ios", target_os = "macos"))]
120pub use apple::Platform;
121#[cfg(any(target_os = "ios", target_os = "macos"))]
122pub use apple::apply_staged_macos_update;
123
124#[cfg(target_env = "ohos")]
125pub use harmony::Platform;
126
127#[cfg(target_os = "windows")]
128pub use windows::{
129 Platform, WindowsMediaPreviewCancel, WindowsMediaPreviewOpen, WindowsUrlSurfaceWebTag,
130 WindowsVideoCommandDispatcher, apply_staged_windows_update, install_windows_aside_panel_bridge,
131 register_windows_media_preview_host, register_windows_video_command_dispatcher,
132 set_windows_activator_items_handler, set_windows_app_exit_handler,
133 set_windows_layout_plan_handler, set_windows_managed_aside_event_handler,
134 set_windows_managed_surface_toggle_handler, set_windows_managed_surface_visible_handler,
135 set_windows_open_url_handler, set_windows_page_visibility_handler,
136 set_windows_pull_to_refresh_handler, set_windows_shell_pins_handler,
137 set_windows_surface_closed_handler, set_windows_surface_dispose_handler,
138 set_windows_tray_click_intercept_handler, set_windows_tray_menu_handler,
139 set_windows_ui_update_async_handler, set_windows_ui_update_handler,
140 set_windows_url_surface_handler, sync_windows_ui,
141};
142
143#[cfg(not(any(
144 target_os = "android",
145 target_os = "ios",
146 target_os = "macos",
147 target_os = "windows",
148 target_env = "ohos"
149)))]
150pub use unsupported::Platform;
151
152pub mod error;
153pub use error::*;
154
155pub mod i18n;