dave08
03/15/2018, 1:37 PMsuspendCancellableCoroutine
in the right place then... This is where we call it:
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
}