diff --git a/app/src/main/java/com/readrops/app/MainActivity.kt b/app/src/main/java/com/readrops/app/MainActivity.kt index b5430592..fb4799b5 100644 --- a/app/src/main/java/com/readrops/app/MainActivity.kt +++ b/app/src/main/java/com/readrops/app/MainActivity.kt @@ -37,6 +37,7 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.withContext import org.koin.androidx.compose.KoinAndroidContext import org.koin.core.annotation.KoinExperimentalAPI import org.koin.core.component.KoinComponent @@ -115,12 +116,12 @@ class MainActivity : ComponentActivity(), KoinComponent { override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) - lifecycleScope.launch(Dispatchers.IO) { + lifecycleScope.launch { handleIntent(intent) } } - private suspend fun handleIntent(intent: Intent) { + private suspend fun handleIntent(intent: Intent) = withContext(Dispatchers.IO) { when { intent.hasExtra(SyncWorker.ACCOUNT_ID_KEY) -> { val accountId = intent.getIntExtra(SyncWorker.ACCOUNT_ID_KEY, -1) diff --git a/db/src/main/java/com/readrops/db/dao/ItemDao.kt b/db/src/main/java/com/readrops/db/dao/ItemDao.kt index e86a982f..c1a504d6 100644 --- a/db/src/main/java/com/readrops/db/dao/ItemDao.kt +++ b/db/src/main/java/com/readrops/db/dao/ItemDao.kt @@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.Flow abstract class ItemDao : BaseDao { @Query("Select * From Item Where id = :itemId") - abstract fun select(itemId: Int): Item + abstract suspend fun select(itemId: Int): Item @RawQuery(observedEntities = [Item::class, Feed::class, Folder::class, ItemState::class]) abstract fun selectAll(query: SupportSQLiteQuery): PagingSource