Skip to content

Commit

Permalink
Revert the #94 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
viakunin committed May 17, 2024
1 parent 6c959c2 commit ae5d482
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 ae5d482

Please sign in to comment.