#14 Basic navigation around the app
This commit is contained in:
		
							parent
							
								
									13140d4e3c
								
							
						
					
					
						commit
						e4066dedd7
					
				
					 6 changed files with 60 additions and 5 deletions
				
			
		|  | @ -20,6 +20,7 @@ import be.ugent.sel.studeez.common.snackbar.SnackbarManager | ||||||
| import be.ugent.sel.studeez.navigation.StudeezDestinations | import be.ugent.sel.studeez.navigation.StudeezDestinations | ||||||
| import be.ugent.sel.studeez.screens.home.HomeScreen | import be.ugent.sel.studeez.screens.home.HomeScreen | ||||||
| import be.ugent.sel.studeez.screens.log_in.LoginScreen | import be.ugent.sel.studeez.screens.log_in.LoginScreen | ||||||
|  | import be.ugent.sel.studeez.screens.profile.ProfileScreen | ||||||
| import be.ugent.sel.studeez.screens.sign_up.SignUpScreen | import be.ugent.sel.studeez.screens.sign_up.SignUpScreen | ||||||
| import be.ugent.sel.studeez.screens.splash.SplashScreen | import be.ugent.sel.studeez.screens.splash.SplashScreen | ||||||
| import be.ugent.sel.studeez.ui.theme.StudeezTheme | import be.ugent.sel.studeez.ui.theme.StudeezTheme | ||||||
|  | @ -99,4 +100,14 @@ fun NavGraphBuilder.studeezGraph(appState: StudeezAppstate) { | ||||||
|     composable(StudeezDestinations.HOME_SCREEN) { |     composable(StudeezDestinations.HOME_SCREEN) { | ||||||
|         HomeScreen(open, openAndPopUp) |         HomeScreen(open, openAndPopUp) | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     // TODO Tasks screen | ||||||
|  |     // TODO Sessions screen | ||||||
|  | 
 | ||||||
|  |     composable(StudeezDestinations.PROFILE_SCREEN) { | ||||||
|  |         ProfileScreen(open, openAndPopUp) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // TODO Timers screen | ||||||
|  |     // TODO Settings screen | ||||||
| } | } | ||||||
|  | @ -4,6 +4,12 @@ object StudeezDestinations { | ||||||
|     const val SPLASH_SCREEN = "splash" |     const val SPLASH_SCREEN = "splash" | ||||||
|     const val SIGN_UP_SCREEN = "signup" |     const val SIGN_UP_SCREEN = "signup" | ||||||
|     const val LOGIN_SCREEN = "login" |     const val LOGIN_SCREEN = "login" | ||||||
|     const val HOME_SCREEN = "home" |  | ||||||
| 
 | 
 | ||||||
|  |     const val HOME_SCREEN = "home" | ||||||
|  | //    const val TASKS_SCREEN = "tasks" | ||||||
|  | //    const val SESSIONS_SCREEN = "sessions" | ||||||
|  |     const val PROFILE_SCREEN = "profile" | ||||||
|  | 
 | ||||||
|  | //    const val TIMERS_SCREEN = "timers" | ||||||
|  | //    const val SETTINGS_SCREEN = "settings" | ||||||
| } | } | ||||||
|  | @ -3,6 +3,7 @@ package be.ugent.sel.studeez.screens.drawer | ||||||
| import be.ugent.sel.studeez.domain.AccountDAO | import be.ugent.sel.studeez.domain.AccountDAO | ||||||
| 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.navigation.StudeezDestinations | ||||||
|  | import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN | ||||||
| import be.ugent.sel.studeez.screens.StudeezViewModel | import be.ugent.sel.studeez.screens.StudeezViewModel | ||||||
| import dagger.hilt.android.lifecycle.HiltViewModel | import dagger.hilt.android.lifecycle.HiltViewModel | ||||||
| import javax.inject.Inject | import javax.inject.Inject | ||||||
|  | @ -14,7 +15,7 @@ class DrawerViewModel @Inject constructor( | ||||||
| ) : StudeezViewModel(logService) { | ) : StudeezViewModel(logService) { | ||||||
| 
 | 
 | ||||||
|     fun onHomeButtonClick(open: (String) -> Unit) { |     fun onHomeButtonClick(open: (String) -> Unit) { | ||||||
|         // TODO |         open(HOME_SCREEN) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fun onTimersClick(open: (String) -> Unit) { |     fun onTimersClick(open: (String) -> Unit) { | ||||||
|  | @ -25,10 +26,10 @@ class DrawerViewModel @Inject constructor( | ||||||
|         // TODO |         // TODO | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fun onLogoutClick(openAndPopup: (String, String) -> Unit) { |     fun onLogoutClick(openAndPopUp: (String, String) -> Unit) { | ||||||
|         launchCatching { |         launchCatching { | ||||||
|             accountDAO.signOut() |             accountDAO.signOut() | ||||||
|             openAndPopup(StudeezDestinations.LOGIN_SCREEN, StudeezDestinations.HOME_SCREEN) |             openAndPopUp(StudeezDestinations.LOGIN_SCREEN, StudeezDestinations.HOME_SCREEN) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ package be.ugent.sel.studeez.screens.navbar | ||||||
| import be.ugent.sel.studeez.domain.AccountDAO | import be.ugent.sel.studeez.domain.AccountDAO | ||||||
| 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.navigation.StudeezDestinations | ||||||
|  | import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN | ||||||
| import be.ugent.sel.studeez.navigation.StudeezDestinations.PROFILE_SCREEN | import be.ugent.sel.studeez.navigation.StudeezDestinations.PROFILE_SCREEN | ||||||
| import be.ugent.sel.studeez.screens.StudeezViewModel | import be.ugent.sel.studeez.screens.StudeezViewModel | ||||||
| import dagger.hilt.android.lifecycle.HiltViewModel | import dagger.hilt.android.lifecycle.HiltViewModel | ||||||
|  | @ -15,7 +16,7 @@ class NavigationBarViewModel @Inject constructor( | ||||||
| ) : StudeezViewModel(logService) { | ) : StudeezViewModel(logService) { | ||||||
| 
 | 
 | ||||||
|     fun onHomeClick(open: (String) -> Unit) { |     fun onHomeClick(open: (String) -> Unit) { | ||||||
|         // TODO |         open(HOME_SCREEN) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fun onTasksClick(open: (String) -> Unit) { |     fun onTasksClick(open: (String) -> Unit) { | ||||||
|  |  | ||||||
|  | @ -0,0 +1,23 @@ | ||||||
|  | package be.ugent.sel.studeez.screens.profile | ||||||
|  | 
 | ||||||
|  | import androidx.compose.material.Text | ||||||
|  | import androidx.compose.runtime.Composable | ||||||
|  | import androidx.hilt.navigation.compose.hiltViewModel | ||||||
|  | import be.ugent.sel.studeez.common.composable.PrimaryScreenTemplate | ||||||
|  | import be.ugent.sel.studeez.resources | ||||||
|  | import be.ugent.sel.studeez.R.string as AppText | ||||||
|  | 
 | ||||||
|  | @Composable | ||||||
|  | fun ProfileScreen( | ||||||
|  |     open: (String) -> Unit, | ||||||
|  |     openAndPopUp: (String, String) -> Unit, | ||||||
|  |     viewModel: ProfileViewModel = hiltViewModel() | ||||||
|  | ) { | ||||||
|  |     PrimaryScreenTemplate( | ||||||
|  |         title = resources().getString(AppText.profile), | ||||||
|  |         open = open, | ||||||
|  |         openAndPopUp = openAndPopUp | ||||||
|  |     ) { | ||||||
|  |         Text(text = "This is your profile!") // TODO | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,13 @@ | ||||||
|  | package be.ugent.sel.studeez.screens.profile | ||||||
|  | 
 | ||||||
|  | import be.ugent.sel.studeez.domain.LogService | ||||||
|  | import be.ugent.sel.studeez.screens.StudeezViewModel | ||||||
|  | import dagger.hilt.android.lifecycle.HiltViewModel | ||||||
|  | import javax.inject.Inject | ||||||
|  | 
 | ||||||
|  | @HiltViewModel | ||||||
|  | class ProfileViewModel @Inject constructor( | ||||||
|  |     logService: LogService | ||||||
|  | ) : StudeezViewModel(logService) { | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Reference in a new issue