Adjust coroutine scope default dispatchers
This commit is contained in:
parent
d031003845
commit
a71efdf4b2
@ -28,7 +28,7 @@ interface AccountsRepository {
|
|||||||
internal class AccountsRepositoryImpl(
|
internal class AccountsRepositoryImpl(
|
||||||
private val context: Context
|
private val context: Context
|
||||||
) : AccountsRepository {
|
) : AccountsRepository {
|
||||||
private val scope = CoroutineScope(Job() + Dispatchers.Main)
|
private val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
|
|
||||||
private val googleApiHelper = GoogleApiHelper.getInstance(context)
|
private val googleApiHelper = GoogleApiHelper.getInstance(context)
|
||||||
private val msGraphApiHelper = MicrosoftGraphApiHelper.getInstance(context)
|
private val msGraphApiHelper = MicrosoftGraphApiHelper.getInstance(context)
|
||||||
|
|||||||
@ -20,7 +20,7 @@ interface BadgeRepository {
|
|||||||
internal class BadgeRepositoryImpl(private val context: Context) : BadgeRepository, KoinComponent {
|
internal class BadgeRepositoryImpl(private val context: Context) : BadgeRepository, KoinComponent {
|
||||||
|
|
||||||
private val dataStore: LauncherDataStore by inject()
|
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())
|
private val badgeProviders = MutableStateFlow<List<BadgeProvider>>(emptyList())
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class FavoritesRepositoryImpl(
|
|||||||
private val database: AppDatabase
|
private val database: AppDatabase
|
||||||
) : FavoritesRepository, KoinComponent {
|
) : FavoritesRepository, KoinComponent {
|
||||||
|
|
||||||
private val scope = CoroutineScope(Dispatchers.Main + Job())
|
private val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
|
|
||||||
override fun getFavorites(): Flow<List<Searchable>> = channelFlow {
|
override fun getFavorites(): Flow<List<Searchable>> = channelFlow {
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import kotlinx.coroutines.launch
|
|||||||
*/
|
*/
|
||||||
class HiddenItemsRepository(val context: Context, database: AppDatabase) {
|
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())
|
val hiddenItemsKeys = MutableStateFlow<List<String>>(emptyList())
|
||||||
|
|
||||||
init {
|
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)
|
private val cache = LruCache<String, LauncherIcon>(200)
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class MusicRepositoryImpl(
|
|||||||
private val notificationRepository: NotificationRepository
|
private val notificationRepository: NotificationRepository
|
||||||
) : MusicRepository, KoinComponent {
|
) : MusicRepository, KoinComponent {
|
||||||
|
|
||||||
private val scope = CoroutineScope(Job() + Dispatchers.Main)
|
private val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
private val dataStore: LauncherDataStore by inject()
|
private val dataStore: LauncherDataStore by inject()
|
||||||
|
|
||||||
override val playbackState = MutableStateFlow(PlaybackState.Stopped)
|
override val playbackState = MutableStateFlow(PlaybackState.Stopped)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ interface NotificationRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal class NotificationRepositoryImpl() : 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(
|
override val notifications: MutableStateFlow<List<StatusBarNotification>> = MutableStateFlow(
|
||||||
emptyList()
|
emptyList()
|
||||||
)
|
)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class WebsearchRepositoryImpl(
|
|||||||
|
|
||||||
private val dataStore: LauncherDataStore by inject()
|
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 {
|
override fun search(query: String): Flow<List<Websearch>> = channelFlow {
|
||||||
if (query.isEmpty()) {
|
if (query.isEmpty()) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class WeatherRepositoryImpl(
|
|||||||
private val dataStore: LauncherDataStore,
|
private val dataStore: LauncherDataStore,
|
||||||
) : WeatherRepository, KoinComponent {
|
) : WeatherRepository, KoinComponent {
|
||||||
|
|
||||||
private val scope = CoroutineScope(Dispatchers.Main + Job())
|
private val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
|
|
||||||
private var provider: WeatherProvider<out WeatherLocation>
|
private var provider: WeatherProvider<out WeatherLocation>
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class WikipediaRepositoryImpl(
|
|||||||
private val context: Context
|
private val context: Context
|
||||||
) : WikipediaRepository, KoinComponent {
|
) : WikipediaRepository, KoinComponent {
|
||||||
|
|
||||||
private val scope = CoroutineScope(Dispatchers.Main + Job())
|
private val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
|
|
||||||
private val dataStore: LauncherDataStore by inject()
|
private val dataStore: LauncherDataStore by inject()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user