Closed blonsky95 closed 4 years ago
Wait for days to be sendable between users, aka also stored online
So, because the fragment can call methods from parent activity, and thus the exerciseViewerViewModel instance, I will use a fragment, look up example/video on how to do fragment stuff
In Store add a home button on the top bar like every other role
To update the last online backup text, I needed an observer so I added the profile view model to the back up fragment. It is observing the time value, which is being observed through firestore through a snapshot too. (Observing an observer lol).
The Profile is observing the loading boolean in the repository so when user presses upload or download the dialog pops up. dialog pops up in the activity, not the fragment, as the fragment can be undisplayed or whatever. Thanks to the interface being built in the activity and not the fragment, it can call the isloading from the same viewmodel instance so easier to handle.
Next - test if I can do something from fragment to viewmodel and if the activity sharing the isntance gets it - answer is NO, view models are instantiated multiple times, so i created the profilefragmentviewmodel with only one method so it doesnt have to load all the other shite. However if this is the case it makes more sense that the upload and download functions & logic are contained in the Profile activity and in its view model instead of the more UI specific fragment
the fragment only uses the viewmodel to observe, actually a snapshot of the time of last upload to update the text. The progress dialog that shows is actually being displayed in the activity, and being observed, so its in the activityviewmodel
next next = animation for fragment to slide up
Animation should be done - test and see - if works commit everything
Finito! Made a little modification to onBackPressed on Profile, as it closes the fragment, so it also switches the isFragmentOpen boolean to false
So add a button in Exercise Viewer that takes you here - is this going to be activity or a fragment? I think the ExerciseViewerViewModel has the functions to do backup stuff so I would like to reuse it.