mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 22:55:46 +03:00
Add coroutineExceptionHandler to UnifiedSearchRemoteRepository
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
2e0d455905
commit
4dd6a6d277
1 changed files with 10 additions and 2 deletions
|
@ -13,6 +13,7 @@ import com.nextcloud.client.network.ClientFactory
|
|||
import com.nextcloud.common.NextcloudClient
|
||||
import com.owncloud.android.lib.common.SearchProviders
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -24,12 +25,19 @@ class UnifiedSearchRemoteRepository(
|
|||
) : IUnifiedSearchRepository {
|
||||
|
||||
private var providers: SearchProviders? = null
|
||||
private val tag = "UnifiedSearchRemoteRepository"
|
||||
|
||||
private fun runAsyncWithNcClient(callback: (client: NextcloudClient) -> Unit) =
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
private fun runAsyncWithNcClient(callback: (client: NextcloudClient) -> Unit) {
|
||||
val coroutineExceptionHandler = CoroutineExceptionHandler { _, exception ->
|
||||
Log_OC.d(tag,"CoroutineExceptionHandler got at runAsyncWithNcClient $exception")
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch(coroutineExceptionHandler) {
|
||||
val client = clientFactory.createNextcloudClient(currentAccountProvider.user)
|
||||
callback(client)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun queryAll(
|
||||
query: String,
|
||||
|
|
Loading…
Reference in a new issue