mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 03:45:21 +00:00
Dm header icons reactive (#190)
* header reactive to noise session * favorite button reactive * icon change * nice
This commit is contained in:
@@ -83,6 +83,14 @@ class ChatState {
|
||||
private val _favoritePeers = MutableLiveData<Set<String>>(emptySet())
|
||||
val favoritePeers: LiveData<Set<String>> = _favoritePeers
|
||||
|
||||
// Noise session states for peers (for reactive UI updates)
|
||||
private val _peerSessionStates = MutableLiveData<Map<String, String>>(emptyMap())
|
||||
val peerSessionStates: LiveData<Map<String, String>> = _peerSessionStates
|
||||
|
||||
// Peer fingerprint state for reactive favorites (for reactive UI updates)
|
||||
private val _peerFingerprints = MutableLiveData<Map<String, String>>(emptyMap())
|
||||
val peerFingerprints: LiveData<Map<String, String>> = _peerFingerprints
|
||||
|
||||
// peerIDToPublicKeyFingerprint REMOVED - fingerprints now handled centrally in PeerManager
|
||||
|
||||
// Navigation state
|
||||
@@ -122,6 +130,8 @@ class ChatState {
|
||||
fun getShowCommandSuggestionsValue() = _showCommandSuggestions.value ?: false
|
||||
fun getCommandSuggestionsValue() = _commandSuggestions.value ?: emptyList()
|
||||
fun getFavoritePeersValue() = _favoritePeers.value ?: emptySet()
|
||||
fun getPeerSessionStatesValue() = _peerSessionStates.value ?: emptyMap()
|
||||
fun getPeerFingerprintsValue() = _peerFingerprints.value ?: emptyMap()
|
||||
fun getShowAppInfoValue() = _showAppInfo.value ?: false
|
||||
|
||||
// Setters for state updates
|
||||
@@ -207,6 +217,14 @@ class ChatState {
|
||||
Log.d("ChatState", "LiveData has active observers: ${_favoritePeers.hasActiveObservers()}")
|
||||
}
|
||||
|
||||
fun setPeerSessionStates(states: Map<String, String>) {
|
||||
_peerSessionStates.value = states
|
||||
}
|
||||
|
||||
fun setPeerFingerprints(fingerprints: Map<String, String>) {
|
||||
_peerFingerprints.value = fingerprints
|
||||
}
|
||||
|
||||
fun setShowAppInfo(show: Boolean) {
|
||||
_showAppInfo.value = show
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user