UI: show Tor system messages only in geohash channels (not mesh)

- Gate "starting tor..." and readiness/timeout messages to geohash view
- Add helper addGeohashOnlySystemMessage() to avoid posting to mesh timeline
- Persist system messages in geohash backing store via addPublicSystemMessage()
This commit is contained in:
jack
2025-09-10 13:57:53 +02:00
parent 7f829dcbaa
commit 8dad90685d
2 changed files with 17 additions and 9 deletions
+4 -4
View File
@@ -1064,7 +1064,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.3.4;
PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -1095,7 +1095,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.3.4;
PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat;
PRODUCT_NAME = bitchat;
SDKROOT = iphoneos;
@@ -1150,7 +1150,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.3.4;
PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat;
PRODUCT_NAME = bitchat;
SDKROOT = iphoneos;
@@ -1364,7 +1364,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.3.3;
MARKETING_VERSION = 1.3.4;
PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+13 -5
View File
@@ -530,23 +530,23 @@ class ChatViewModel: ObservableObject, BitchatDelegate {
// Start mesh service immediately
meshService.startServices()
// Announce Tor status to the chat timeline as early as possible
// Announce Tor status (geohash-only; do not show in mesh chat)
if TorManager.shared.torEnforced && !torStatusAnnounced {
torStatusAnnounced = true
addPublicSystemMessage("starting tor...")
addGeohashOnlySystemMessage("starting tor...")
// Suppress incremental Tor progress messages; only show initial start and readiness.
torProgressCancellable = nil
Task.detached {
let ready = await TorManager.shared.awaitReady()
Task { @MainActor [weak self] in
guard let self else { return }
if ready { self.addPublicSystemMessage("tor started. routing all chats via tor for privacy.") }
else { self.addPublicSystemMessage("still waiting for tor to start...") }
if ready { self.addGeohashOnlySystemMessage("tor started. routing all chats via tor for privacy.") }
else { self.addGeohashOnlySystemMessage("still waiting for tor to start...") }
}
}
} else if !TorManager.shared.torEnforced && !torStatusAnnounced {
torStatusAnnounced = true
addPublicSystemMessage("development build: tor bypass enabled.")
addGeohashOnlySystemMessage("development build: tor bypass enabled.")
}
// Initialize Nostr services
@@ -4919,6 +4919,14 @@ class ChatViewModel: ObservableObject, BitchatDelegate {
}
objectWillChange.send()
}
/// Add a system message only if viewing a geohash location channel (never post to mesh).
@MainActor
func addGeohashOnlySystemMessage(_ content: String) {
if case .location = activeChannel {
addPublicSystemMessage(content)
}
}
// Send a public message without adding a local user echo.
// Used for emotes where we want a local system-style confirmation instead.
@MainActor