Disable chat effect and confetti if animation are disabled on the system

It will speed up the sanity test
This commit is contained in:
Benoit Marty 2022-05-05 12:02:44 +02:00
parent 67bc7c93e6
commit d454e3fd20
3 changed files with 9 additions and 2 deletions

View file

@ -105,6 +105,7 @@ import im.vector.app.core.utils.colorizeMatchingText
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.core.utils.createJSonViewerStyleProvider
import im.vector.app.core.utils.createUIHandler
import im.vector.app.core.utils.isAnimationDisabled
import im.vector.app.core.utils.isValidUrl
import im.vector.app.core.utils.onPermissionDeniedDialog
import im.vector.app.core.utils.onPermissionDeniedSnackbar
@ -586,6 +587,10 @@ class TimelineFragment @Inject constructor(
}
private fun handleChatEffect(chatEffect: ChatEffect) {
if (requireContext().isAnimationDisabled()) {
Timber.d("Do not perform chat effect, animations are disabled.")
return
}
when (chatEffect) {
ChatEffect.CONFETTI -> {
views.viewKonfetti.isVisible = true

View file

@ -24,6 +24,7 @@ import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.animations.play
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.utils.isAnimationDisabled
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewEvents
@ -57,7 +58,7 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
views.personalizeButtonGroup.isVisible = canPersonalize
views.takeMeHomeButtonGroup.isVisible = !canPersonalize
if (!hasPlayedConfetti && !canPersonalize) {
if (!hasPlayedConfetti && !canPersonalize && !requireContext().isAnimationDisabled()) {
hasPlayedConfetti = true
views.viewKonfetti.isVisible = true
views.viewKonfetti.play()

View file

@ -22,6 +22,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import im.vector.app.core.animations.play
import im.vector.app.core.utils.isAnimationDisabled
import im.vector.app.databinding.FragmentFtuePersonalizationCompleteBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewEvents
@ -43,7 +44,7 @@ class FtueAuthPersonalizationCompleteFragment @Inject constructor() : AbstractFt
private fun setupViews() {
views.personalizationCompleteCta.debouncedClicks { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }
if (!hasPlayedConfetti) {
if (!hasPlayedConfetti && !requireContext().isAnimationDisabled()) {
hasPlayedConfetti = true
views.viewKonfetti.isVisible = true
views.viewKonfetti.play()