pandyah5 / TorontoArmour

A mobile application to alert the user when they enter unsafe areas of Toronto.
0 stars 0 forks source link

Add functionality to refresh button. #12

Closed pandyah5 closed 1 year ago

pandyah5 commented 1 year ago

Hitting refresh should update the users live location and alter the safety message accordingly

pandyah5 commented 1 year ago

This is much more complicated than I initially believed. Our current code has a lot of side-effects and the location data is not tracked/remembered. Hence, when we change configuration/activity/refresh the screen, the new location data is NOT propagated to the UI.

PS: The old method of using XML could have easily solved our need but hey the compose method is like a bitter pill that is good for long-term maintenance 🥲

pandyah5 commented 1 year ago

Upon doing some googling and watching tutorials, I have come up with the following plan:

pandyah5 commented 1 year ago

Source for more info on viewModels:

pandyah5 commented 1 year ago

The resolution is as follows:

pandyah5 commented 1 year ago

Fixed in 89481241c777a8b6764e2f92476fc395edcc3831