pub trait AppRuntime:
Send
+ Sync
+ MediaInteraction
+ MediaRuntime
+ PopupPresenter
+ Device
+ DeviceHardware
+ DeviceSecureStore
+ DocumentInteraction
+ Location
+ UIUpdate
+ UpdateService
+ UserFeedback
+ Wifi
+ 'static {
// 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,
path: String,
) -> Result<(), PlatformError>;
fn hide_lxapp(&self, appid: String) -> Result<(), PlatformError>;
fn navigate(
&self,
appid: String,
path: String,
animation_type: AnimationType,
) -> Result<(), PlatformError>;
fn launch_with_url(&self, url: String) -> Result<(), PlatformError>;
fn get_capsule_rect(&self, callback_id: u64) -> Result<(), PlatformError>;
// Provided method
fn copy_album_media_to_file(
&self,
uri: &str,
dest_path: &Path,
kind: MediaKind,
) -> 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, path: String) -> Result<(), PlatformError>
fn show_lxapp(&self, appid: String, path: String) -> Result<(), PlatformError>
Show the UI container for the given LxApp and route.
Sourcefn hide_lxapp(&self, appid: String) -> Result<(), PlatformError>
fn hide_lxapp(&self, appid: String) -> Result<(), PlatformError>
Hide the UI container for the given LxApp (does not destroy its runtime state).
Navigates within the given LxApp using an animation.
Sourcefn launch_with_url(&self, url: String) -> Result<(), PlatformError>
fn launch_with_url(&self, url: String) -> Result<(), PlatformError>
Launches the given URL in the host environment.
Sourcefn get_capsule_rect(&self, callback_id: u64) -> Result<(), PlatformError>
fn get_capsule_rect(&self, callback_id: u64) -> Result<(), PlatformError>
Gets the capsule button bounding rect in screen coordinates. Returns result via callback with JSON string format: {“width”: 84.5, “height”: 32, “top”: 50, “right”: 375, “bottom”: 82, “left”: 290.5} All values are in pixels, relative to screen top-left corner (0, 0). Note: This only works when the page has showNavigationBar: false (webview is fullscreen).
§Arguments
callback_id- The callback ID to invoke with the result
§iOS/macOS
Returns synchronously via callback immediately
§Android/HarmonyOS
Returns asynchronously via callback after querying native UI layer
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.