ground-android icon indicating copy to clipboard operation
ground-android copied to clipboard

[Cleanup] Create a worker for location of interest sync

Open shobhitagarwal1612 opened this issue 4 years ago • 9 comments
trafficstars

Constructor of MainViewModel is doing some actual work which is not a recommended pattern. On top of that, it also creates a problem while unit testing the class as we need some extra configuration to ignore the logic in the constructor.

https://github.com/google/ground-android/blob/92cb94d5d7c54fe1e9548814ff9df21d0af33edd/gnd/src/main/java/com/google/android/gnd/MainViewModel.java#L89-L94

The feature syncing should be done using a worker similar to how the mutations are synced.

shobhitagarwal1612 avatar Aug 13 '21 16:08 shobhitagarwal1612

Agreed. The right way to do this would be to create a long-running worker, which requires a notification UI to be shown while it's running in the background (similar to what media players do on Android, for example).

gino-m avatar Aug 13 '21 16:08 gino-m

Related to #1125

gino-m avatar Aug 30 '22 15:08 gino-m

Hi @shobhitagarwal1612 , May I work on this issue?

nikhil6624 avatar Sep 07 '22 12:09 nikhil6624

Hey @nikhil6624! We are currently migrating our codebase to kotlin and have paused feature development at the moment. Would you like to contribute to that?

shobhitagarwal1612 avatar Sep 07 '22 15:09 shobhitagarwal1612

Sure @shobhitagarwal1612 , I would be more than happy to do that! You can allocate me a task/tasks of your choice. I'll give my best to it. :)

nikhil6624 avatar Sep 07 '22 15:09 nikhil6624

This is the common bug for tracking kotling migrations https://github.com/google/ground-android/issues/532

You can pick the following directory which has 3 java classes and try converting to kotlin. https://github.com/google/ground-android/tree/master/ground/src/main/java/com/google/android/ground/persistence/local/room/relations

shobhitagarwal1612 avatar Sep 07 '22 15:09 shobhitagarwal1612

Sure. Will start working on these. Thanks for a swift response @shobhitagarwal1612 :)

nikhil6624 avatar Sep 07 '22 15:09 nikhil6624

Please make sure that you've gone through the contribution guidelines before starting with anything. Welcome to the project!

shobhitagarwal1612 avatar Sep 07 '22 15:09 shobhitagarwal1612

I have submitted the CLA by visiting https://cla.developers.google.com/ beforehand. Thanks for inducting me @shobhitagarwal1612 :)

nikhil6624 avatar Sep 07 '22 16:09 nikhil6624

This issue is actually quite complex, since it will require Cloud Messaging to wake up the worker when remote changes have been made. Closing in favor of #1373.

gino-m avatar Dec 27 '22 02:12 gino-m