Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ForegroundService API, and other extensions, needed for copy-free-upload #305

Merged
merged 12 commits into from
Mar 5, 2025

Conversation

LouisCAD
Copy link
Contributor

@LouisCAD LouisCAD commented Mar 4, 2025

Needed for Infomaniak/android-SwissTransfer#449

Adds:

  1. ForegroundService API
  2. cancellable() extension for kotlin.Result, to avoid eating CancellationException easily
  3. withPartialWakeLock { … } to prevent the device from sleeping in a given scope (instead of the entire worker's scope like WorkManager would do)
  4. mapSync to map a StateFlow to another StateFlow.
  5. collectAsStateIn(…) extensions Flow and StateFlow to be used outside of composable functions (e.g. with snapshotFlow { … }

This PR also suppresses a useless and unfixable deprecation warning in NetworkAvailability.kt.

LouisCAD added 4 commits March 5, 2025 09:07
Always use startForeground, instead of notify,
even when updating the notification, to ensure
it gets automatically removed by the system when
the service stops.
Copy link

sonarqubecloud bot commented Mar 5, 2025

@LouisCAD LouisCAD merged commit 9f53dd4 into main Mar 5, 2025
5 checks passed
@LouisCAD LouisCAD deleted the result-flow-fgs-wakelock branch March 5, 2025 09:26
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.

2 participants