Fix WelcomeAnimation in testing (#1668)

- These changes also improve the UX of the app launch, as it only waits for the animation duration.
This commit is contained in:
Honza Rychnovský 2024-11-11 12:24:43 +01:00 committed by GitHub
parent 72e3eca548
commit 261510a42c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -259,7 +259,7 @@ class MainActivity : FragmentActivity() {
onSuccess = {
lifecycleScope.launch {
// Wait until the welcome animation finishes, then mark it as presented to the user
delay((AnimationConstants.together()).milliseconds)
delay((AnimationConstants.durationOnly()).milliseconds)
authenticationViewModel.appAccessAuthentication.value = AuthenticationUIState.Successful
}
},

View File

@ -8,6 +8,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.tooling.preview.Preview
@ -16,6 +17,7 @@ import co.electriccoin.zcash.ui.common.viewmodel.AuthenticationResult
import co.electriccoin.zcash.ui.design.component.AppAlertDialog
import co.electriccoin.zcash.ui.design.component.BlankSurface
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
import co.electriccoin.zcash.ui.screen.authentication.view.AnimationConstants.WELCOME_ANIM_TEST_TAG
@Preview("App Access Authentication")
@Composable
@ -72,7 +74,7 @@ fun AppAccessAuthentication(
animationState = welcomeAnimVisibility,
onRetry = onRetry,
showAuthLogo = showAuthLogo,
modifier = modifier,
modifier = modifier.testTag(WELCOME_ANIM_TEST_TAG),
)
}

View File

@ -57,6 +57,8 @@ object AnimationConstants {
const val WELCOME_ANIM_TEST_TAG = "WELCOME_ANIM_TEST_TAG"
fun together() = (ANIMATION_DURATION + INITIAL_DELAY).toLong()
fun durationOnly() = (ANIMATION_DURATION).toLong()
}
// TODO [#1002]: Welcome screen animation masking