diff --git a/core/dumb/src/main/java/com/buzbuz/smartautoclicker/core/dumb/engine/DumbActionTry.kt b/core/dumb/src/main/java/com/buzbuz/smartautoclicker/core/dumb/engine/DumbActionTry.kt index d276d01a..7c40587a 100644 --- a/core/dumb/src/main/java/com/buzbuz/smartautoclicker/core/dumb/engine/DumbActionTry.kt +++ b/core/dumb/src/main/java/com/buzbuz/smartautoclicker/core/dumb/engine/DumbActionTry.kt @@ -18,6 +18,9 @@ package com.buzbuz.smartautoclicker.core.dumb.engine import com.buzbuz.smartautoclicker.core.base.identifier.Identifier import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbAction +import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbAction.DumbClick +import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbAction.DumbPause +import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbAction.DumbSwipe import com.buzbuz.smartautoclicker.core.dumb.domain.model.DumbScenario internal fun DumbAction.toDumbScenarioTry(): DumbScenario { @@ -31,7 +34,21 @@ internal fun DumbAction.toDumbScenarioTry(): DumbScenario { maxDurationMin = 1, isDurationInfinite = false, randomize = false, - dumbActions = listOf(copyWithNewScenarioId(scenarioId = scenarioId)) + dumbActions = listOf(toFiniteDumbAction(scenarioId)) ) } +private fun DumbAction.toFiniteDumbAction(scenarioId: Identifier): DumbAction = + when (this) { + is DumbClick -> copy( + scenarioId = scenarioId, + isRepeatInfinite = false, + ) + is DumbSwipe -> copy( + scenarioId = scenarioId, + isRepeatInfinite = false, + ) + is DumbPause -> copy( + scenarioId = scenarioId + ) + } \ No newline at end of file