Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implementation of installOnNode for phones #1993

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.google.android.horologist.annotations.ExperimentalHorologistApi
import com.google.android.horologist.data.AppHelperResultCode
import com.google.android.horologist.data.WearDataLayerRegistry
import com.google.android.horologist.data.apphelper.DataLayerAppHelper
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.tasks.await

/**
Expand All @@ -47,20 +46,6 @@ public class PhoneDataLayerAppHelper(
.addCategory(Intent.CATEGORY_BROWSABLE)
.setData(Uri.parse(playStoreUri))

val availabilityStatus = remoteActivityHelper.availabilityStatus.first()

// As per documentation, calls should be made when status is either STATUS_AVAILABLE
// or STATUS_UNKNOWN.
when (availabilityStatus) {
RemoteActivityHelper.STATUS_UNAVAILABLE -> {
return AppHelperResultCode.APP_HELPER_RESULT_UNAVAILABLE
}

RemoteActivityHelper.STATUS_TEMPORARILY_UNAVAILABLE -> {
return AppHelperResultCode.APP_HELPER_RESULT_TEMPORARILY_UNAVAILABLE
}
}

try {
remoteActivityHelper.startRemoteActivity(intent, nodeId).await()
} catch (e: RemoteActivityHelper.RemoteIntentException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public class WearDataLayerAppHelper(

val availabilityStatus = remoteActivityHelper.availabilityStatus.first()

// As per documentation, calls should be made when status is either STATUS_AVAILABLE
// or STATUS_UNKNOWN.
when (availabilityStatus) {
RemoteActivityHelper.STATUS_UNAVAILABLE -> {
return AppHelperResultCode.APP_HELPER_RESULT_UNAVAILABLE
Expand Down