fix(nodes): improve version reporting
This commit is contained in:
@@ -20,7 +20,7 @@ android {
|
|||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "0.1"
|
versionName = "2.0.0-beta3"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.steipete.clawdis.node.bridge.BridgeEndpoint
|
|||||||
import com.steipete.clawdis.node.bridge.BridgePairingClient
|
import com.steipete.clawdis.node.bridge.BridgePairingClient
|
||||||
import com.steipete.clawdis.node.bridge.BridgeSession
|
import com.steipete.clawdis.node.bridge.BridgeSession
|
||||||
import com.steipete.clawdis.node.node.CameraCaptureManager
|
import com.steipete.clawdis.node.node.CameraCaptureManager
|
||||||
|
import com.steipete.clawdis.node.BuildConfig
|
||||||
import com.steipete.clawdis.node.node.CanvasController
|
import com.steipete.clawdis.node.node.CanvasController
|
||||||
import com.steipete.clawdis.node.node.ScreenRecordManager
|
import com.steipete.clawdis.node.node.ScreenRecordManager
|
||||||
import com.steipete.clawdis.node.protocol.ClawdisCapability
|
import com.steipete.clawdis.node.protocol.ClawdisCapability
|
||||||
@@ -346,6 +347,13 @@ class NodeRuntime(context: Context) {
|
|||||||
add(ClawdisCapability.VoiceWake.rawValue)
|
add(ClawdisCapability.VoiceWake.rawValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val versionName = BuildConfig.VERSION_NAME.trim().ifEmpty { "dev" }
|
||||||
|
val advertisedVersion =
|
||||||
|
if (BuildConfig.DEBUG && !versionName.contains("dev", ignoreCase = true)) {
|
||||||
|
"$versionName-dev"
|
||||||
|
} else {
|
||||||
|
versionName
|
||||||
|
}
|
||||||
BridgePairingClient().pairAndHello(
|
BridgePairingClient().pairAndHello(
|
||||||
endpoint = endpoint,
|
endpoint = endpoint,
|
||||||
hello =
|
hello =
|
||||||
@@ -354,7 +362,7 @@ class NodeRuntime(context: Context) {
|
|||||||
displayName = displayName.value,
|
displayName = displayName.value,
|
||||||
token = null,
|
token = null,
|
||||||
platform = "Android",
|
platform = "Android",
|
||||||
version = "dev",
|
version = advertisedVersion,
|
||||||
deviceFamily = "Android",
|
deviceFamily = "Android",
|
||||||
modelIdentifier = modelIdentifier,
|
modelIdentifier = modelIdentifier,
|
||||||
caps = caps,
|
caps = caps,
|
||||||
@@ -372,6 +380,13 @@ class NodeRuntime(context: Context) {
|
|||||||
|
|
||||||
val authToken = requireNotNull(resolved.token).trim()
|
val authToken = requireNotNull(resolved.token).trim()
|
||||||
prefs.saveBridgeToken(authToken)
|
prefs.saveBridgeToken(authToken)
|
||||||
|
val versionName = BuildConfig.VERSION_NAME.trim().ifEmpty { "dev" }
|
||||||
|
val advertisedVersion =
|
||||||
|
if (BuildConfig.DEBUG && !versionName.contains("dev", ignoreCase = true)) {
|
||||||
|
"$versionName-dev"
|
||||||
|
} else {
|
||||||
|
versionName
|
||||||
|
}
|
||||||
session.connect(
|
session.connect(
|
||||||
endpoint = endpoint,
|
endpoint = endpoint,
|
||||||
hello =
|
hello =
|
||||||
@@ -380,7 +395,7 @@ class NodeRuntime(context: Context) {
|
|||||||
displayName = displayName.value,
|
displayName = displayName.value,
|
||||||
token = authToken,
|
token = authToken,
|
||||||
platform = "Android",
|
platform = "Android",
|
||||||
version = "dev",
|
version = advertisedVersion,
|
||||||
deviceFamily = "Android",
|
deviceFamily = "Android",
|
||||||
modelIdentifier = modelIdentifier,
|
modelIdentifier = modelIdentifier,
|
||||||
caps =
|
caps =
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ final class MenuSessionsInjector: NSObject, NSMenuDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let version = entry.version?.nonEmpty {
|
if let version = entry.version?.nonEmpty {
|
||||||
menu.addItem(self.makeNodeCopyItem(label: "Version", value: "v\(version)"))
|
menu.addItem(self.makeNodeCopyItem(label: "Version", value: self.formatVersionLabel(version)))
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.addItem(self.makeNodeDetailItem(label: "Last seen", value: entry.ageDescription))
|
menu.addItem(self.makeNodeDetailItem(label: "Last seen", value: entry.ageDescription))
|
||||||
@@ -487,7 +487,15 @@ final class MenuSessionsInjector: NSObject, NSMenuDelegate {
|
|||||||
item.representedObject = url
|
item.representedObject = url
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
private func formatVersionLabel(_ version: String) -> String {
|
||||||
|
let trimmed = version.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
guard !trimmed.isEmpty else { return version }
|
||||||
|
if trimmed.hasPrefix("v") { return trimmed }
|
||||||
|
if let first = trimmed.unicodeScalars.first, CharacterSet.decimalDigits.contains(first) {
|
||||||
|
return "v\(trimmed)"
|
||||||
|
}
|
||||||
|
return trimmed
|
||||||
|
}
|
||||||
@objc
|
@objc
|
||||||
private func patchThinking(_ sender: NSMenuItem) {
|
private func patchThinking(_ sender: NSMenuItem) {
|
||||||
guard let dict = sender.representedObject as? [String: Any],
|
guard let dict = sender.representedObject as? [String: Any],
|
||||||
|
|||||||
Reference in New Issue
Block a user