Closed charliemangano closed 3 weeks ago
@lazarinibruno
I don't know if it is common practice to do so for composables, but maybe adding a brief documentation of what every composable does would be a good idea? Or maybe not, as the names of the composables explain all that needs explanation? What do you think?
I agree! It's a bit outside of the scope of this PR but I'll do it as it's just docs.
@lazarinibruno I re-requested your review as merging from main introduced quite consequent changes in the code
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
82.9% Coverage on New Code
0.0% Duplication on New Code
@lazarinibruno
I don't know if it is common practice to do so for composables, but maybe adding a brief documentation of what every composable does would be a good idea? Or maybe not, as the names of the composables explain all that needs explanation? What do you think?
I agree! It's a bit outside of the scope of this PR but I'll do it as it's just docs.
True! It does not really fit into this PR's goal. Thank you anyways for taking the time and doing it.
Integrate profile VM into Profile screen
Description
This PR introduces syncing between our database and the Profile screen. Now, users can see the data they entered when singing up/editing their profile. It closes issue #160 and part of #154.
Changes
Replaced placeholder values for profile picture, name and description in
Profile
screen with data fetched from the database usingUserViewModel.loadUser()
andUserViewModel.user
. In case of the view model failing to retrieve the user's data, display "Error loading X" instead.Added a
UserViewModel
parameter in theProfileScreen
that is passed from theMainActivity
.Fixed a test tag that was on the wrong component.
Files
Added
None
Modified
app/src/main/java/com/android/periodpals/ui/profile/ProfileScreen.kt
: added syncing with databaseapp/src/main/java/com/android/periodpals/MainActivity.kt
: passed view model parameter in call toProfileScreen
app/src/androidTest/java/com/android/periodpals/ui/profile/ProfileScreenTest.kt
: updated testsRemoved
None
Dependencies Added
None
Testing
Updated the existing tests to mock the user view model. They check the values displayed against those returned by the view model, and test for the view model failure case. Edit: as discussed in the comments with @agonzalez-r, I could not find a way to check the behavior of the profile picture. The
GlideImage
component seems to still be in development so maybe there is actually no way to do it yet.