MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / type_text

Function type_text

packages/server/src/main.rs:5493–5510  ·  view source on GitHub ↗
(
    bridge: &NativeBridge,
    udid: &str,
    text: &str,
    delay_ms: u64,
)

Source from the content-addressed store, hash-verified

5491}
5492
5493fn type_text(
5494 bridge: &NativeBridge,
5495 udid: &str,
5496 text: &str,
5497 delay_ms: u64,
5498) -> Result<(), crate::error::AppError> {
5499 let input = bridge.create_input_session(udid)?;
5500 for character in text.chars() {
5501 let Some((key_code, modifiers)) = hid_for_character(character) else {
5502 return Err(crate::error::AppError::bad_request(format!(
5503 "Unsupported character for HID typing: {character:?}"
5504 )));
5505 };
5506 input.send_key(key_code, modifiers)?;
5507 sleep_ms(delay_ms);
5508 }
5509 Ok(())
5510}
5511
5512fn read_text_input(
5513 text: Option<String>,

Callers 2

mainFunction · 0.85
run_batch_stepFunction · 0.85

Calls 4

sleep_msFunction · 0.85
create_input_sessionMethod · 0.80
hid_for_characterFunction · 0.70
send_keyMethod · 0.45

Tested by

no test coverage detected