bitchat-android/app/src/main/java/com/bitchat/android/ui/ConversationSecurityState.kt
2026-07-29 19:32:28 +02:00

18 lines
625 B
Kotlin

package com.bitchat.android.ui
/**
* Resolves the Noise session shown for a private conversation.
*
* Persistent conversations use a canonical contact ID, while live Noise sessions are keyed by
* the currently connected mesh peer ID. Prefer that live identity and retain the conversation ID
* as a fallback for peers whose IDs are already identical.
*/
internal fun resolveConversationSessionState(
conversationID: String,
activeMeshPeerID: String?,
peerSessionStates: Map<String, String>
): String? {
return activeMeshPeerID?.let(peerSessionStates::get)
?: peerSessionStates[conversationID]
}