send sessionreport to state
This commit is contained in:
		
							parent
							
								
									312fc3167a
								
							
						
					
					
						commit
						d381480c43
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		|  | @ -1,20 +1,21 @@ | |||
| package be.ugent.sel.studeez.screens.session | ||||
| 
 | ||||
| import be.ugent.sel.studeez.data.SelectedTimerState | ||||
| import be.ugent.sel.studeez.data.SessionReportState | ||||
| import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer | ||||
| import be.ugent.sel.studeez.domain.LogService | ||||
| import be.ugent.sel.studeez.navigation.StudeezDestinations | ||||
| import be.ugent.sel.studeez.screens.StudeezViewModel | ||||
| import be.ugent.sel.studeez.data.SelectedTimerState | ||||
| import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer | ||||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||||
| import javax.inject.Inject | ||||
| 
 | ||||
| @HiltViewModel | ||||
| class SessionViewModel @Inject constructor( | ||||
|     private val selectedTimerState: SelectedTimerState, | ||||
|     private val sessionReportState: SessionReportState, | ||||
|     logService: LogService | ||||
| ) : StudeezViewModel(logService) { | ||||
| 
 | ||||
|     private val timer: FunctionalTimer = FunctionalPomodoroTimer(15, 5, 3) | ||||
|     private val task : String = "No task selected" // placeholder for tasks implementation | ||||
| 
 | ||||
|     fun getTimer() : FunctionalTimer { | ||||
|  | @ -24,4 +25,9 @@ class SessionViewModel @Inject constructor( | |||
|     fun getTask(): String { | ||||
|         return task | ||||
|     } | ||||
| 
 | ||||
|     fun endSession(openAndPopUp: (String, String) -> Unit) { | ||||
|         sessionReportState.sessionReport = getTimer().getSessionReport() | ||||
|         openAndPopUp(StudeezDestinations.SESSION_RECAP, StudeezDestinations.SESSION_SCREEN) | ||||
|     } | ||||
| } | ||||
		Reference in a new issue
	
	 lbarraga
						lbarraga