pub trait AppRuntime:
Send
+ Sync
+ MediaInteraction
+ MediaRuntime
+ Network
+ SurfacePresenter
+ ClipboardService
+ Device
+ DeviceHardware
+ SecureStore
+ ShareService
+ FileService
+ Location
+ UIUpdate
+ UpdateService
+ UserFeedback
+ Wifi
+ 'static {
Show 35 methods
// Required methods
fn read_asset<'a>(
&'a self,
path: &str,
) -> Result<Box<dyn Read + 'a>, PlatformError>;
fn asset_dir_iter<'a>(
&'a self,
asset_dir: &str,
) -> Box<dyn Iterator<Item = Result<AssetFileEntry<'a>, PlatformError>> + 'a>;
fn app_data_dir(&self) -> PathBuf;
fn app_cache_dir(&self) -> PathBuf;
fn get_app_identifier(&self) -> Result<String, PlatformError>;
fn get_system_locale(&self) -> &str;
fn show_lxapp(
&self,
appid: String,
title: String,
path: String,
webtag: String,
session_id: u64,
open_mode: LxAppOpenMode,
panel_id: String,
) -> Result<(), PlatformError>;
fn hide_lxapp(
&self,
appid: String,
session_id: u64,
) -> Result<(), PlatformError>;
fn exit(&self) -> Result<(), PlatformError>;
fn navigate(
&self,
appid: String,
path: String,
webtag: String,
animation_type: AnimationType,
) -> Result<(), PlatformError>;
fn open_url(
&self,
req: OpenUrlRequest,
) -> Result<OpenUrlResult, PlatformError>;
// Provided methods
fn copy_album_media_to_file(
&self,
uri: &str,
dest_path: &Path,
kind: MediaKind,
) -> Result<(), PlatformError> { ... }
fn request_lxapp_main_activation(&self, _appid: &str) { ... }
fn set_tray_badge(&self, _text: &str) -> Result<bool, PlatformError> { ... }
fn set_tray_icon(&self, _icon: &str) -> Result<(), PlatformError> { ... }
fn set_shell_sidebar_actions(
&self,
_items: &[ResolvedShellSidebarAction],
) -> Result<(), PlatformError> { ... }
fn set_shell_pins(&self, _items: &[ShellPin]) -> Result<(), PlatformError> { ... }
fn set_control_session_indicator(
&self,
_active: bool,
) -> Result<(), PlatformError> { ... }
fn set_tray_title(&self, _text: &str) -> Result<(), PlatformError> { ... }
fn set_app_badge(&self, _text: &str) -> Result<bool, PlatformError> { ... }
fn autostart_is_enabled(&self) -> Result<bool, PlatformError> { ... }
fn autostart_set_enabled(&self, _enabled: bool) -> Result<(), PlatformError> { ... }
fn notification_permission(&self) -> Result<String, PlatformError> { ... }
fn notification_request_permission(&self) -> Result<String, PlatformError> { ... }
fn notification_show(
&self,
_request: &LocalNotificationShow,
) -> Result<LocalNotificationStatus, PlatformError> { ... }
fn notification_cancel(&self, _id: &str) -> Result<(), PlatformError> { ... }
fn notification_cancel_all(&self) -> Result<(), PlatformError> { ... }
fn banner_show(
&self,
_request: &DesktopBannerShow,
) -> Result<DesktopBannerOutcome, PlatformError> { ... }
fn banner_dismiss(&self, _id: &str) -> Result<(), PlatformError> { ... }
fn set_tray_menu(&self, _items_json: &str) -> Result<(), PlatformError> { ... }
fn set_tray_visible(&self, _visible: bool) -> Result<(), PlatformError> { ... }
fn set_tray_click_intercept(
&self,
_intercept: bool,
) -> Result<(), PlatformError> { ... }
fn close_browser_tab(&self, _tab_id: &str) -> Result<(), PlatformError> { ... }
fn activate_browser_tab(&self, _tab_id: String) -> PlatformFuture { ... }
fn open_builtin_browser_page(
&self,
_page: BuiltinBrowserPage,
) -> Result<(), PlatformError> { ... }
}Required Methods§
Sourcefn read_asset<'a>(
&'a self,
path: &str,
) -> Result<Box<dyn Read + 'a>, PlatformError>
fn read_asset<'a>( &'a self, path: &str, ) -> Result<Box<dyn Read + 'a>, PlatformError>
Reads an asset file as a streaming reader.
Sourcefn asset_dir_iter<'a>(
&'a self,
asset_dir: &str,
) -> Box<dyn Iterator<Item = Result<AssetFileEntry<'a>, PlatformError>> + 'a>
fn asset_dir_iter<'a>( &'a self, asset_dir: &str, ) -> Box<dyn Iterator<Item = Result<AssetFileEntry<'a>, PlatformError>> + 'a>
Iterates over files in an asset directory.
Sourcefn app_data_dir(&self) -> PathBuf
fn app_data_dir(&self) -> PathBuf
Returns the app’s data directory path.
Sourcefn app_cache_dir(&self) -> PathBuf
fn app_cache_dir(&self) -> PathBuf
Returns the app’s cache directory path.
Sourcefn get_app_identifier(&self) -> Result<String, PlatformError>
fn get_app_identifier(&self) -> Result<String, PlatformError>
Obtains the application identifier.
Sourcefn get_system_locale(&self) -> &str
fn get_system_locale(&self) -> &str
Returns the current system locale.
Sourcefn show_lxapp(
&self,
appid: String,
title: String,
path: String,
webtag: String,
session_id: u64,
open_mode: LxAppOpenMode,
panel_id: String,
) -> Result<(), PlatformError>
fn show_lxapp( &self, appid: String, title: String, path: String, webtag: String, session_id: u64, open_mode: LxAppOpenMode, panel_id: String, ) -> Result<(), PlatformError>
Show the UI container for the given LxApp and route.
webtag is the page instance’s full webview tag; page tags are
per-instance, so shells must not reconstruct them from the route.
Platforms whose containers resolve through the runtime by path may
ignore it.
Sourcefn hide_lxapp(
&self,
appid: String,
session_id: u64,
) -> Result<(), PlatformError>
fn hide_lxapp( &self, appid: String, session_id: u64, ) -> Result<(), PlatformError>
Hide the UI container for the given LxApp (does not destroy its runtime state).
Sourcefn exit(&self) -> Result<(), PlatformError>
fn exit(&self) -> Result<(), PlatformError>
Exits the host app.
Navigates within the given LxApp using an animation.
webtag is the destination page instance’s full webview tag; page
tags are per-instance, so shells must not reconstruct them from the
route. Platforms whose containers resolve through the runtime by path
may ignore it.
Sourcefn open_url(&self, req: OpenUrlRequest) -> Result<OpenUrlResult, PlatformError>
fn open_url(&self, req: OpenUrlRequest) -> Result<OpenUrlResult, PlatformError>
Opens the given URL according to the host policy for the requested target.
Provided Methods§
Sourcefn copy_album_media_to_file(
&self,
uri: &str,
dest_path: &Path,
kind: MediaKind,
) -> Result<(), PlatformError>
fn copy_album_media_to_file( &self, uri: &str, dest_path: &Path, kind: MediaKind, ) -> Result<(), PlatformError>
Copies media from the system album to a local file.
Sourcefn request_lxapp_main_activation(&self, _appid: &str)
fn request_lxapp_main_activation(&self, _appid: &str)
Notify the desktop skin that the next layout publication is an explicit request to put this lxapp in front. Most skins reconcile directly from the layout plan; Windows uses the intent to replace a browser cover without treating unrelated resize/aside publications as activations.
Sourcefn set_tray_badge(&self, _text: &str) -> Result<bool, PlatformError>
fn set_tray_badge(&self, _text: &str) -> Result<bool, PlatformError>
Set the tray (menu-bar / system-tray) badge. Desktop only; no-op elsewhere.
Ok(false) means there was nothing to paint on — no tray at all, or a
status item the product has not shown. Only a malfunction is an Err,
so a caller never needs to catch “this platform has no such chrome”.
Sourcefn set_tray_icon(&self, _icon: &str) -> Result<(), PlatformError>
fn set_tray_icon(&self, _icon: &str) -> Result<(), PlatformError>
Set the tray icon (a resource path). Desktop only; no-op elsewhere.
Replace the resolved shell sidebar action render list. Desktop skins only render presentation metadata and report stable ids.
Sourcefn set_shell_pins(&self, _items: &[ShellPin]) -> Result<(), PlatformError>
fn set_shell_pins(&self, _items: &[ShellPin]) -> Result<(), PlatformError>
Replace the ordered mixed user Pin list. Platform skins resolve visual metadata only; target identity and the eight-item limit are shell-owned.
Sourcefn set_control_session_indicator(
&self,
_active: bool,
) -> Result<(), PlatformError>
fn set_control_session_indicator( &self, _active: bool, ) -> Result<(), PlatformError>
Show or hide the shell’s “an AI assistant is in control” indicator.
Its Stop button calls crate::request_control_session_stop. Desktop
shells only; no-op elsewhere.
Sourcefn set_tray_title(&self, _text: &str) -> Result<(), PlatformError>
fn set_tray_title(&self, _text: &str) -> Result<(), PlatformError>
Set the tray title (text beside the icon, macOS). Desktop only; no-op elsewhere.
Sourcefn set_app_badge(&self, _text: &str) -> Result<bool, PlatformError>
fn set_app_badge(&self, _text: &str) -> Result<bool, PlatformError>
Set the app-icon badge: dock (macOS) / taskbar (Windows) / launcher icon
(iOS, Android). No-op on platforms where it is not yet wired.
Ok(false) means there was nothing to paint on. See Self::set_tray_badge.
Sourcefn autostart_is_enabled(&self) -> Result<bool, PlatformError>
fn autostart_is_enabled(&self) -> Result<bool, PlatformError>
Whether the app is registered to launch at system startup. Only reached
on macOS/Windows — lx.host.autostart is not registered elsewhere — so
the default is an error, not a no-op: a false answer here would be a lie.
Sourcefn autostart_set_enabled(&self, _enabled: bool) -> Result<(), PlatformError>
fn autostart_set_enabled(&self, _enabled: bool) -> Result<(), PlatformError>
Register or unregister the app as a per-user startup item.
Sourcefn notification_permission(&self) -> Result<String, PlatformError>
fn notification_permission(&self) -> Result<String, PlatformError>
Current OS permission without prompting: "granted", "denied", or
"default" (not yet asked).
Sourcefn notification_request_permission(&self) -> Result<String, PlatformError>
fn notification_request_permission(&self) -> Result<String, PlatformError>
Prompt where the OS has a prompt. "granted" or "denied"; an
unanswered prompt is an error, never a status.
Sourcefn notification_show(
&self,
_request: &LocalNotificationShow,
) -> Result<LocalNotificationStatus, PlatformError>
fn notification_show( &self, _request: &LocalNotificationShow, ) -> Result<LocalNotificationStatus, PlatformError>
Upsert a local notification: anything pending or delivered under id
is replaced first, on every path. deliver_at_ms is epoch
milliseconds; None or a time that is not in the future means now.
A deployment shape that cannot hand activation_token back on tap
fails here instead of posting a notification whose tap loses its
target.
fn notification_cancel(&self, _id: &str) -> Result<(), PlatformError>
fn notification_cancel_all(&self) -> Result<(), PlatformError>
Present a desktop banner and block until it resolves. Desktop only.
Dismiss a visible or queued banner. Unknown ids are fine.
Replace the tray dropdown menu. items_json is a JSON array of
{ label?, separator?, enabled?, checked? }. Item clicks are delivered
back to JS by index. Desktop only; no-op elsewhere.
Sourcefn set_tray_visible(&self, _visible: bool) -> Result<(), PlatformError>
fn set_tray_visible(&self, _visible: bool) -> Result<(), PlatformError>
Show or hide the tray status item itself. Desktop only; no-op elsewhere.
Sourcefn set_tray_click_intercept(
&self,
_intercept: bool,
) -> Result<(), PlatformError>
fn set_tray_click_intercept( &self, _intercept: bool, ) -> Result<(), PlatformError>
When intercepting, a left-click on the tray is delivered only to JS
(lx.tray.onClick) and does not run the tray’s configured surface action.
Desktop only; no-op elsewhere.
Sourcefn close_browser_tab(&self, _tab_id: &str) -> Result<(), PlatformError>
fn close_browser_tab(&self, _tab_id: &str) -> Result<(), PlatformError>
Close a tab previously named by Self::open_url. Platforms that
cannot name tabs leave this unimplemented — the JS handle then reports
scope: 'group' and never calls it.
Sourcefn activate_browser_tab(&self, _tab_id: String) -> PlatformFuture
fn activate_browser_tab(&self, _tab_id: String) -> PlatformFuture
Bring a tab previously named by Self::open_url to the front.
fn open_builtin_browser_page( &self, _page: BuiltinBrowserPage, ) -> Result<(), PlatformError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".