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 | 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.data.local.models.timer_functional.FunctionalTimer | ||||||
| import be.ugent.sel.studeez.domain.LogService | 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.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 dagger.hilt.android.lifecycle.HiltViewModel | ||||||
| import javax.inject.Inject | import javax.inject.Inject | ||||||
| 
 | 
 | ||||||
| @HiltViewModel | @HiltViewModel | ||||||
| class SessionViewModel @Inject constructor( | class SessionViewModel @Inject constructor( | ||||||
|     private val selectedTimerState: SelectedTimerState, |     private val selectedTimerState: SelectedTimerState, | ||||||
|  |     private val sessionReportState: SessionReportState, | ||||||
|     logService: LogService |     logService: LogService | ||||||
| ) : StudeezViewModel(logService) { | ) : StudeezViewModel(logService) { | ||||||
| 
 | 
 | ||||||
|     private val timer: FunctionalTimer = FunctionalPomodoroTimer(15, 5, 3) |  | ||||||
|     private val task : String = "No task selected" // placeholder for tasks implementation |     private val task : String = "No task selected" // placeholder for tasks implementation | ||||||
| 
 | 
 | ||||||
|     fun getTimer() : FunctionalTimer { |     fun getTimer() : FunctionalTimer { | ||||||
|  | @ -24,4 +25,9 @@ class SessionViewModel @Inject constructor( | ||||||
|     fun getTask(): String { |     fun getTask(): String { | ||||||
|         return task |         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