google / google/ground-android
[Code health] Fixes and cleanup of `LocalMutationSyncWorker`
- Dominant language
- Kotlin
- Stars
- 293
- Forks
- 149
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 42
Description
Code health improvements which came up while fixing #2129:
Recommended:
- [ ] Warn and ignore mutations not belonging to current signed in user (#2237)
- [ ] Wrap `remoteDataStore.applyMutations` in `MutationRepository`
- [x] #2236
Nice to have:
- [ ] Log an error if "create" submissions were enqueued after "edit" submissions
- [ ] Replace `MutationRepository.markAs..` methods with `saveMutationsLocally` and helper on `Mutation`
- [ ] Improve naming of `finalizePendingMutationsForMediaUpload()` and `finalizeDeletions()`
- [ ] 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_PROGRESS` at once. Instead, process each mutation individually, and set `IN_PROGRESS` before 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
Contributor guide
Assessment
This issue has not been assessed yet.