diff --git a/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt index b7b949c56..199b6400c 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationinfo/ConversationInfoActivity.kt @@ -820,6 +820,7 @@ class ConversationInfoActivity : binding.archiveConversationTextHint.text = resources.getString(R.string.unarchive_hint) } } + viewModel.getRoom(conversationUser, conversationToken) } if (conversation!!.hasArchived) { diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt index 1485a0018..2570abd8d 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt @@ -455,6 +455,14 @@ class ConversationsListActivity : newItems.add(i) } } + + val archiveFilterOn = filterState[FilterConversationFragment.ARCHIVE] ?: false + if (archiveFilterOn && newItems.isEmpty()) { + binding.noArchivedConversationLayout.visibility = View.VISIBLE + } else { + binding.noArchivedConversationLayout.visibility = View.GONE + } + adapter!!.updateDataSet(newItems, true) setFilterableItems(newItems) diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt index 3149e153b..c5f4af4b8 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ConversationsListBottomDialog.kt @@ -26,6 +26,7 @@ import com.nextcloud.talk.api.NcApi import com.nextcloud.talk.api.NcApiCoroutines import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.conversation.RenameConversationDialogFragment +import com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel import com.nextcloud.talk.conversationlist.ConversationsListActivity import com.nextcloud.talk.data.user.model.User import com.nextcloud.talk.databinding.DialogConversationOperationsBinding @@ -68,6 +69,9 @@ class ConversationsListBottomDialog( @Inject lateinit var viewThemeUtils: ViewThemeUtils + @Inject + lateinit var conversationInfoViewModel: ConversationInfoViewModel + @Inject lateinit var userManager: UserManager @@ -189,6 +193,26 @@ class ConversationsListBottomDialog( dismiss() } + binding.conversationArchiveText.text = if (conversation.hasArchived) { + this.activity.resources.getString(R.string.unarchive_conversation) + } else { + this.activity.resources.getString(R.string.archive_conversation) + } + + binding.conversationArchive.setOnClickListener { + val currentUser = userManager.currentUser.blockingGet() + val token = conversation.token + lifecycleScope.launch { + if (conversation.hasArchived) { + conversationInfoViewModel.unarchiveConversation(currentUser, token) + } else { + conversationInfoViewModel.archiveConversation(currentUser, token) + } + } + activity.fetchRooms() + dismiss() + } + binding.conversationOperationRename.setOnClickListener { renameConversation() } diff --git a/app/src/main/res/layout/activity_conversations.xml b/app/src/main/res/layout/activity_conversations.xml index 9d565318c..75b582110 100644 --- a/app/src/main/res/layout/activity_conversations.xml +++ b/app/src/main/res/layout/activity_conversations.xml @@ -168,7 +168,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:visibility="gone" - tools:visibility="visible"> + tools:visibility="gone"> + + + + + + + + + + + + + + %1$s is out of office today Replacement: Resend + No conversations archived