Closed blonsky95 closed 4 years ago
Can work on this when UI stuck - just send exercises individually or in group, just like post and get, create a section called exportable exercises and then subcollection of users that have access to it? and try and get them/investigate observables or checks to do this, from another device
For now go ot exercise creator and put a button when in read mode that opens a dialog, and thats the user you want to send it to (the current exercise)
will update thsi when have a working version which is now, on paper
NEXT - fix issue with registering
Registering is now fixed
alrighty boy this is working, but there is a little thingy to be learnt here:
Right now the way UI is being updated is, there is a service bounded to the activity which listen to the firestore db, the listener sets a value to the live data, which is being observed from the activity thanks to the Binder which gives me access to variables in the service.
This is not architecturally right, ideally ui is updated from view model live data, which gets from repo, so ideally I would have to start the value of the received exercises in repo in one of 2 ways:
Injecting repository instance with DI in the service so I can put the value there
repository listening and doing all the actions but I dont think this is good idea, its not an API, nor a service so it shouldn't be performing those kinds of actions in the background.
So probably 1 is better, now im jumping a couple of stages in the control flow and directly fetching from service.
Im thinking something like using a firestore db, and when user preses refresh or something it checks on that table - then upgrade this to a cloud function that sends notification when this db is changed - or use observers(?)