mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed missing toasts in conversations list + improved conversation removal (no longer scrolling back to top)
This commit is contained in:
parent
57f8ff3341
commit
af3cab475b
3 changed files with 16 additions and 6 deletions
|
|
@ -72,10 +72,7 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
binding.conversationsList.scrollToPosition(0)
|
||||
}
|
||||
|
||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||
Log.i("$TAG [$itemCount] removed, scrolling to top")
|
||||
binding.conversationsList.scrollToPosition(0)
|
||||
}
|
||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) { }
|
||||
}
|
||||
|
||||
override fun onDefaultAccountChanged() {
|
||||
|
|
@ -118,6 +115,7 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = listViewModel
|
||||
observeToastEvents(listViewModel)
|
||||
|
||||
binding.conversationsList.setHasFixedSize(true)
|
||||
binding.conversationsList.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
|
@ -150,7 +148,6 @@ class ConversationsListFragment : AbstractMainFragment() {
|
|||
{ // onDeleteConversation
|
||||
Log.i("$TAG Deleting conversation [${model.id}]")
|
||||
model.delete()
|
||||
listViewModel.applyFilter()
|
||||
},
|
||||
{ // onLeaveGroup
|
||||
Log.i("$TAG Leaving group conversation [${model.id}]")
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@ class ConversationModel @WorkerThread constructor(val chatRoom: ChatRoom) {
|
|||
val basic = chatRoom.hasCapability(Capabilities.Basic.toInt())
|
||||
ShortcutUtils.removeShortcutToChatRoom(chatRoom)
|
||||
core.deleteChatRoom(chatRoom)
|
||||
|
||||
if (basic) {
|
||||
Log.i("$TAG Conversation [$id] has been deleted")
|
||||
isBeingDeleted.postValue(false)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,19 @@ class ConversationsListViewModel @UiThread constructor() : AbstractMainViewModel
|
|||
computeChatRoomsList(currentFilter)
|
||||
}
|
||||
ChatRoom.State.Deleted -> {
|
||||
computeChatRoomsList(currentFilter)
|
||||
val currentList = conversations.value.orEmpty()
|
||||
val found = currentList.find {
|
||||
it.chatRoom == chatRoom
|
||||
}
|
||||
if (found != null) {
|
||||
val newList = arrayListOf<ConversationModel>()
|
||||
newList.addAll(currentList)
|
||||
newList.remove(found)
|
||||
Log.i("$TAG Removing chat room from list")
|
||||
conversations.postValue(newList)
|
||||
} else {
|
||||
Log.w("$TAG Failed to find item in list matching deleted chat room")
|
||||
}
|
||||
|
||||
showGreenToastEvent.postValue(
|
||||
Event(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue