Adjust coroutine scope default dispatchers

This commit is contained in:
MM20 2022-01-17 00:10:23 +01:00
parent d031003845
commit a71efdf4b2
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
10 changed files with 10 additions and 10 deletions

View File

@ -28,7 +28,7 @@ interface AccountsRepository {
internal class AccountsRepositoryImpl(
private val context: Context
) : AccountsRepository {
private val scope = CoroutineScope(Job() + Dispatchers.Main)
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private val googleApiHelper = GoogleApiHelper.getInstance(context)
private val msGraphApiHelper = MicrosoftGraphApiHelper.getInstance(context)

View File

@ -20,7 +20,7 @@ interface BadgeRepository {
internal class BadgeRepositoryImpl(private val context: Context) : BadgeRepository, KoinComponent {
private val dataStore: LauncherDataStore by inject()
private val scope = CoroutineScope(Dispatchers.Main + Job())
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private val badgeProviders = MutableStateFlow<List<BadgeProvider>>(emptyList())

View File

@ -36,7 +36,7 @@ class FavoritesRepositoryImpl(
private val database: AppDatabase
) : FavoritesRepository, KoinComponent {
private val scope = CoroutineScope(Dispatchers.Main + Job())
private val scope = CoroutineScope(Job() + Dispatchers.Default)
override fun getFavorites(): Flow<List<Searchable>> = channelFlow {

View File

@ -20,7 +20,7 @@ import kotlinx.coroutines.launch
*/
class HiddenItemsRepository(val context: Context, database: AppDatabase) {
val scope = CoroutineScope(Job() + Dispatchers.Main)
val scope = CoroutineScope(Job() + Dispatchers.Default)
val hiddenItemsKeys = MutableStateFlow<List<String>>(emptyList())
init {

View File

@ -24,7 +24,7 @@ class IconRepository(
}
}
private val scope = CoroutineScope(Job() + Dispatchers.Main)
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private val cache = LruCache<String, LauncherIcon>(200)

View File

@ -52,7 +52,7 @@ class MusicRepositoryImpl(
private val notificationRepository: NotificationRepository
) : MusicRepository, KoinComponent {
private val scope = CoroutineScope(Job() + Dispatchers.Main)
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private val dataStore: LauncherDataStore by inject()
override val playbackState = MutableStateFlow(PlaybackState.Stopped)

View File

@ -32,7 +32,7 @@ interface NotificationRepository {
}
internal class NotificationRepositoryImpl() : NotificationRepository {
private val scope = CoroutineScope(Job() + Dispatchers.Main)
private val scope = CoroutineScope(Job() + Dispatchers.Default)
override val notifications: MutableStateFlow<List<StatusBarNotification>> = MutableStateFlow(
emptyList()
)

View File

@ -23,7 +23,7 @@ class WebsearchRepositoryImpl(
private val dataStore: LauncherDataStore by inject()
private val scope = CoroutineScope(Job() + Dispatchers.Main)
private val scope = CoroutineScope(Job() + Dispatchers.Default)
override fun search(query: String): Flow<List<Websearch>> = channelFlow {
if (query.isEmpty()) {

View File

@ -49,7 +49,7 @@ class WeatherRepositoryImpl(
private val dataStore: LauncherDataStore,
) : WeatherRepository, KoinComponent {
private val scope = CoroutineScope(Dispatchers.Main + Job())
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private var provider: WeatherProvider<out WeatherLocation>

View File

@ -22,7 +22,7 @@ class WikipediaRepositoryImpl(
private val context: Context
) : WikipediaRepository, KoinComponent {
private val scope = CoroutineScope(Dispatchers.Main + Job())
private val scope = CoroutineScope(Job() + Dispatchers.Default)
private val dataStore: LauncherDataStore by inject()