Skip to content

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

Merged
sbakhtiarov merged 4 commits into
developfrom
feat/pending-messages-service
Jul 28, 2026
Merged

feat: foreground service for sending pending messages (WPB-26422)#4971
sbakhtiarov merged 4 commits 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 2 times, most recently from 3e5917a to d2ec791 Compare June 16, 2026 09:58
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.14583% with 113 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.78%. Comparing base (aa9cff3) to head (67bcc53).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...droid/services/PendingMessagesForegroundService.kt 32.55% 86 Missing and 1 partial ⚠️
...tion/broadcastreceivers/DynamicReceiversManager.kt 0.00% 22 Missing ⚠️
...otlin/com/wire/android/services/ServicesManager.kt 33.33% 2 Missing ⚠️
...ire/android/util/lifecycle/SyncLifecycleManager.kt 92.30% 1 Missing ⚠️
...wire/android/notification/NotificationConstants.kt 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (41.14%) 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    49.81%   49.78%   -0.03%     
===========================================
  Files          665      667       +2     
  Lines        24139    24316     +177     
  Branches      3755     3775      +20     
===========================================
+ Hits         12025    12106      +81     
- Misses       10985    11081      +96     
  Partials      1129     1129              
Files with missing lines Coverage Δ
.../kotlin/com/wire/android/GlobalObserversManager.kt 92.10% <100.00%> (+2.45%) ⬆️
...dcastreceivers/PendingMessagesScheduledReceiver.kt 100.00% <100.00%> (ø)
...ire/android/util/lifecycle/SyncLifecycleManager.kt 95.16% <92.30%> (+10.25%) ⬆️
...wire/android/notification/NotificationConstants.kt 17.39% <0.00%> (-0.80%) ⬇️
...otlin/com/wire/android/services/ServicesManager.kt 72.72% <33.33%> (-2.28%) ⬇️
...tion/broadcastreceivers/DynamicReceiversManager.kt 0.00% <0.00%> (ø)
...droid/services/PendingMessagesForegroundService.kt 32.55% <32.55%> (ø)

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 aa9cff3...67bcc53. Read the comment docs.

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

Comment thread app/src/main/kotlin/com/wire/android/services/PendingMessagesForegroundService.kt Outdated
Comment thread app/src/main/kotlin/com/wire/android/services/PendingMessagesForegroundService.kt Outdated
@sbakhtiarov
sbakhtiarov force-pushed the feat/pending-messages-service branch from d2ec791 to c78640a Compare June 23, 2026 14:25
@github-actions

Copy link
Copy Markdown
Contributor

@sbakhtiarov looks like you are rolling back kalium to a previous commitish.

This means that the PR's target branch (develop) is using a newer version of Kalium, and the changes in this PR will rollback Kalium to an older version.

develop This PR
56eda02b2af8c135318272348bc48af40d71815f 09ea2aeceaf73b8d0f4934722890f60bc1c3f94d

Is this intentional?

@sbakhtiarov
sbakhtiarov requested a review from saleniuk June 24, 2026 10:55
@sonarqubecloud

Copy link
Copy Markdown

@sbakhtiarov
sbakhtiarov requested a review from Garzas June 26, 2026 10:49
@sbakhtiarov
sbakhtiarov force-pushed the feat/pending-messages-service branch from 77e7efa to 67bcc53 Compare July 28, 2026 11:40
@sbakhtiarov
sbakhtiarov added this pull request to the merge queue Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

2 140 tests  +30   2 140 ✅ +30   1m 51s ⏱️ ±0s
  233 suites + 4       0 💤 ± 0 
  233 files   + 4       0 ❌ ± 0 

Results for commit 67bcc53. ± Comparison against base commit 7dadd23.

@github-actions

Copy link
Copy Markdown
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

Merged via the queue into develop with commit bd78c7b Jul 28, 2026
22 checks passed
@sbakhtiarov
sbakhtiarov deleted the feat/pending-messages-service branch July 28, 2026 12:23
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.

3 participants