(
input_session: &mut Option<Arc<NativeInputSession>>,
bridge: NativeBridge,
udid: &str,
)
| 3083 | } |
| 3084 | |
| 3085 | pub(crate) async fn bridge_input_session_for_control( |
| 3086 | input_session: &mut Option<Arc<NativeInputSession>>, |
| 3087 | bridge: NativeBridge, |
| 3088 | udid: &str, |
| 3089 | ) -> Result<Arc<NativeInputSession>, AppError> { |
| 3090 | if let Some(input) = input_session { |
| 3091 | return Ok(input.clone()); |
| 3092 | } |
| 3093 | |
| 3094 | let udid = udid.to_string(); |
| 3095 | let input = task::spawn_blocking(move || bridge.create_input_session(&udid)) |
| 3096 | .await |
| 3097 | .map_err(|error| { |
| 3098 | AppError::internal(format!( |
| 3099 | "Failed to join bridge input creation task: {error}" |
| 3100 | )) |
| 3101 | })??; |
| 3102 | let input = Arc::new(input); |
| 3103 | *input_session = Some(input.clone()); |
| 3104 | Ok(input) |
| 3105 | } |
| 3106 | |
| 3107 | pub(crate) async fn run_bridge_multitouch_control_message( |
| 3108 | input: Arc<NativeInputSession>, |
no test coverage detected