Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'main' of https://github.com/deliveryhero/whetstone:
  Prepare next development version 0.8.5-SNAPSHOT.
  Update sonatype credentials.
  Prepare next development version.
  Prepare for release.
  [MDEVVEL-9] Update dagger version (deliveryhero#99)
  Prepare next development version.
  Prepare for release 0.8.2.
  Revert the deliveryhero#94 (deliveryhero#98)
  Prepare next development version.
  Prepare for release 0.8.1.
  Return nulls from MultibindingWorkerFactory for non-existent Worker classes instead of throwing exceptions (deliveryhero#96)
  • Loading branch information
msfjarvis committed Aug 29, 2024
2 parents e00be7f + 34d67b2 commit 43fc375
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import androidx.startup.Initializer
import androidx.work.Configuration
import androidx.work.WorkManager
import com.deliveryhero.whetstone.Whetstone
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking

public class WhetstoneWorkerInitializer : Initializer<WorkManager> {

Expand All @@ -23,11 +21,9 @@ public class WhetstoneWorkerInitializer : Initializer<WorkManager> {


private fun Whetstone.installWorkerFactory(application: Application) {
val configuration = runBlocking(Dispatchers.IO) {
val parentComponent = fromApplication<WorkerComponent.ParentComponent>(application)
return@runBlocking Configuration.Builder()
.setWorkerFactory(parentComponent.getWorkerFactory())
.build()
}
val parentComponent = fromApplication<WorkerComponent.ParentComponent>(application)
val configuration = Configuration.Builder()
.setWorkerFactory(parentComponent.getWorkerFactory())
.build()
WorkManager.initialize(application, configuration)
}

0 comments on commit 43fc375

Please sign in to comment.