1
0
forked from GRIN/grim

Build 56: wait for the mixnet before dialing relays; no on-screen keyboard

Two fixes from live testing:

1) Stuck on "Connecting…": the nostr service dialed relays without waiting for
   the bundled Nym sidecar to be up. On a cold start a fast wallet-open beat the
   mixnet bootstrap, every relay failed, and nostr-sdk backed off — so the wallet
   sat on "Connecting…" long after the mixnet was ready. Now we wait for the
   sidecar SOCKS5 port before connecting (instant once it is warm). Verified:
   service start -> relay catch-up in ~5s; the flag (Build 55) reflects it within
   2s.

2) On-screen keyboard on desktop: upstream Grim pops its own virtual keyboard on
   desktop (no_soft_keyboard = is_android()), which looked wrong in the wallet
   flows and competed with physical typing (intermittent dropped/duplicated
   chars). Goblin now uses native input on every platform — Android IME via JNI,
   physical keyboard on desktop — by defaulting no_soft_keyboard to true. Verified
   on desktop: no on-screen keyboard, reliable typing.
This commit is contained in:
2ro
2026-06-13 21:39:17 -04:00
parent 6dff408766
commit de7007269f
2 changed files with 38 additions and 1 deletions
+7 -1
View File
@@ -78,7 +78,13 @@ impl TextEdit {
scan_pressed: false,
enter_pressed: false,
numeric: false,
no_soft_keyboard: is_android(),
// Goblin uses each platform's NATIVE input everywhere: the Android
// soft keyboard via JNI on Android, the physical keyboard on desktop.
// Upstream Grim only suppresses its own on-screen keyboard on Android
// (`is_android()`) and pops it on desktop — which looked out of place
// in Goblin's wallet flows and competed with physical typing. Suppress
// it on every platform; native text entry still works.
no_soft_keyboard: true,
hint: None,
text_color: None,
body_font: false,
+31
View File
@@ -517,6 +517,24 @@ async fn run_service(svc: Arc<NostrService>, wallet: Wallet) {
warn!("nostr: add relay {relay} failed: {e}");
}
}
// Wait for the bundled Nym sidecar to be listening before dialing relays.
// `warm_up()` starts it at launch, but a fast wallet-open can beat the cold
// mixnet bootstrap — and dialing relays before :1080 is up makes every relay
// fail and drop into nostr-sdk's (backing-off) reconnect, so the wallet sits
// on "Connecting…" long after the mixnet is actually ready. Once the sidecar
// is warm this returns immediately.
for i in 0..60u32 {
if nym_socks_ready().await {
if i > 0 {
info!(
"nostr: Nym sidecar ready after ~{}ms, dialing relays",
i * 500
);
}
break;
}
tokio::time::sleep(Duration::from_millis(500)).await;
}
client.connect().await;
{
let mut w_client = svc.client.write();
@@ -612,6 +630,19 @@ async fn run_service(svc: Arc<NostrService>, wallet: Wallet) {
client.disconnect().await;
}
/// Quick, non-blocking check that the Nym SOCKS5 sidecar is accepting
/// connections on its loopback port (i.e. the mixnet is ready to carry traffic).
async fn nym_socks_ready() -> bool {
matches!(
tokio::time::timeout(
Duration::from_millis(500),
tokio::net::TcpStream::connect(crate::nym::socks5_addr()),
)
.await,
Ok(Ok(_))
)
}
/// True when at least one relay has completed its handshake.
async fn relays_connected(client: &Client) -> bool {
client