changed savedTimer to editTimer

This commit is contained in:
lbarraga 2023-05-04 22:56:26 +02:00
parent b909c7dd15
commit 534a88db5d

View file

@ -1,16 +1,14 @@
package be.ugent.sel.studeez.screens.timer_edit package be.ugent.sel.studeez.screens.timer_edit
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
import be.ugent.sel.studeez.screens.timer_edit.editScreens.AbstractTimerEditScreen import be.ugent.sel.studeez.R.string as AppText
import be.ugent.sel.studeez.ui.theme.StudeezTheme
data class TimerEditActions( data class TimerEditActions(
val getTimerInfo: () -> TimerInfo, val getTimerInfo: () -> TimerInfo,
val saveTimer: (TimerInfo, () -> Unit) -> Unit val editTimer: (TimerInfo, () -> Unit) -> Unit
) )
fun getTimerEditActions( fun getTimerEditActions(
@ -19,7 +17,7 @@ fun getTimerEditActions(
): TimerEditActions { ): TimerEditActions {
return TimerEditActions( return TimerEditActions(
getTimerInfo = viewModel::getTimerInfo, getTimerInfo = viewModel::getTimerInfo,
saveTimer = viewModel::saveTimer editTimer = viewModel::editTimer
) )
} }
@ -32,11 +30,11 @@ fun TimerEditRoute(
val timerEditActions = getTimerEditActions(viewModel, open) val timerEditActions = getTimerEditActions(viewModel, open)
SecondaryScreenTemplate(title = "Edit Timer", popUp = popUp) { SecondaryScreenTemplate(title = stringResource(id = AppText.edit_timer), popUp = popUp) {
val timerEditScreen = timerEditActions.getTimerInfo().accept(GetTimerEditScreen()) val timerEditScreen = timerEditActions.getTimerInfo().accept(GetTimerEditScreen())
timerEditScreen { timerInfo -> timerEditScreen { timerInfo ->
timerEditActions.saveTimer(timerInfo, popUp) timerEditActions.editTimer(timerInfo, popUp)
} }
} }
} }