forked from Blendman974/faceclaw
Battery indicators and other places no longer say "G2" when a G1 or iO is paired
This commit is contained in:
1 parent
ac68ba5991
commit
e103b89510
21 files changed
+101
-46
No files matched your search
@@ -92,8 +92,10 @@ data class PhoneState(
|
||||
val locked: Boolean,
|
||||
val worn: Boolean?,
|
||||
val listening: Boolean,
|
||||
/** Current or last-known G2 charge percentage. */
|
||||
/** The glasses' current or last-known charge percentage. */
|
||||
val battery: Int?,
|
||||
/** The paired glasses' model, as the charging line names it. */
|
||||
val glassesModel: String,
|
||||
val charging: Boolean,
|
||||
/** Last-known charging-case percentage; live only while the glasses are docked. */
|
||||
val caseBattery: Int?,
|
||||
@@ -126,6 +128,7 @@ data class PhoneState(
|
||||
worn = if (o.isNull("worn")) null else o.optBoolean("worn"),
|
||||
listening = o.optBoolean("listening", false),
|
||||
battery = if (o.isNull("battery")) null else o.optInt("battery", -1).takeIf { it in 0..100 },
|
||||
glassesModel = o.optString("glassesModel", "G2"),
|
||||
charging = o.optBoolean("charging", false),
|
||||
caseBattery = if (o.isNull("caseBattery")) null else o.optInt("caseBattery", -1).takeIf { it in 0..100 },
|
||||
caseCharging = if (o.isNull("caseCharging")) null else o.optBoolean("caseCharging"),
|
||||
|
||||
@@ -81,7 +81,7 @@ fun padLine(state: PhoneState?, link: LinkStatus): StatusLine = when {
|
||||
state.remoteEnabled == false -> StatusLine("Watch control off", StatusTone.PROBLEM)
|
||||
state.connected -> when {
|
||||
state.charging || state.phase == "charging" ->
|
||||
StatusLine(chargingLine(state.battery), StatusTone.BUSY, caseLine(state))
|
||||
StatusLine(chargingLine(state), StatusTone.BUSY, caseLine(state))
|
||||
state.silentMode -> StatusLine("Silent mode", StatusTone.OFF)
|
||||
state.locked -> StatusLine("Locked", StatusTone.OFF)
|
||||
!state.screenOn -> StatusLine("●● Wake", StatusTone.OFF)
|
||||
@@ -93,8 +93,8 @@ fun padLine(state: PhoneState?, link: LinkStatus): StatusLine = when {
|
||||
else -> StatusLine("Disconnected", StatusTone.OFF)
|
||||
}
|
||||
|
||||
private fun chargingLine(battery: Int?): String =
|
||||
if (battery != null) "Charging · G2 $battery%" else "Charging"
|
||||
private fun chargingLine(state: PhoneState): String =
|
||||
state.battery?.let { "Charging: ${state.glassesModel} $it%" } ?: "Charging"
|
||||
|
||||
/**
|
||||
* "Case 64%", with ⚡ while the case is on USB; null when the level is
|
||||
|
||||
Reference in new issue
Block a user