Skip to content

Unsubscribe from survey updates when removing them from the device - #3876

Open
andreia-ferreira wants to merge 8 commits into
masterfrom
andreia/3867/add-unsubscribe-from-topic-calls
Open

Unsubscribe from survey updates when removing them from the device#3876
andreia-ferreira wants to merge 8 commits into
masterfrom
andreia/3867/add-unsubscribe-from-topic-calls

Conversation

@andreia-ferreira

Copy link
Copy Markdown
Collaborator

Towards #3867

In order to reduce the amount of unnecessary reads from Firebase, this PR adds the logic to unsubscribe from survey updates when a user deletes surveys from the device. Currently, even if a user deletes a survey, if this survey has any update from other user, the phone will still receive and react to the FCM and the survey will be silently re-downloaded.

The fix includes:

  • Refactoring RemoveOfflineSurveyUseCase moving it to core:domain. Methods were added to the following interfaces:SurveyRepositoryInterface, RemoteDataStore and MapStateRepositoryInterface in order to allow decoupling the domain logic from the data
  • SurveySyncWorker now skips syncing surveys that are no longer available offline

@shobhitagarwal1612 PTAL?

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.12%. Comparing base (ea42f2d) to head (0b77fda).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3876      +/-   ##
============================================
+ Coverage     68.03%   68.12%   +0.08%     
- Complexity     1883     1888       +5     
============================================
  Files           411      411              
  Lines         10881    10889       +8     
  Branches       1426     1427       +1     
============================================
+ Hits           7403     7418      +15     
+ Misses         2735     2727       -8     
- Partials        743      744       +1     
Files with missing lines Coverage Δ
...oundplatform/android/data/sync/SurveySyncWorker.kt 100.00% <100.00%> (ø)
...dplatform/android/repository/MapStateRepository.kt 100.00% <100.00%> (ø)
...undplatform/android/repository/SurveyRepository.kt 81.08% <100.00%> (-4.64%) ⬇️
...droid/ui/surveyselector/SurveySelectorViewModel.kt 79.34% <ø> (ø)
...main/usecases/survey/RemoveOfflineSurveyUseCase.kt 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant