EdricChan03 / EdricChan03/androidx-ktx-extras

[New Library] AndroidX WorkManager extensions

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
api request enhancement library request
Dominant language
Kotlin
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

[AndroidX WorkManager](https://developer.android.com/jetpack/androidx/releases/work) currently does have a KTX module, but it doesn't provide a lot of utilities :/

## API suggestions

* [ ] WorkInfo methods which return a [`Flow`](https://kotlinlang.org/docs/flow.html) instead of [`LiveData`](https://developer.android.com/topic/libraries/architecture/livedata) (note: [2.9.0-alpha01](https://developer.android.com/jetpack/androidx/releases/work#2.9.0-alpha01) already offers such a feature, so we should provide a backwards-compatible Kotlin extension that emulates the 2.9.0-alpha01 methods on <=2.8.0)
* [ ] #4

```kotlin
val workData = buildData {
// Perhaps we can have similar utilities to that of a MutableMap?
this += "key" to 123
this += workDataOf(/* ... */) // Add existing data
addData {
// Add data from a Data.Builder
putBoolean("abc", false)
}

this -= workDataOf(/* ... */) // Remove the mutable data's properties that are present in the specified Data
}
```
* [ ] Add `suspend` methods for methods that return a [`LiveData`](https://developer.android.com/topic/libraries/architecture/livedata)
* [ ] Add worker request methods that accept a [`java.time.Duration`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html)/[`kotlin.time.Duration`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.time/-duration/) instead of a `Long` + `TimeUnit`
* [ ] Add top-level methods to create anonymous objects of interfaces (for e.g. [`RunnableScheduler`](https://developer.android.com/reference/kotlin/androidx/work/RunnableScheduler))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.