Will that avoid the closed channel problem? Also I...
# coroutines
d
Will that avoid the closed channel problem? Also I don't think I put
suspendCancellableCoroutine
in the right place then... This is where we call it:
Copy code
suspend fun checkSyncStatus(context: Context): Boolean=
    withTimeout(360){
        val intentChannel = registerBroadcastReceiver(context, IntentFilter("com.domain.actionsync"))

        for (currIntent in intentChannel) {
            Timber.i("--${currIntent.toString()}")
            if(SyncStatus.fromIntent(currIntent) == SyncStatus.COMPLETE_WITH_NO_ERRORS){
                intentChannel.cancel()
                return@withTimeout true
            }

        }

        return@withTimeout false
    }