Dm header icons reactive (#190)

* header reactive to noise session

* favorite button reactive

* icon change

* nice
This commit is contained in:
callebtc
2025-07-25 19:50:40 +02:00
committed by GitHub
parent 271df2e720
commit c9aba00478
8 changed files with 166 additions and 33 deletions
@@ -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
}