Prevent schedule meeting button being pressed multiple times

This commit is contained in:
Sylvain Berfini 2025-03-19 13:58:12 +01:00
parent 1942ee8f85
commit 2eb376fd2d
3 changed files with 7 additions and 3 deletions

View file

@ -373,11 +373,13 @@ class ScheduleMeetingViewModel
@UiThread
fun schedule() {
operationInProgress.value = true
if (subject.value.orEmpty().isEmpty() || participants.value.orEmpty().isEmpty()) {
Log.e(
"$TAG Either no subject was set or no participant was selected, can't schedule meeting."
)
showRedToast(R.string.meeting_schedule_mandatory_field_not_filled_toast, R.drawable.warning_circle)
operationInProgress.value = false
return
}
@ -385,7 +387,6 @@ class ScheduleMeetingViewModel
Log.i(
"$TAG Scheduling ${if (isBroadcastSelected.value == true) "broadcast" else "meeting"}"
)
operationInProgress.postValue(true)
val localAccount = core.defaultAccount
val localAddress = localAccount?.params?.identityAddress
@ -452,17 +453,18 @@ class ScheduleMeetingViewModel
@UiThread
fun update() {
operationInProgress.value = true
coreContext.postOnCoreThread { core ->
Log.i(
"$TAG Updating ${if (isBroadcastSelected.value == true) "broadcast" else "meeting"}"
)
if (!::conferenceInfo.isInitialized) {
Log.e("No conference info to edit found!")
operationInProgress.postValue(false)
return@postOnCoreThread
}
operationInProgress.postValue(true)
conferenceInfo.subject = subject.value
conferenceInfo.description = description.value

View file

@ -397,6 +397,7 @@
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:src="@drawable/check"
android:enabled="@{!viewModel.operationInProgress}"
android:contentDescription="@string/content_description_meeting_schedule"
app:tint="?attr/color_on_main"
app:backgroundTint="?attr/color_main1_500"

View file

@ -543,6 +543,7 @@
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:src="@drawable/check"
android:enabled="@{!viewModel.operationInProgress}"
android:contentDescription="@string/content_description_meeting_schedule"
app:tint="?attr/color_on_main"
app:backgroundTint="?attr/color_main1_500"