mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Address repeated initializatin of WorkManagerImpl in #5887
This commit is contained in:
parent
4ced6ca179
commit
8950aa38ea
@ -22,6 +22,8 @@ import android.os.Looper
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.work.Configuration
|
||||
import androidx.work.WorkManager
|
||||
import androidx.work.impl.WorkManagerImpl
|
||||
import androidx.work.impl.utils.taskexecutor.WorkManagerTaskExecutor
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import org.matrix.android.sdk.BuildConfig
|
||||
import org.matrix.android.sdk.api.MatrixConfiguration
|
||||
@ -66,7 +68,12 @@ internal class TestMatrix(context: Context, matrixConfiguration: MatrixConfigura
|
||||
.setExecutor(Executors.newCachedThreadPool())
|
||||
.setWorkerFactory(matrixWorkerFactory)
|
||||
.build()
|
||||
WorkManager.initialize(appContext, configuration)
|
||||
val delegate = WorkManagerImpl(
|
||||
context,
|
||||
configuration,
|
||||
WorkManagerTaskExecutor(configuration.taskExecutor)
|
||||
)
|
||||
WorkManagerImpl.setDelegate(delegate)
|
||||
uiHandler.post {
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(backgroundDetectionObserver)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user