Skip to content
Snippets Groups Projects
Commit 2fdac232 authored by Pierre Nicolas's avatar Pierre Nicolas :joy:
Browse files

details: connect leave conversation (group)

Show `leave conversation` option for group conversation.
Connect the button to logic.

GitLab: #1723
Change-Id: Ia8ee641fb10ebb41bb2553882280253f5e718d4a
parent 88ac6591
No related branches found
No related tags found
No related merge requests found
......@@ -240,6 +240,19 @@ class ConversationActionsFragment : Fragment() {
}
} else { // If conversation mode is not one to one
conversationDelete.text = resources.getString(R.string.leave_conversation)
conversationDelete.setOnClickListener {
ActionHelper.launchDeleteSwarmGroupAction(
context = requireContext(),
accountId = mAccountService.currentAccount!!.accountId,
uri = conversation.uri,
callback = { accountId: String, conversationUri: Uri ->
mConversationFacade.removeConversation(accountId, conversationUri)
.subscribe().apply { mDisposableBag.add(this) }
// Result is OK, should be interpreted to go back to home.
requireActivity().setResult(Activity.RESULT_OK)
requireActivity().finish()
})
}
blockSwitch.isVisible = false
}
......
......@@ -129,6 +129,19 @@ object ActionHelper {
.show()
}
fun launchDeleteSwarmGroupAction(
context: Context,
accountId: String,
uri: Uri,
callback: (accountId: String, uri: Uri) -> Unit,
) {
MaterialAlertDialogBuilder(context)
.setTitle(R.string.swarm_group_action_leave_title)
.setMessage(R.string.swarm_group_action_leave_message)
.setPositiveButton(android.R.string.ok) { _, _ -> callback(accountId, uri) }
.setNegativeButton(android.R.string.cancel) { _, _ -> }.show()
}
fun getAddNumberIntentForContact(contact: Contact): Intent {
val intent = Intent(Intent.ACTION_INSERT_OR_EDIT)
intent.type = ContactsContract.Contacts.CONTENT_ITEM_TYPE
......
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