mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 02:08:40 +00:00
Add confirmation check before ending a poll.
This commit is contained in:
@@ -2663,19 +2663,26 @@ class ConversationFragment :
|
||||
return
|
||||
}
|
||||
|
||||
val endPoll = viewModel.endPoll(pollId)
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(getString(R.string.Poll__end_poll_title))
|
||||
.setMessage(getString(R.string.Poll__end_poll_body))
|
||||
.setPositiveButton(R.string.Poll__end_poll) { _, _ ->
|
||||
val endPoll = viewModel.endPoll(pollId)
|
||||
|
||||
disposables += endPoll
|
||||
.subscribeBy(
|
||||
onError = {
|
||||
Log.w(TAG, "Error received during poll end!", it)
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.Poll__couldnt_end_poll)
|
||||
.setMessage(getString(R.string.Poll__check_connection))
|
||||
.setPositiveButton(android.R.string.ok) { dialog: DialogInterface?, which: Int -> dialog!!.dismiss() }
|
||||
.show()
|
||||
}
|
||||
)
|
||||
disposables += endPoll
|
||||
.subscribeBy(
|
||||
onError = {
|
||||
Log.w(TAG, "Error received during poll end!", it)
|
||||
MaterialAlertDialogBuilder(requireContext())
|
||||
.setTitle(R.string.Poll__couldnt_end_poll)
|
||||
.setMessage(getString(R.string.Poll__check_connection))
|
||||
.setPositiveButton(android.R.string.ok) { dialog: DialogInterface?, which: Int -> dialog!!.dismiss() }
|
||||
.show()
|
||||
}
|
||||
)
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { _, _ -> }
|
||||
.show()
|
||||
}
|
||||
|
||||
private inner class SwipeAvailabilityProvider : ConversationItemSwipeCallback.SwipeAvailabilityProvider {
|
||||
|
||||
@@ -8869,6 +8869,10 @@
|
||||
<string name="Poll__couldnt_end_poll">Couldn\'t end poll</string>
|
||||
<!-- Dialog body when a poll fails to end and to try again -->
|
||||
<string name="Poll__check_connection">Check your connection and try again.</string>
|
||||
<!-- Dialog title when you go to end a poll -->
|
||||
<string name="Poll__end_poll_title">End poll?</string>
|
||||
<!-- Dialog body when you go to end a poll -->
|
||||
<string name="Poll__end_poll_body">Group members will no longer be able to vote in this poll.</string>
|
||||
<!-- Header when creating a new poll -->
|
||||
<string name="CreatePollFragment__new_poll">New poll</string>
|
||||
<!-- Section text to enter in a question for a poll -->
|
||||
|
||||
Reference in New Issue
Block a user