Skip to content

Commit

Permalink
Merge pull request #39 from SimpleAppProjects/develop
Browse files Browse the repository at this point in the history
v1.14.0-r1
  • Loading branch information
thewizrd committed May 17, 2024
2 parents 727da9d + 0bb58d2 commit abecee7
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion mobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format [TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)]
versionCode 331914040
versionCode 331914050
versionName "1.14.0"

vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MainActivity : AppCompatActivity() {
.runOnCommit {
isReadyToView = true
}
.commit()
.commitAllowingStateLoss()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,8 @@ class MediaControllerService : Service(), MessageClient.OnMessageReceivedListene
JSONParser.serializer(
PositionState(
durationMs,
it.playbackState.position,
it.playbackState.playbackSpeed
it.playbackState?.position ?: 0,
it.playbackState?.playbackSpeed ?: 1f
),
PositionState::class.java
)
Expand Down
2 changes: 1 addition & 1 deletion wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
minSdkVersion 26
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
versionCode 331914041
versionCode 331914051
versionName "1.14.0"

vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,22 @@ class DashboardTileMessenger(private val context: Context) :
val connectedNodes = getConnectedNodes()
mPhoneNodeWithApp = WearableHelper.pickBestNodeId(capabilityInfo.nodes)

if (mPhoneNodeWithApp == null) {
mPhoneNodeWithApp?.let { node ->
if (node.isNearby && connectedNodes.any { it.id == node.id }) {
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} else {
try {
sendPing(node.id)
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} catch (e: ApiException) {
if (e.statusCode == WearableStatusCodes.TARGET_NODE_NOT_CONNECTED) {
tileModel.setConnectionStatus(WearConnectionStatus.DISCONNECTED)
} else {
Logger.writeLine(Log.ERROR, e)
}
}
}
} ?: run {
/*
* If a device is disconnected from the wear network, capable nodes are empty
*
Expand All @@ -163,21 +178,6 @@ class DashboardTileMessenger(private val context: Context) :
WearConnectionStatus.APPNOTINSTALLED
}
)
} else {
if (mPhoneNodeWithApp!!.isNearby && connectedNodes.any { it.id == mPhoneNodeWithApp!!.id }) {
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} else {
try {
sendPing(mPhoneNodeWithApp!!.id)
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} catch (e: ApiException) {
if (e.statusCode == WearableStatusCodes.TARGET_NODE_NOT_CONNECTED) {
tileModel.setConnectionStatus(WearConnectionStatus.DISCONNECTED)
} else {
Logger.writeLine(Log.ERROR, e)
}
}
}
}

requestTileUpdate(context)
Expand All @@ -188,28 +188,12 @@ class DashboardTileMessenger(private val context: Context) :
val connectedNodes = getConnectedNodes()
mPhoneNodeWithApp = checkIfPhoneHasApp()

if (mPhoneNodeWithApp == null) {
/*
* If a device is disconnected from the wear network, capable nodes are empty
*
* No capable nodes can mean the app is not installed on the remote device or the
* device is disconnected.
*
* Verify if we're connected to any nodes; if not, we're truly disconnected
*/
tileModel.setConnectionStatus(
if (connectedNodes.isEmpty()) {
WearConnectionStatus.DISCONNECTED
} else {
WearConnectionStatus.APPNOTINSTALLED
}
)
} else {
if (mPhoneNodeWithApp!!.isNearby && connectedNodes.any { it.id == mPhoneNodeWithApp!!.id }) {
mPhoneNodeWithApp?.let { node ->
if (node.isNearby && connectedNodes.any { it.id == node.id }) {
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} else {
try {
sendPing(mPhoneNodeWithApp!!.id)
sendPing(node.id)
tileModel.setConnectionStatus(
WearConnectionStatus.CONNECTED
)
Expand All @@ -223,6 +207,22 @@ class DashboardTileMessenger(private val context: Context) :
}
}
}
} ?: run {
/*
* If a device is disconnected from the wear network, capable nodes are empty
*
* No capable nodes can mean the app is not installed on the remote device or the
* device is disconnected.
*
* Verify if we're connected to any nodes; if not, we're truly disconnected
*/
tileModel.setConnectionStatus(
if (connectedNodes.isEmpty()) {
WearConnectionStatus.DISCONNECTED
} else {
WearConnectionStatus.APPNOTINSTALLED
}
)
}

if (refreshTile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,28 +367,12 @@ class MediaPlayerTileMessenger(private val context: Context) :
val connectedNodes = getConnectedNodes()
mPhoneNodeWithApp = checkIfPhoneHasApp()

if (mPhoneNodeWithApp == null) {
/*
* If a device is disconnected from the wear network, capable nodes are empty
*
* No capable nodes can mean the app is not installed on the remote device or the
* device is disconnected.
*
* Verify if we're connected to any nodes; if not, we're truly disconnected
*/
tileModel.setConnectionStatus(
if (connectedNodes.isEmpty()) {
WearConnectionStatus.DISCONNECTED
} else {
WearConnectionStatus.APPNOTINSTALLED
}
)
} else {
if (mPhoneNodeWithApp!!.isNearby && connectedNodes.any { it.id == mPhoneNodeWithApp!!.id }) {
mPhoneNodeWithApp?.let { node ->
if (node.isNearby && connectedNodes.any { it.id == node.id }) {
tileModel.setConnectionStatus(WearConnectionStatus.CONNECTED)
} else {
try {
sendPing(mPhoneNodeWithApp!!.id)
sendPing(node.id)
tileModel.setConnectionStatus(
WearConnectionStatus.CONNECTED
)
Expand All @@ -402,6 +386,22 @@ class MediaPlayerTileMessenger(private val context: Context) :
}
}
}
} ?: run {
/*
* If a device is disconnected from the wear network, capable nodes are empty
*
* No capable nodes can mean the app is not installed on the remote device or the
* device is disconnected.
*
* Verify if we're connected to any nodes; if not, we're truly disconnected
*/
tileModel.setConnectionStatus(
if (connectedNodes.isEmpty()) {
WearConnectionStatus.DISCONNECTED
} else {
WearConnectionStatus.APPNOTINSTALLED
}
)
}

if (refreshTile) {
Expand Down

0 comments on commit abecee7

Please sign in to comment.