fix workmanager crashing because of async initialization (#2003)
This commit is contained in:
parent
e0582319a7
commit
781586a009
@ -33,11 +33,9 @@ import com.keylesspalace.tusky.util.EmojiCompatFont
|
|||||||
import com.keylesspalace.tusky.util.LocaleManager
|
import com.keylesspalace.tusky.util.LocaleManager
|
||||||
import com.keylesspalace.tusky.util.ThemeUtils
|
import com.keylesspalace.tusky.util.ThemeUtils
|
||||||
import com.uber.autodispose.AutoDisposePlugins
|
import com.uber.autodispose.AutoDisposePlugins
|
||||||
import dagger.Lazy
|
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.plugins.RxJavaPlugins
|
import io.reactivex.plugins.RxJavaPlugins
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import org.conscrypt.Conscrypt
|
import org.conscrypt.Conscrypt
|
||||||
import java.security.Security
|
import java.security.Security
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -48,7 +46,7 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||||||
lateinit var androidInjector: DispatchingAndroidInjector<Any>
|
lateinit var androidInjector: DispatchingAndroidInjector<Any>
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var notificationWorkerFactory: Lazy<NotificationWorkerFactory>
|
lateinit var notificationWorkerFactory: NotificationWorkerFactory
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
// Uncomment me to get StrictMode violation logs
|
// Uncomment me to get StrictMode violation logs
|
||||||
@ -89,15 +87,12 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||||||
SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.ARGB_8888)
|
SubsamplingScaleImageView.setPreferredBitmapConfig(Bitmap.Config.ARGB_8888)
|
||||||
BigImageViewer.initialize(GlideCustomImageLoader.with(this))
|
BigImageViewer.initialize(GlideCustomImageLoader.with(this))
|
||||||
|
|
||||||
// This will initialize the whole network stack and cache so we don't wan to wait for it
|
WorkManager.initialize(
|
||||||
Schedulers.computation().scheduleDirect {
|
this,
|
||||||
WorkManager.initialize(
|
androidx.work.Configuration.Builder()
|
||||||
this,
|
.setWorkerFactory(notificationWorkerFactory)
|
||||||
androidx.work.Configuration.Builder()
|
.build()
|
||||||
.setWorkerFactory(notificationWorkerFactory.get())
|
)
|
||||||
.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(base: Context) {
|
override fun attachBaseContext(base: Context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user