Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Remove suspend modifier from getCapabilitiesFor
Browse files Browse the repository at this point in the history
  • Loading branch information
boswelja committed Apr 22, 2021
1 parent 7947855 commit ba8da02
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface PlatformConnectionHandler {
* @param watchId See [Watch.platformId].
* @return A [Flow] of capability strings declared by the watch.
*/
suspend fun getCapabilitiesFor(watchId: String): Flow<String>
fun getCapabilitiesFor(watchId: String): Flow<String>

/**
* Send a message to a watch with the given ID. Note that a successful response doesn't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class WatchConnectionClient(
* @param watch See [Watch].
* @return A [Flow] of capability strings declared by the watch.
*/
suspend fun getCapabilitiesFor(watch: Watch): Flow<String>? {
fun getCapabilitiesFor(watch: Watch): Flow<String>? {
return connectionHandlers[watch.platform]?.getCapabilitiesFor(watch.platformId)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class TizenConnectionHandler internal constructor(
override fun watchesWithApp(): Flow<Watch> = allWatches()

@ExperimentalCoroutinesApi
override suspend fun getCapabilitiesFor(watchId: String): Flow<String> {
override fun getCapabilitiesFor(watchId: String): Flow<String> {
var flow = capabilityMap[watchId]
if (flow == null) {
// Flow doesn't already exist, create a new one
Expand All @@ -132,7 +132,9 @@ class TizenConnectionHandler internal constructor(
}

// Request capability stream
sendMessage(watchId, CAPABILITY_MESSAGE)
coroutineScope.launch(Dispatchers.IO + capabilityJob) {
sendMessage(watchId, CAPABILITY_MESSAGE)
}

return flow.mapNotNull { it }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class WearOSConnectionHandler internal constructor(
}
}

override suspend fun getCapabilitiesFor(watchId: String): Flow<String> = flow {
override fun getCapabilitiesFor(watchId: String): Flow<String> = flow {
// Get all capabilities
val capabilities = capabilityClient
.getAllCapabilities(CapabilityClient.FILTER_REACHABLE).await()
Expand Down

0 comments on commit ba8da02

Please sign in to comment.