lingxia_platform/traits/pull_to_refresh.rs
1use crate::error::PlatformError;
2
3/// Pull-to-refresh functionality for WebView pages.
4///
5/// This trait provides methods to programmatically control the pull-to-refresh
6/// state for a specific page (identified by app_id and path).
7pub trait PullToRefresh: Send + Sync {
8 /// Start pull-to-refresh animation programmatically.
9 ///
10 /// This will show the refresh indicator and trigger the refresh callback
11 /// (which calls the page's onPullDownRefresh lifecycle method).
12 ///
13 /// # Arguments
14 /// * `app_id` - The application ID
15 /// * `path` - The page path
16 fn start_pull_down_refresh(&self, app_id: &str, path: &str) -> Result<(), PlatformError>;
17
18 /// Stop pull-to-refresh animation.
19 ///
20 /// This should be called after the refresh operation is complete to hide
21 /// the refresh indicator and reset the state.
22 ///
23 /// # Arguments
24 /// * `app_id` - The application ID
25 /// * `path` - The page path
26 fn stop_pull_down_refresh(&self, app_id: &str, path: &str) -> Result<(), PlatformError>;
27}