intermediate type select screen for add and route to edit instead of add
This commit is contained in:
		
							parent
							
								
									46109ac4ff
								
							
						
					
					
						commit
						9688426093
					
				
					 4 changed files with 15 additions and 6 deletions
				
			
		|  | @ -32,6 +32,7 @@ import be.ugent.sel.studeez.screens.sessions.SessionsRoute | |||
| import be.ugent.sel.studeez.screens.settings.SettingsRoute | ||||
| import be.ugent.sel.studeez.screens.sign_up.SignUpRoute | ||||
| import be.ugent.sel.studeez.screens.splash.SplashRoute | ||||
| import be.ugent.sel.studeez.screens.timer_add.TimerTypeSelectScreen | ||||
| import be.ugent.sel.studeez.screens.timer_edit.TimerEditRoute | ||||
| import be.ugent.sel.studeez.screens.timer_overview.TimerOverviewRoute | ||||
| import be.ugent.sel.studeez.screens.timer_overview.add_timer.AddTimerRoute | ||||
|  | @ -183,6 +184,13 @@ fun StudeezNavGraph( | |||
|             ) | ||||
|         } | ||||
| 
 | ||||
|         composable(StudeezDestinations.TIMER_TYPE_CHOOSING_SCREEN) { | ||||
|             TimerTypeSelectScreen( | ||||
|                 open = open, | ||||
|                 popUp = goBack | ||||
|             ) | ||||
|         } | ||||
| 
 | ||||
|         composable(StudeezDestinations.SESSION_SCREEN) { | ||||
|             SessionRoute( | ||||
|                 open, | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ object StudeezDestinations { | |||
|     // Studying flow | ||||
|     const val TIMER_SELECTION_SCREEN = "timer_selection" | ||||
|     const val TIMER_EDIT_SCREEN = "timer_edit" | ||||
|     const val TIMER_TYPE_CHOOSING_SCREEN = "timer_type_choosing_screen" | ||||
|     const val SESSION_SCREEN = "session" | ||||
|     const val SESSION_RECAP = "session_recap" | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ data class TimerOverviewActions( | |||
|     val getUserTimers: () -> Flow<List<TimerInfo>>, | ||||
|     val getDefaultTimers: () -> List<TimerInfo>, | ||||
|     val onEditClick: (TimerInfo) -> Unit, | ||||
|     val onAddClick: () -> Unit, | ||||
|     val onAddClick: () -> Unit | ||||
| ) | ||||
| 
 | ||||
| fun getTimerOverviewActions( | ||||
|  | @ -36,7 +36,7 @@ fun getTimerOverviewActions( | |||
|         getUserTimers = viewModel::getUserTimers, | ||||
|         getDefaultTimers = viewModel::getDefaultTimers, | ||||
|         onEditClick = { viewModel.update(it, open) }, | ||||
|         onAddClick = { viewModel.create(open) } | ||||
|         onAddClick = { viewModel.onAddClick(open) } | ||||
|     ) | ||||
| } | ||||
| 
 | ||||
|  | @ -48,14 +48,14 @@ fun TimerOverviewRoute( | |||
| ) { | ||||
|     TimerOverviewScreen( | ||||
|         timerOverviewActions = getTimerOverviewActions(viewModel, open), | ||||
|         drawerActions = drawerActions | ||||
|         drawerActions = drawerActions, | ||||
|     ) | ||||
| } | ||||
| 
 | ||||
| @Composable | ||||
| fun TimerOverviewScreen( | ||||
|     timerOverviewActions: TimerOverviewActions, | ||||
|     drawerActions: DrawerActions | ||||
|     drawerActions: DrawerActions, | ||||
| ) { | ||||
| 
 | ||||
|     val timers = timerOverviewActions.getUserTimers().collectAsState(initial = emptyList()) | ||||
|  |  | |||
|  | @ -32,8 +32,8 @@ class TimerOverviewViewModel @Inject constructor( | |||
|         open(StudeezDestinations.TIMER_EDIT_SCREEN) | ||||
|     } | ||||
| 
 | ||||
|     fun create(open: (String) -> Unit) { | ||||
|         open(StudeezDestinations.ADD_TIMER_SCREEN) | ||||
|     fun onAddClick(open: (String) -> Unit) { | ||||
|         open(StudeezDestinations.TIMER_TYPE_CHOOSING_SCREEN) | ||||
|     } | ||||
| 
 | ||||
|     fun delete(timerInfo: TimerInfo) =timerDAO.deleteTimer(timerInfo) | ||||
|  |  | |||
		Reference in a new issue
	
	 Lukas Barragan Torres
						Lukas Barragan Torres