Skip to content

[Goals for Onboarding][1/2]#104

Open
isiahpwilliams wants to merge 8 commits intomainfrom
preston/goals-onboarding
Open

[Goals for Onboarding][1/2]#104
isiahpwilliams wants to merge 8 commits intomainfrom
preston/goals-onboarding

Conversation

@isiahpwilliams
Copy link

@isiahpwilliams isiahpwilliams commented Mar 4, 2026

Overview

Implemented the "set your goals" page from the figma and added it to the onboarding flow. Currently, it does not upload the information to the database but that will be for future changes. I also made the base view model for the page with a few functions that will need to be updated when implementing the networking features. Finished networking for the onboarding pages allowing users to update their goals after creating their account.

Changes Made

Refactored screen to separate usage for onboarding and settings (WorkoutReminderScreen.kt)
Designed a base view model for the screen (ProfileCreationViewModel.kt)
Updated create user function to enable users to add a goal (UserInfoRepository.kt)
Made small changes in MainNavigationWrapper.kt and DatastoreRepository.kt to enable above changes

Test Coverage

I was able to manually test and am successfully able to drag the slider over and move to the next page and create a user and view their goals

Screenshots (delete if not applicable)

Goals Onboarding Screen Screenshot 2026-03-04 at 12 37 39 PM Screenshot 2026-03-04 at 12 37 59 PM Screenshot 2026-03-10 at 9 47 48 PM These are the onboarding screens that allow users to adjust a slider to set a goal for the number of days they want to work out per week and a picture of an account successfully being created after the goal logic was added.


@Preview(showBackground = true)
@Composable
fun GoalPromptScreenPreview() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Private

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file deleted

@Composable
fun GoalPromptScreenPreview() {
var sliderVal by remember { mutableFloatStateOf(0f) }
GoalPromptScreen()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preview has issues because of vm. Separate into Screen and something like ScreenContent which only contains the UI w/o vm and use that in preview

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file deleted

@AndrewCheung360
Copy link
Member

AndrewCheung360 commented Mar 7, 2026

Nice job on your first PR, and thanks for your work! I appreciate you keeping the PR nice and concise -- makes it easier for me to review!

A few things though:

It looks like the code for the set goals UI along with the workout reminders is already there in WorkoutRemindersScreen which can be modified slightly to fit the figma design, so it would probably be better to make use of that instead. I do apologize for not checking in sooner; I did not know that the screen you were assigned was basically the same as the one we already had.

For the VM code, it seems like it doesn't exactly have the functions or states that you might need aside from the goal slider value, so you could either not include it and use placeholders in the UI or try to include the states and functions that make sense for that screen with TODOs for their functionality unless it is straightforward

Also, we should not include the .DS_Store file.

image

horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
LogInButton { viewModel.onSignInWithGoogle() }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be log in or next? I thought the user would login beforehand

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file deleted

private val rootNavigationRepository: RootNavigationRepository,
) : UpliftViewModel<GoalsPromptUiState>(GoalsPromptUiState()) {

private val _goalValue = MutableStateFlow(0f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be part of the UiState?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check UpliftViewModel there should be some function that will allow you to collect the ui state, although we need to update it to be withLifecycle

import javax.inject.Inject

data class GoalsPromptUiState(
val name: String = "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need name and image for this VM? I think this is just for the goal setting screen? You don't have to include the vm code in this PR per se until you work on it, but the states should match that which may be used in the screen


@HiltViewModel
class GoalsPromptViewModel @Inject constructor(
private val userInfoRepository: UserInfoRepository,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense to include userInfoRepository until you know you need to use its functions?

navigateToHome()
}

fun onSignInWithGoogle() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the goal setting screen should probably just be next and not log in


@Composable
private fun SkipButton(onClick: () -> Unit) {
fun SkipButton(onClick: () -> Unit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we are unprivating, we should probably just separate to another file in components since it will not just be used for sign in prompt screen

@Preview(showBackground = true)
@Composable
fun GoalPromptScreenPreview() {
var sliderVal by remember { mutableFloatStateOf(0f) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This var is not used

import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.credentials.Credential
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is unused.

@isiahpwilliams
Copy link
Author

I took account of your changes to reuse an old screen which I did. I was successfully able to add the networking logic to enable a user to set a goal during the onboarding process, which I tested using my own account. Also removed some unused imports and deleted unused files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants