Skip to content
Snippets Groups Projects
Verified Commit 98261cdf authored by Mikolai Gütschow's avatar Mikolai Gütschow
Browse files

retain selected contact and message draft on switching away from private messages

parent 485cf51e
No related branches found
No related tags found
1 merge request!38Inject ViewModels similar to the Android world
......@@ -33,12 +33,6 @@ constructor(
loadContacts()
}
override fun onCleared() {
super.onCleared()
// todo: also reset filterBy?
_selectedContactId.value = null
}
private val _filterBy = mutableStateOf("")
private val _selectedContactId = mutableStateOf<ContactId?>(null)
......
......@@ -62,6 +62,9 @@ constructor(
val newMessage: State<String> = _newMessage
fun setContactId(id: ContactId) {
if (_contactId.value == id)
return
_contactId.value = id
_contactItem.value = ContactItem(
contactManager.getContact(id),
......@@ -69,6 +72,7 @@ constructor(
conversationManager.getGroupCount(id),
)
loadMessages()
setNewMessage("")
}
fun setNewMessage(msg: String) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment