mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 07:05:19 +00:00
- Add NetworkActivationService to permit Tor/Nostr only when location is authorized OR at least one mutual favorite exists. - Gate TorManager.startIfNeeded/ensureRunningOnForeground behind a global allowAutoStart flag. - Always stop Tor on background for deterministic restarts; rebuild sessions on foreground when allowed. - NostrRelayManager respects the gate in connect/ensureConnections/subscribe/send/connectToRelay and skips reconnection when disallowed. - Symmetric shutdown when conditions become disallowed: disconnect relays and stop Tor. - Fix double-start by avoiding restart if Tor is already ready; prevent background thrash. - Improve UX: post "starting tor…" via TorWillStart, and "tor started…" on initial ready; keep existing restart messages. Rationale: Avoid starting Tor/relays when the user has no location permission and no mutual favorites, and ensure a clean, predictable lifecycle (no stale sockets, no double starts). Co-authored-by: jack <jackjackbits@users.noreply.github.com>