mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 20:49:36 +01:00
disable buttons while waiting for response
avoids doubleclick and doubled data Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
f46d2d28f5
commit
58739b8f14
@ -114,6 +114,8 @@ class PollCreateViewModel @Inject constructor(private val repository: PollReposi
|
||||
_options.value = _options.value?.filter { it.pollOption.isNotEmpty() } as ArrayList<PollCreateOptionItem>
|
||||
|
||||
if (_question.isNotEmpty() && _options.value?.isNotEmpty() == true) {
|
||||
_viewState.value = PollCreationState(enableAddOptionButton = false, enableCreatePollButton = false)
|
||||
|
||||
repository.createPoll(
|
||||
roomToken, _question, _options.value!!.map { it.pollOption }, resultMode,
|
||||
maxVotes
|
||||
|
@ -79,6 +79,8 @@ class PollVoteViewModel @Inject constructor(private val repository: PollReposito
|
||||
|
||||
fun vote(roomToken: String, pollId: String) {
|
||||
if (_selectedOptions.isNotEmpty()) {
|
||||
_submitButtonEnabled.value = false
|
||||
|
||||
repository.vote(roomToken, pollId, _selectedOptions)
|
||||
.doOnSubscribe { disposable = it }
|
||||
?.subscribeOn(Schedulers.io())
|
||||
|
Loading…
Reference in New Issue
Block a user