(
State(state): State<AppState>,
Path((udid, button)): Path<(String, String)>,
Query(query): Query<ChromeButtonPngQuery>,
)
| 3242 | } |
| 3243 | |
| 3244 | async fn chrome_button_png( |
| 3245 | State(state): State<AppState>, |
| 3246 | Path((udid, button)): Path<(String, String)>, |
| 3247 | Query(query): Query<ChromeButtonPngQuery>, |
| 3248 | ) -> Result<(StatusCode, HeaderMap, Vec<u8>), AppError> { |
| 3249 | let button_name = button.strip_suffix(".png").unwrap_or(&button).to_owned(); |
| 3250 | let png = if let Some(pressed) = query.pressed.as_deref().map(parse_asset_bool) { |
| 3251 | run_bridge_action(state, move |bridge| { |
| 3252 | bridge.chrome_button_png(&udid, &button_name, pressed) |
| 3253 | }) |
| 3254 | .await? |
| 3255 | } else if let Some(base_name) = button_name.strip_suffix("-down").map(str::to_owned) { |
| 3256 | let exact_udid = udid.clone(); |
| 3257 | let exact_name = button_name.clone(); |
| 3258 | match run_bridge_action(state.clone(), move |bridge| { |
| 3259 | bridge.chrome_button_png(&exact_udid, &exact_name, false) |
| 3260 | }) |
| 3261 | .await |
| 3262 | { |
| 3263 | Ok(png) => png, |
| 3264 | Err(_) => { |
| 3265 | run_bridge_action(state, move |bridge| { |
| 3266 | bridge.chrome_button_png(&udid, &base_name, true) |
| 3267 | }) |
| 3268 | .await? |
| 3269 | } |
| 3270 | } |
| 3271 | } else { |
| 3272 | run_bridge_action(state, move |bridge| { |
| 3273 | bridge.chrome_button_png(&udid, &button_name, false) |
| 3274 | }) |
| 3275 | .await? |
| 3276 | }; |
| 3277 | let headers = chrome_asset_headers(); |
| 3278 | Ok((StatusCode::OK, headers, png)) |
| 3279 | } |
| 3280 | |
| 3281 | async fn screen_mask_png( |
| 3282 | State(state): State<AppState>, |
nothing calls this directly
no test coverage detected