From bea1bbf1a82a81d03f87dc1da41583ff5d7ded0f Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:28:30 +0200 Subject: [PATCH] add missing file (#392) --- .../nostr/GeohashConversationRegistry.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/src/main/java/com/bitchat/android/nostr/GeohashConversationRegistry.kt diff --git a/app/src/main/java/com/bitchat/android/nostr/GeohashConversationRegistry.kt b/app/src/main/java/com/bitchat/android/nostr/GeohashConversationRegistry.kt new file mode 100644 index 00000000..0ae2a6db --- /dev/null +++ b/app/src/main/java/com/bitchat/android/nostr/GeohashConversationRegistry.kt @@ -0,0 +1,22 @@ +package com.bitchat.android.nostr + +import java.util.concurrent.ConcurrentHashMap + +/** + * GeohashConversationRegistry + * - Global, thread-safe registry of conversationKey (e.g., "nostr_") -> source geohash + * - Enables routing geohash DMs from anywhere by providing the correct geohash identity + */ +object GeohashConversationRegistry { + private val map = ConcurrentHashMap() + + fun set(convKey: String, geohash: String) { + if (geohash.isNotEmpty()) map[convKey] = geohash + } + + fun get(convKey: String): String? = map[convKey] + + fun snapshot(): Map = map.toMap() + + fun clear() = map.clear() +}