confirm pin & unpin the message
This commit is contained in:
@@ -483,11 +483,12 @@ class MessagesHistoryFragment :
|
||||
if (attachmentController.message.value != message)
|
||||
attachmentController.message.value = message
|
||||
}
|
||||
pin -> viewModel.pinMessage(
|
||||
peerId = conversation.id,
|
||||
messageId = message.id,
|
||||
pin = !isMessageAlreadyPinned
|
||||
)
|
||||
pin ->
|
||||
showPinMessageDialog(
|
||||
peerId = conversation.id,
|
||||
messageId = message.id,
|
||||
pin = !isMessageAlreadyPinned
|
||||
)
|
||||
edit -> {
|
||||
attachmentController.isEditing = true
|
||||
|
||||
@@ -499,6 +500,30 @@ class MessagesHistoryFragment :
|
||||
}.show()
|
||||
}
|
||||
|
||||
private fun showPinMessageDialog(
|
||||
peerId: Int,
|
||||
messageId: Int?,
|
||||
pin: Boolean
|
||||
) {
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(
|
||||
if (pin) R.string.confirm_pin_message
|
||||
else R.string.confirm_unpin_message
|
||||
)
|
||||
.setPositiveButton(
|
||||
if (pin) R.string.action_pin
|
||||
else R.string.action_unpin
|
||||
) { _, _ ->
|
||||
viewModel.pinMessage(
|
||||
peerId = peerId,
|
||||
messageId = messageId,
|
||||
pin = pin
|
||||
)
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun showDeleteMessageDialog(message: VkMessage) {
|
||||
val binding = DialogMessageDeleteBinding.inflate(layoutInflater, null, false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user