Closed Zafouche closed 1 week ago
None of the tests have been tampered with as I need opinions on which method we should use.
I will sync this branch with the main
branch.
I ended up simply changing the String
value of the ASSOCIATION_PROFILE
like @oskar-codes suggested and added the helper function the Screen
object. More tests are yet to come.
Failed conditions
66.9% Coverage on New Code (required ≥ 80%)
Not sure what else can be tested. @Romainhir will need the changes done to implement the association profile screen further. Does this look good for you to merge? @oskar-codes @Redd87
Description
MainActivity.kt
.Explore.kt
.findAssociationById
inAssociationViewModel.kt
, which fetches the Association object if it is present in the list of associations.AssociationProfileScaffold
composable inAssociationProfile.kt
, which allows us to either display and errorText
if the association is not found, either the data (for now just the acronym) of the association in the same scaffold.Motivation
This PR implements the method of passing the selected association's uid to the association profile screen using Jetpack Navigation arguments. This approach follows what's explained in this article. This allows us to get the data of the association profile that has to be displayed on the association profile screen (
AssociationProfile.kt
)Considerations
AssociationViewModel
: I wrote a helper function within the view model to fetch the data with the association's uid. However, I am not sure about this approach. Say the user refreshed the page, we would need to re-call the function and convert theval association
to avar
. This feels unnecessary as it would change automatically if we used a state flow in the view model.MutableStateFlow
list present in its view model (which we have in our association view model), and the data can be fetched through anotherMutableStateFlow
, whereselectToDo
stores the item from theMutableStateFlow
list. Now I am not sure about it as I need to do research on it, but would theselectedToDo
MutableStateFlow
update itself if theMutableStateFlow
list is updated? This could happen in the scenario of when the user was offline and gains back connectivity. This can seem far fetched, but the automatic update could be useful.Note
You cannot yet play around with it, as the view model is not yet used in the explore screen. I will work on using it on a different PR, and come back to this one, pull the changes on this branch so we can test this by hand as well. Tests are also not yet written as I am not sure this method is better than the one used in the bootcamp.