change name of SelectedTimerRepo to SelectedTimerState

This commit is contained in:
Lukas Barragan Torres 2023-04-18 13:33:37 +02:00
parent b3651bbbe5
commit d8b95f5d5b
3 changed files with 7 additions and 7 deletions

View file

@ -9,6 +9,6 @@ import javax.inject.Singleton
* Because this is a singleton-class the view-models of both screens observe the same data.
*/
@Singleton
class SelectedTimerRepo @Inject constructor(){
class SelectedTimerState @Inject constructor(){
var selectedTimer: FunctionalTimer? = null
}

View file

@ -3,17 +3,17 @@ package be.ugent.sel.studeez.screens.session
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
import be.ugent.sel.studeez.domain.LogService
import be.ugent.sel.studeez.screens.StudeezViewModel
import be.ugent.sel.studeez.data.SelectedTimerRepo
import be.ugent.sel.studeez.data.SelectedTimerState
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class SessionViewModel @Inject constructor(
private val selectedTimerRepo: SelectedTimerRepo,
private val selectedTimerState: SelectedTimerState,
logService: LogService
) : StudeezViewModel(logService) {
fun getTimer() : FunctionalTimer {
return selectedTimerRepo.selectedTimer!!
return selectedTimerState.selectedTimer!!
}
}

View file

@ -1,6 +1,6 @@
package be.ugent.sel.studeez.screens.timer_selection
import be.ugent.sel.studeez.data.SelectedTimerRepo
import be.ugent.sel.studeez.data.SelectedTimerState
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
import be.ugent.sel.studeez.domain.LogService
import be.ugent.sel.studeez.domain.TimerDAO
@ -13,7 +13,7 @@ import javax.inject.Inject
@HiltViewModel
class TimerSelectionViewModel @Inject constructor(
private val timerDAO: TimerDAO,
private val selectedTimerRepo: SelectedTimerRepo,
private val selectedTimerState: SelectedTimerState,
logService: LogService
) : StudeezViewModel(logService) {
@ -22,7 +22,7 @@ class TimerSelectionViewModel @Inject constructor(
}
fun startSession(open: (String) -> Unit, timerInfo: TimerInfo) {
selectedTimerRepo.selectedTimer = timerInfo.getFunctionalTimer()
selectedTimerState.selectedTimer = timerInfo.getFunctionalTimer()
open(StudeezDestinations.SESSION_SCREEN)
}
}