#30 minor refactor
This commit is contained in:
		
							parent
							
								
									f1d24087b4
								
							
						
					
					
						commit
						bd48a12d52
					
				
					 2 changed files with 9 additions and 30 deletions
				
			
		|  | @ -1,6 +1,7 @@ | ||||||
| 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.tooling.preview.Preview | 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 | ||||||
|  | @ -9,7 +10,7 @@ import be.ugent.sel.studeez.ui.theme.StudeezTheme | ||||||
| 
 | 
 | ||||||
| data class TimerEditActions( | data class TimerEditActions( | ||||||
|     val getTimerInfo: () -> TimerInfo, |     val getTimerInfo: () -> TimerInfo, | ||||||
|     val saveTimer: (TimerInfo) -> Unit |     val saveTimer: (TimerInfo, () -> Unit) -> Unit | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| fun getTimerEditActions( | fun getTimerEditActions( | ||||||
|  | @ -28,36 +29,18 @@ fun TimerEditRoute( | ||||||
|     popUp: () -> Unit, |     popUp: () -> Unit, | ||||||
|     viewModel: TimerEditViewModel, |     viewModel: TimerEditViewModel, | ||||||
| ) { | ) { | ||||||
|     TimerEditScreen( |  | ||||||
|         timerEditActions = getTimerEditActions(viewModel, open), |  | ||||||
|         popUp = popUp |  | ||||||
|     ) |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| @Composable |     val timerEditActions = getTimerEditActions(viewModel, open) | ||||||
| fun TimerEditScreen( | 
 | ||||||
|     timerEditActions: TimerEditActions, |     SecondaryScreenTemplate(title = "Edit Timer", popUp = popUp) { | ||||||
|     popUp: () -> Unit | 
 | ||||||
| ) { |  | ||||||
|     SecondaryScreenTemplate(title = "Edit Timer", popUp = { /*TODO*/ }) { |  | ||||||
|         val timerEditScreen = timerEditActions.getTimerInfo().accept(GetTimerEditScreen()) |         val timerEditScreen = timerEditActions.getTimerInfo().accept(GetTimerEditScreen()) | ||||||
|         timerEditScreen { timerInfo -> timerEditActions.saveTimer(timerInfo) } |         timerEditScreen { timerInfo -> | ||||||
|  |             timerEditActions.saveTimer(timerInfo, popUp) | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //@Preview |  | ||||||
| //@Composable |  | ||||||
| //fun TimerEditScreenPreview() { |  | ||||||
| //    val editEntries: List<EditEntry> = listOf( |  | ||||||
| //        EditEntry("Name", "MyTimer") {}, |  | ||||||
| //        EditEntry("Description", "Dit is een leuke timer") {}, |  | ||||||
| //        EditEntry("StudyTime", "25") {} |  | ||||||
| //    ) |  | ||||||
| //    val actions = TimerEditActions { editEntries } |  | ||||||
| //    StudeezTheme { TimerEditScreen(timerEditActions = actions) {} } |  | ||||||
| //} |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| package be.ugent.sel.studeez.screens.timer_edit.editScreens |  | ||||||
| 
 |  | ||||||
| class EditScreenUIState { |  | ||||||
| } |  | ||||||
		Reference in a new issue
	
	 lbarraga
						lbarraga