Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Finalize and improve the aesthetics of the progression UI #234

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,35 @@ class ProgressionTest {
composeTestRule.onNodeWithTag("achievementItem$name").assertIsDisplayed()
}
}

@Test
fun screenDisplayTextOnEmptyWorkoutData() {
val mockedProgression =
Progression(
progressionId = "prog123456",
uid = mockedUser.uid,
currentGoal = Ranks.BRONZE.score,
eventsCreated = 0,
eventsJoined = 0,
achievements = emptyList())

coEvery { progressionRepository.getOrAddProgression(eq(mockedUser.uid)) } answers
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that it has already been done in the file so no need to change, but you should not mix 2 mocking libraries in the same file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I apologize, I did not know that it was bad to do that. Thank you for letting me know!

{
mockedProgression
}

// simulates empty workout data
coEvery { workoutRepository.getOrAddWorkoutData(any()) } answers
{
WorkoutData(userUid = uid, workoutSessions = emptyList())
}

composeTestRule.setContent {
ProgressScreen(navigationActions, userViewModel, progressionViewModel, workoutViewModel)
}

composeTestRule.onNodeWithTag("TrainingTab").performClick()

composeTestRule.onNodeWithTag("emptyTrainingText").assertExists()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,31 @@ enum class MedalsAchievement(val achievement: Achievement, val rank: Ranks) {

BRONZE(
Achievement(
R.drawable.bronze_achievement_icon,
R.drawable.bronze_icon_final,
"Bronze Medal",
listOf("Bronze"),
"You obtained 100 Points!"),
Ranks.BRONZE),
SILVER(
Achievement(
R.drawable.silver_achievement_icon,
R.drawable.silver_icon_final,
"Silver Medal",
listOf("Silver"),
"You obtained 1000 Points!"),
Ranks.SILVER),
GOLD(
Achievement(
R.drawable.gold_achievement_icon,
"Gold Medal",
listOf("Gold"),
"You obtained 10000 Points!"),
R.drawable.gold_icon_final, "Gold Medal", listOf("Gold"), "You obtained 10000 Points!"),
Ranks.GOLD),
PLATINUM(
Achievement(
R.drawable.bronze_achievement_icon,
R.drawable.platinum_icon_final,
"Platinum Medal",
listOf("Platinum"),
"You obtained 100000 Points!"),
Ranks.PLATINUM)
}

/** Represents a type of achievement linked to the performance of the user on different exercises */
enum class ExerciseAchievement(val achievement: Achievement) {
HANDSTAND(Achievement(R.drawable.train_hand_stand, "Handstand", emptyList(), "")),
FRONT_LEVER(Achievement(R.drawable.train_front_lever, "Front Lever", emptyList(), ""))
}

/** Represents a type of achievement linked to the social interactions of the user */
enum class SocialAchievement(val achievement: Achievement, val numberOfFriends: Int) {
SOCIAL1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ fun ProgressScreen(
}
DashboardStateProgression.Training -> {

if (currentWorkout?.workoutSessions.isNullOrEmpty()) {
Text(
text = LocalContext.current.getString(R.string.ProgressionEmptyTraining),
fontSize = 15.sp,
fontWeight = FontWeight.Normal,
color = ColorPalette.SECONDARY_TEXT_COLOR,
modifier = Modifier.padding(top = 10.dp).testTag("emptyTrainingText"))
}
currentWorkout?.workoutSessions?.forEach { workout ->
val date = workout.startTime.toFormattedString()
workout.exercises.forEach {
Expand Down
Binary file added app/src/main/res/drawable/bronze_icon_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/gold_icon_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/platinum_icon_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/silver_icon_final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

// Progression UI
<string name="ProgressionEmptyAchievements">You do not have any achievements yet!</string>
<string name="ProgressionEmptyTraining">You have not trained yet!</string>
<string name="Trained">You trained your %s !</string>

<string name="Pushups">Push-ups</string>
Expand Down
Loading