wrapping the Dispatcher.IO and making it injectable for testing
This commit is contained in:
parent
cde6e8cc1b
commit
e6eb86538f
|
@ -26,6 +26,7 @@ import im.vector.app.EmojiCompatFontProvider
|
|||
import im.vector.app.EmojiCompatWrapper
|
||||
import im.vector.app.VectorApplication
|
||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
||||
import im.vector.app.core.error.ErrorFormatter
|
||||
import im.vector.app.core.network.WifiDetector
|
||||
import im.vector.app.core.pushers.PushersManager
|
||||
|
@ -171,6 +172,8 @@ interface VectorComponent {
|
|||
|
||||
fun appCoroutineScope(): CoroutineScope
|
||||
|
||||
fun coroutineDispatchers(): CoroutineDispatchers
|
||||
|
||||
fun jitsiActiveConferenceHolder(): JitsiActiveConferenceHolder
|
||||
|
||||
@Component.Factory
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.content.res.Resources
|
|||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
||||
import im.vector.app.core.error.DefaultErrorFormatter
|
||||
import im.vector.app.core.error.ErrorFormatter
|
||||
import im.vector.app.features.invite.AutoAcceptInvites
|
||||
|
@ -33,6 +34,7 @@ import im.vector.app.features.pin.PinCodeStore
|
|||
import im.vector.app.features.pin.SharedPrefPinCodeStore
|
||||
import im.vector.app.features.ui.SharedPreferencesUiStateRepository
|
||||
import im.vector.app.features.ui.UiStateRepository
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
|
@ -105,6 +107,12 @@ abstract class VectorModule {
|
|||
fun providesApplicationCoroutineScope(): CoroutineScope {
|
||||
return CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@JvmStatic
|
||||
fun providesCoroutineDispatchers(): CoroutineDispatchers {
|
||||
return CoroutineDispatchers(io = Dispatchers.IO)
|
||||
}
|
||||
}
|
||||
|
||||
@Binds
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2021 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.core.dispatchers
|
||||
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import javax.inject.Inject
|
||||
|
||||
data class CoroutineDispatchers @Inject constructor(val io: CoroutineDispatcher)
|
Loading…
Reference in New Issue