blonsky95 / DigiCoachAndroid

0 stars 0 forks source link

1.0.7 - craft something to send exercises to other users #55

Closed blonsky95 closed 4 years ago

blonsky95 commented 4 years ago

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(?)

blonsky95 commented 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

blonsky95 commented 4 years ago

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)

blonsky95 commented 4 years ago

will update thsi when have a working version which is now, on paper

blonsky95 commented 4 years ago

NEXT - fix issue with registering

blonsky95 commented 4 years ago

Registering is now fixed

blonsky95 commented 4 years ago
blonsky95 commented 4 years ago

https://stackoverflow.com/questions/6011786/add-new-item-count-to-icon-on-button-android

blonsky95 commented 4 years ago

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:

  1. Injecting repository instance with DI in the service so I can put the value there

  2. 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.