Skip to content

Commit

Permalink
Add a showProgressCatching method to avoid crashing when showing prog…
Browse files Browse the repository at this point in the history
…ress

This happens quite often even though it seems that we try and do everything to avoid it
  • Loading branch information
LunarX committed Jun 27, 2024
1 parent 8e458a0 commit c5576ed
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.google.android.material.button.MaterialButton
import com.infomaniak.lib.core.utils.Utils
import com.infomaniak.lib.core.utils.hideProgress
import com.infomaniak.lib.core.utils.initProgress
import com.infomaniak.lib.core.utils.showProgress
import com.infomaniak.lib.core.utils.showProgressCatching
import com.infomaniak.mail.R

abstract class BaseAlertDialog(activityContext: Context) : DefaultLifecycleObserver {
Expand All @@ -45,7 +45,7 @@ abstract class BaseAlertDialog(activityContext: Context) : DefaultLifecycleObser
fun startLoading() {
alertDialog.setCancelable(false)
negativeButton.isEnabled = false
Utils.createRefreshTimer(onTimerFinish = positiveButton::showProgress).start()
Utils.createRefreshTimer(onTimerFinish = positiveButton::showProgressCatching).start()
}

fun resetLoadingAndDismiss() = with(alertDialog) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class LoginFragment : Fragment() {
}

private fun startProgress() {
binding.connectButton.showProgress(getCurrentOnPrimary())
binding.connectButton.showProgressCatching(getCurrentOnPrimary())
}

private fun getCurrentOnPrimary(): Int? = introViewModel.updatedAccentColor.value?.first?.getOnPrimary(requireContext())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ class InvalidPasswordFragment : Fragment() {
}

private fun startProgress() {
binding.confirmButton.showProgress()
binding.confirmButton.showProgressCatching()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ class RestoreEmailsBottomSheetDialog : BottomSheetDialogFragment() {
}

private fun startProgress() {
binding.restoreMailsButton.showProgress()
binding.restoreMailsButton.showProgressCatching()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ class AttachMailboxFragment : Fragment() {
}

private fun startProgress() {
binding.attachMailboxButton.showProgress()
binding.attachMailboxButton.showProgressCatching()
}
}

0 comments on commit c5576ed

Please sign in to comment.