Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-28 10:14:15 +01:00
parent 89fe32707a
commit f9f4e5a69e
3 changed files with 15 additions and 3 deletions

View file

@ -43,12 +43,18 @@ internal fun StoriesScreen(
var currentStory by remember { mutableStateOf(state.firstStory) }
val currentStoryIndex by rememberUpdatedState(newValue = state.stepOf(currentStory))
LaunchedEffect(currentStoryIndex) {
if (currentStoryIndex < 0) {
currentStory = state.firstStory
}
}
val goToPreviousStory = remember(currentStory, currentStoryIndex) {
{ currentStory = state.stories[max(0, currentStoryIndex - 1)] }
}
val goToNextStory = remember(currentStory, currentStoryIndex) {
{
currentStory = if (currentStoryIndex < state.stories.lastIndex) {
currentStory = if (currentStoryIndex >= 0 && currentStoryIndex < state.stories.lastIndex) {
state.stories[currentStoryIndex + 1]
} else {
state.firstStory

View file

@ -33,12 +33,18 @@ internal fun StoriesScreenV2(state: HomeUM, onGetStartedClick: () -> Unit, modif
var currentStory by remember { mutableStateOf(state.firstStory) }
val currentStoryIndex by rememberUpdatedState(newValue = state.stepOf(currentStory))
LaunchedEffect(currentStoryIndex) {
if (currentStoryIndex < 0) {
currentStory = state.firstStory
}
}
val goToPreviousStory = remember(currentStory, currentStoryIndex) {
{ currentStory = state.stories[max(0, currentStoryIndex - 1)] }
}
val goToNextStory = remember(currentStory, currentStoryIndex) {
{
currentStory = if (currentStoryIndex < state.stories.lastIndex) {
currentStory = if (currentStoryIndex >= 0 && currentStoryIndex < state.stories.lastIndex) {
state.stories[currentStoryIndex + 1]
} else {
state.firstStory

View file

@ -85,7 +85,7 @@ fun StoriesProgressBar(
.let {
when (index) {
currentStep -> it.fillMaxWidth(progress.value)
in 0..currentStep -> it.fillMaxWidth(fraction = 1f)
in 0 until currentStep -> it.fillMaxWidth(fraction = 1f)
else -> it
}
},