feat: add profile screen (#5)
Some checks failed
Build and Release / build (push) Has been cancelled

Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2026-05-27 06:22:14 +00:00
parent 1c08525dfc
commit a2a4433a9d
11 changed files with 336 additions and 7 deletions

View File

@@ -417,8 +417,19 @@ class NostrViewModel(
.tags(to.map { Tag.publicKey(it) })
.build(nostr.signer.currentUser!!)
// Check if the room already exists
val id = rumor.roomId()
val existingRoom = _chatRooms.value.firstOrNull { it.id == id }
// If the room already exists, return its ID
if (existingRoom != null) {
return existingRoom.id
}
// Create a room from the rumor event
val room = Room.new(rumor, nostr.signer.currentUser!!)
// Update the chat rooms state
_chatRooms.update { currentRooms ->
currentRooms + room
}
@@ -477,6 +488,9 @@ class NostrViewModel(
}
fun sendMessage(roomId: Long, message: String, replies: List<EventId> = emptyList()) {
if (message.isEmpty()) {
showError("Message cannot be empty")
}
viewModelScope.launch {
try {
val room = getChatRoom(roomId)