Adjust coroutine scope default dispatchers
This commit is contained in:
parent
d031003845
commit
a71efdf4b2
@ -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)
|
||||
|
||||
@ -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())
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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()
|
||||
)
|
||||
|
||||
@ -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()) {
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user