File tree Expand file tree Collapse file tree 6 files changed +49
-38
lines changed
shared/src/main/java/com/zrcoding/shared Expand file tree Collapse file tree 6 files changed +49
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- package com.zrcoding.shared.di
1
+ package com.zrcoding.shared.data. di
2
2
3
3
import android.content.Context
4
4
import androidx.room.Room
Original file line number Diff line number Diff line change
1
+ package com.zrcoding.shared.data.di
2
+
3
+ import dagger.Module
4
+ import dagger.Provides
5
+ import dagger.hilt.InstallIn
6
+ import dagger.hilt.components.SingletonComponent
7
+ import kotlinx.coroutines.CoroutineDispatcher
8
+ import kotlinx.coroutines.Dispatchers
9
+
10
+ @InstallIn(SingletonComponent ::class )
11
+ @Module
12
+ object CoroutinesModule {
13
+
14
+ @DefaultDispatcher
15
+ @Provides
16
+ fun providesDefaultDispatcher (): CoroutineDispatcher = Dispatchers .Default
17
+
18
+ @IoDispatcher
19
+ @Provides
20
+ fun providesIoDispatcher (): CoroutineDispatcher = Dispatchers .IO
21
+
22
+ @MainDispatcher
23
+ @Provides
24
+ fun providesMainDispatcher (): CoroutineDispatcher = Dispatchers .Main
25
+
26
+ @MainImmediateDispatcher
27
+ @Provides
28
+ fun providesMainImmediateDispatcher (): CoroutineDispatcher = Dispatchers .Main .immediate
29
+ }
Original file line number Diff line number Diff line change
1
+ package com.zrcoding.shared.data.di
2
+
3
+ import javax.inject.Qualifier
4
+
5
+ @Retention(AnnotationRetention .BINARY )
6
+ @Qualifier
7
+ annotation class DefaultDispatcher
8
+
9
+ @Retention(AnnotationRetention .BINARY )
10
+ @Qualifier
11
+ annotation class IoDispatcher
12
+
13
+ @Retention(AnnotationRetention .BINARY )
14
+ @Qualifier
15
+ annotation class MainDispatcher
16
+
17
+ @Retention(AnnotationRetention .BINARY )
18
+ @Qualifier
19
+ annotation class MainImmediateDispatcher
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments