MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / accessibility_point

Function accessibility_point

packages/server/src/api/routes.rs:3718–3757  ·  view source on GitHub ↗
(
    State(state): State<AppState>,
    Path(udid): Path<String>,
    Query(query): Query<AccessibilityPointQuery>,
)

Source from the content-addressed store, hash-verified

3716}
3717
3718async fn accessibility_point(
3719 State(state): State<AppState>,
3720 Path(udid): Path<String>,
3721 Query(query): Query<AccessibilityPointQuery>,
3722) -> Result<Json<Value>, AppError> {
3723 if !query.x.is_finite() || !query.y.is_finite() || query.x < 0.0 || query.y < 0.0 {
3724 return Err(AppError::bad_request(
3725 "`x` and `y` must be finite non-negative numbers.",
3726 ));
3727 }
3728
3729 if android::is_android_id(&udid) {
3730 let snapshot = run_android_action(state, move |android| {
3731 android.accessibility_tree(&udid, None)
3732 })
3733 .await?;
3734 return Ok(json(accessibility_point_snapshot(
3735 &snapshot, query.x, query.y,
3736 )?));
3737 }
3738 let snapshot = accessibility_snapshot(
3739 state.clone(),
3740 udid.clone(),
3741 Some((query.x, query.y)),
3742 query.max_depth,
3743 )
3744 .await?;
3745 if point_snapshot_looks_like_local_widget_coordinates(&snapshot, query.x, query.y) {
3746 if let Ok(full_snapshot) =
3747 accessibility_snapshot(state, udid, None, query.max_depth.or(Some(4))).await
3748 {
3749 if let Ok(point_snapshot) =
3750 accessibility_point_snapshot(&full_snapshot, query.x, query.y)
3751 {
3752 return Ok(json(point_snapshot));
3753 }
3754 }
3755 }
3756 Ok(json(snapshot))
3757}
3758
3759include!("action_execution.rs");
3760

Callers

nothing calls this directly

Calls 8

is_android_idFunction · 0.85
run_android_actionFunction · 0.85
jsonFunction · 0.85
accessibility_snapshotFunction · 0.85
accessibility_treeMethod · 0.80
cloneMethod · 0.65

Tested by

no test coverage detected