ground-android
ground-android copied to clipboard
[Code health] Fixes and cleanup of `LocalMutationSyncWorker`
Code health improvements which came up while fixing #2129:
Recommended:
- [ ] Warn and ignore mutations not belonging to current signed in user (#2237)
- [ ] Wrap
remoteDataStore.applyMutationsinMutationRepository - [x] #2236
Nice to have:
- [ ] Log an error if "create" submissions were enqueued after "edit" submissions
- [ ] Replace
MutationRepository.markAs..methods withsaveMutationsLocallyand helper onMutation - [ ] Improve naming of
finalizePendingMutationsForMediaUpload()andfinalizeDeletions() - [ ] Only call
enqueueSyncWorker()if media uploads are pending for this LOI - [ ] Extract business logic into
UserDataUploadUseCase - [ ] Move
getPendingOrEligibleFailedMutations()into repository (#2237)
Not needed:
- ~Stop marking all mutations for an LOI as
IN_PROGRESSat once. Instead, process each mutation individually, and setIN_PROGRESSbefore actually processing.~- We do this because we process mutations in batch.
- ~Abort updates to this LOI if any mutations were unsuccessful~
- Mutations are applied as a batch write, which are atomic.
@scolsen Breaking these out so we can keep moving forward
https://github.com/google/ground-android/pull/2237 will take care of:
Warn and ignore mutations not belonging to current signed in user Move getPendingOrEligibleFailedMutations() into repository