Catch error when wearable API is missing

pull/3054/head
Alex Baker 1 year ago
parent ec2eb15118
commit a289cb80fd

@ -6,6 +6,7 @@ import com.google.android.horologist.data.ProtoDataStoreHelper.protoDataStore
import com.google.android.horologist.data.WearDataLayerRegistry import com.google.android.horologist.data.WearDataLayerRegistry
import com.google.android.horologist.datalayer.phone.PhoneDataLayerAppHelper import com.google.android.horologist.datalayer.phone.PhoneDataLayerAppHelper
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import org.tasks.GrpcProto.LastUpdate import org.tasks.GrpcProto.LastUpdate
@ -24,6 +25,7 @@ class WearRefresherImpl(
init { init {
phoneDataLayerAppHelper phoneDataLayerAppHelper
.connectedAndInstalledNodes .connectedAndInstalledNodes
.catch { Timber.e(it) }
.onEach { nodes -> .onEach { nodes ->
Timber.d("Connected nodes: ${nodes.joinToString()}") Timber.d("Connected nodes: ${nodes.joinToString()}")
watchConnected = nodes.isNotEmpty() watchConnected = nodes.isNotEmpty()

Loading…
Cancel
Save