mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-17 09:45:02 +01:00
Show snackbar on archive/unarchive from bottomDialog
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
3427f4ce50
commit
7ac8c2483e
@ -200,17 +200,7 @@ class ConversationsListBottomDialog(
|
||||
}
|
||||
|
||||
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()
|
||||
handleArchiving()
|
||||
}
|
||||
|
||||
binding.conversationOperationRename.setOnClickListener {
|
||||
@ -226,6 +216,33 @@ class ConversationsListBottomDialog(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleArchiving() {
|
||||
val currentUser = userManager.currentUser.blockingGet()
|
||||
val token = conversation.token
|
||||
lifecycleScope.launch {
|
||||
if (conversation.hasArchived) {
|
||||
conversationInfoViewModel.unarchiveConversation(currentUser, token)
|
||||
activity.showSnackbar(
|
||||
String.format(
|
||||
context.resources.getString(R.string.unarchived_conversation),
|
||||
conversation.displayName
|
||||
)
|
||||
)
|
||||
dismiss()
|
||||
} else {
|
||||
conversationInfoViewModel.archiveConversation(currentUser, token)
|
||||
activity.showSnackbar(
|
||||
String.format(
|
||||
context.resources.getString(R.string.archived_conversation),
|
||||
conversation.displayName
|
||||
)
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
activity.fetchRooms()
|
||||
}
|
||||
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
@SuppressLint("StringFormatInvalid", "TooGenericExceptionCaught")
|
||||
private fun addConversationToFavorites() {
|
||||
|
@ -848,4 +848,6 @@ How to translate with transifex:
|
||||
<string name="user_absence_replacement">Replacement: </string>
|
||||
<string name="resend_message">Resend</string>
|
||||
<string name="no_conversations_archived">No conversations archived</string>
|
||||
<string name="archived_conversation">Archived %1$s</string>
|
||||
<string name="unarchived_conversation">Unarchived %1$s</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user