Skip to content

feat: foreground service for sending pending messages (WPB-26422)#4971

Open
sbakhtiarov wants to merge 1 commit into
developfrom
feat/pending-messages-service
Open

feat: foreground service for sending pending messages (WPB-26422)#4971
sbakhtiarov wants to merge 1 commit into
developfrom
feat/pending-messages-service

Conversation

@sbakhtiarov

@sbakhtiarov sbakhtiarov commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-26422

https://wearezeta.atlassian.net/browse/WPB-26422

What's new in this PR?

Issues

Current solution for sending pending messages after restoring Internet connection does not work when application is not in opened by user.

Causes (Optional)

Caused by recent Android restrictions for background work:

  • WorkManager work started when the application is in background is not allowed call setForeground.
  • Without "setForeground" call the work cannot make network calls.

Solutions

Use foreground service which is waiting for connection and retry sending pending messages.

@pull-request-size

Copy link
Copy Markdown

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@sbakhtiarov sbakhtiarov force-pushed the feat/pending-messages-service branch from 3e5917a to d2ec791 Compare June 16, 2026 09:58
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.31579% with 121 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.68%. Comparing base (3f2dceb) to head (d2ec791).

Files with missing lines Patch % Lines
...droid/services/PendingMessagesForegroundService.kt 23.96% 92 Missing ⚠️
...tion/broadcastreceivers/DynamicReceiversManager.kt 0.00% 22 Missing ⚠️
...otlin/com/wire/android/services/ServicesManager.kt 0.00% 4 Missing ⚠️
...dcastreceivers/PendingMessagesScheduledReceiver.kt 91.66% 0 Missing and 1 partial ⚠️
...ire/android/util/lifecycle/SyncLifecycleManager.kt 91.66% 1 Missing ⚠️
...wire/android/notification/NotificationConstants.kt 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (36.31%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4971      +/-   ##
===========================================
- Coverage    48.76%   48.68%   -0.09%     
===========================================
  Files          644      646       +2     
  Lines        23145    23319     +174     
  Branches      3545     3568      +23     
===========================================
+ Hits         11287    11353      +66     
- Misses       10809    10917     +108     
  Partials      1049     1049              
Files with missing lines Coverage Δ
.../kotlin/com/wire/android/GlobalObserversManager.kt 92.10% <100.00%> (+2.45%) ⬆️
...dcastreceivers/PendingMessagesScheduledReceiver.kt 91.66% <91.66%> (ø)
...ire/android/util/lifecycle/SyncLifecycleManager.kt 92.68% <91.66%> (+4.44%) ⬆️
...wire/android/notification/NotificationConstants.kt 17.39% <0.00%> (-0.80%) ⬇️
...otlin/com/wire/android/services/ServicesManager.kt 69.64% <0.00%> (-5.36%) ⬇️
...tion/broadcastreceivers/DynamicReceiversManager.kt 0.00% <0.00%> (ø)
...droid/services/PendingMessagesForegroundService.kt 23.96% <23.96%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f2dceb...d2ec791. Read the comment docs.

🚀 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant