Files
tether/core/examples/iroh_send.rs
Patrick Ecord 1487ac4cb9 ios: link Network/CoreFoundation/Foundation/objc/iconv for the iroh staticlib
The iroh xcframework needs more system frameworks than the legacy build: iroh's
netwatch uses Network.framework (nw_* symbols), and the objc2 bindings pull in
CoreFoundation/Foundation/objc/iconv. Add them to OTHER_LDFLAGS so TetherApp
links against the iroh core (verified: arm64 simulator BUILD SUCCEEDED; harmless
extra frameworks for the legacy build too).

Also add examples/iroh_send.rs — a one-shot test sender to pre-flight the agent's
receive path (clipboard write + provenance toast) without a second device.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 01:45:11 -05:00

37 lines
1.5 KiB
Rust

//! One-shot test sender — stands in for "another device" to pre-flight the
//! agent's receive path (write clipboard + provenance toast) before testing from
//! the phone.
//! TETHER_RENDEZVOUS=http://IP:8765 cargo run --features iroh-transport \
//! --example iroh_send -- "text to send" [account]
//! Joins the same account-derived room via the rendezvous and sends one clipboard.
use std::time::Duration;
use tethercore::{room_for_account, Engine, Message, MessageHandler};
struct Noop;
impl MessageHandler for Noop {
fn on_message(&self, _m: Message) {}
fn on_status(&self, _c: bool) {}
fn on_file(&self, _n: String, _m: String, _d: Vec<u8>) {}
}
fn main() {
let text = std::env::args().nth(1).unwrap_or_else(|| "hello from a fake phone 📋".into());
let account = std::env::args().nth(2).unwrap_or_else(|| "pecord@gmail.com".into());
let server = std::env::var("TETHER_RENDEZVOUS").unwrap_or_else(|_| "http://localhost:8765".into());
let room = room_for_account(account.clone());
eprintln!("sender → rendezvous {server}, room {room}, account {account}");
let e = Engine::new(server, room, "preflight-sender".into(), "ios".into(), "Test iPhone".into(), account);
e.start(Box::new(Noop));
eprintln!("joining topic + discovering the agent…");
std::thread::sleep(Duration::from_secs(8));
eprintln!("sending: {text:?}");
e.send(text);
std::thread::sleep(Duration::from_secs(4)); // let gossip deliver
e.stop();
eprintln!("done — check the Mac clipboard + notification");
}