.
This commit is contained in:
@@ -110,7 +110,9 @@ fun HomeScreen(
|
|||||||
?: remember { mutableStateOf(null) }
|
?: remember { mutableStateOf(null) }
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
viewModel.getChatRooms()
|
if (qrResult == null) {
|
||||||
|
viewModel.getChatRooms()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(qrResult) {
|
LaunchedEffect(qrResult) {
|
||||||
|
|||||||
@@ -436,7 +436,13 @@ class NostrViewModel(
|
|||||||
|
|
||||||
fun getChatRooms() {
|
fun getChatRooms() {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
_chatRooms.value = nostr.getChatRooms() ?: emptySet()
|
val rooms = nostr.getChatRooms() ?: emptySet()
|
||||||
|
_chatRooms.update { currentRooms ->
|
||||||
|
val virtualRooms = currentRooms.filter { local ->
|
||||||
|
rooms.none { db -> db.id == local.id }
|
||||||
|
}
|
||||||
|
rooms + virtualRooms
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user