Skip to content

Conversation

@vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Dec 18, 2025

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


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

If a user puts the app in the background whilst doing Slow Sync after logging in, Sync doesn't continue.

Causes

Android OS will say "Stop it, please - Or deal with the consequences".

Solutions

Take advantage of the new :work module within Kalium, which exposes Initial Sync works.

  1. Whenever a Initial Sync work starts for any user
  2. Launch a Expedited worker, which will
  3. Monitor until all user accounts are with Work.InitialSync complete.

Modularisation

I thought of going ahead and making this monitor + worker in a module.
This required some extra modularisation, like moving Notification, DI and Media stuff to :core, so I did the lifting there too.

Dependencies

Needs releases with:

Testing

Test Coverage

  • I have added automated test to this contribution

How to Test

Login in the app, or use the debug settings to "Force sync" :)

A Setting up Wire... notification will appear if the WorkManager decides a ForegroundService is needed (Android 11 or older).

image

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@vitorhugods vitorhugods force-pushed the sync/chore/add-background-work-monitoring branch 4 times, most recently from b1c51c2 to 108fbfe Compare December 22, 2025 11:55
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 2.53165% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.46%. Comparing base (8f5af5c) to head (85901d8).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
.../kotlin/com/wire/android/sync/InitialSyncWorker.kt 0.00% 43 Missing ⚠️
...in/com/wire/android/sync/MonitorSyncWorkUseCase.kt 0.00% 16 Missing ⚠️
...re/android/notification/CallNotificationManager.kt 0.00% 4 Missing ⚠️
...c/main/kotlin/com/wire/android/media/PingRinger.kt 0.00% 3 Missing ⚠️
...android/notification/MessageNotificationManager.kt 0.00% 2 Missing ⚠️
...otlin/com/wire/android/ui/WireActivityViewModel.kt 50.00% 2 Missing ⚠️
.../com/wire/android/workmanager/WireWorkerFactory.kt 0.00% 2 Missing ⚠️
...ire/android/services/PlayingAudioMessageService.kt 0.00% 1 Missing ⚠️
...id/workmanager/worker/AssetUploadObserverWorker.kt 0.00% 1 Missing ⚠️
...kmanager/worker/DeleteConversationLocallyWorker.kt 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4490      +/-   ##
===========================================
- Coverage    48.60%   48.46%   -0.14%     
===========================================
  Files          573      575       +2     
  Lines        19743    19803      +60     
  Branches      3307     3313       +6     
===========================================
+ Hits          9596     9598       +2     
- Misses        9132     9190      +58     
  Partials      1015     1015              
Files with missing lines Coverage Δ
...nager/WireForegroundNotificationDetailsProvider.kt 0.00% <ø> (ø)
...ndroid/notification/NotificationChannelsManager.kt 0.99% <ø> (ø)
...wire/android/notification/NotificationConstants.kt 9.09% <ø> (ø)
...ire/android/services/PlayingAudioMessageService.kt 0.00% <0.00%> (ø)
...id/workmanager/worker/AssetUploadObserverWorker.kt 0.00% <0.00%> (ø)
...kmanager/worker/DeleteConversationLocallyWorker.kt 1.92% <0.00%> (ø)
...roid/workmanager/worker/NotificationFetchWorker.kt 0.00% <0.00%> (ø)
...rkmanager/worker/PersistentWebsocketCheckWorker.kt 29.41% <0.00%> (ø)
...android/notification/MessageNotificationManager.kt 0.00% <0.00%> (ø)
...otlin/com/wire/android/ui/WireActivityViewModel.kt 75.00% <50.00%> (+0.16%) ⬆️
... and 5 more

Continue to review full report in Codecov by Sentry.

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

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

@vitorhugods vitorhugods requested review from Garzas, MohamadJaara, sbakhtiarov and yamilmedina and removed request for sbakhtiarov December 22, 2025 12:20
Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🚀 ! Finally some DI module. Left a comment for the koverage since otherwise tests for this module won't run on the pipeline (like the case we had with :cells) 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add this new module to the config for crowdin.yml 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could automate this somehow...

I am thinking of using Gradle to detect dependencies and automagically add these entries to crowdin.yml during project configuration or similar.

Making modules easy to create / friction-less is probably the most important step towards promoting modularity.

The dream would be having just:

plugins {
    id(libs.plugins.wire.android.library.get().pluginId)
}

[...] and the module is created. No need to do any more work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it :P

Now we just need to create them modules. They are added automagically as we build. Hard to miss now.

@vitorhugods vitorhugods force-pushed the sync/chore/add-background-work-monitoring branch from ecf3414 to 85901d8 Compare January 20, 2026 16:13
@sonarqubecloud
Copy link

@vitorhugods vitorhugods added this pull request to the merge queue Jan 20, 2026
Merged via the queue into develop with commit 20153ef Jan 20, 2026
15 of 17 checks passed
@vitorhugods vitorhugods deleted the sync/chore/add-background-work-monitoring branch January 20, 2026 16:42
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.

5 participants