fix(watch): stabilise stats live, foreground et resync apres perte de connexion (#179-#189)
Reduit le cout radio des samples live et la cadence des projections telephone -> montre (#179-#183). Restaure les statistiques live FC/distance/calories et le maintien foreground/ongoing activity (#184-#185). Fiabilise le demarrage de seance et l'orchestration des permissions montre (#187). Renforce la resynchronisation des statistiques live et du score apres perte puis retour de connexion (#188-#189). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -169,20 +169,27 @@ object WatchBridgePlugin {
|
||||
result.error("invalid_projection", "Projection payload must be a map.", null)
|
||||
return
|
||||
}
|
||||
val projectionJson = JSONObject(map).toString()
|
||||
val projection = map.filterKeys { it != "urgent" }
|
||||
val projectionJson = JSONObject(projection).toString()
|
||||
val request = PutDataMapRequest.create(STATE_PATH).apply {
|
||||
dataMap.putString("projectionJson", projectionJson)
|
||||
dataMap.putInt("schemaVersion", (map["schemaVersion"] as? Number)?.toInt() ?: 1)
|
||||
dataMap.putInt("revision", (map["revision"] as? Number)?.toInt() ?: 0)
|
||||
dataMap.putInt(
|
||||
"schemaVersion",
|
||||
(projection["schemaVersion"] as? Number)?.toInt() ?: 1,
|
||||
)
|
||||
dataMap.putInt("revision", (projection["revision"] as? Number)?.toInt() ?: 0)
|
||||
dataMap.putLong(
|
||||
"projectedAtEpochMs",
|
||||
(map["projectedAtEpochMs"] as? Number)?.toLong() ?: 0L,
|
||||
(projection["projectedAtEpochMs"] as? Number)?.toLong() ?: 0L,
|
||||
)
|
||||
dataMap.putLong(
|
||||
"expiresAtEpochMs",
|
||||
(map["expiresAtEpochMs"] as? Number)?.toLong() ?: 0L,
|
||||
(projection["expiresAtEpochMs"] as? Number)?.toLong() ?: 0L,
|
||||
)
|
||||
}.asPutDataRequest().setUrgent()
|
||||
}.asPutDataRequest()
|
||||
if (map["urgent"] == true) {
|
||||
request.setUrgent()
|
||||
}
|
||||
Wearable.getDataClient(context).putDataItem(request)
|
||||
.addOnSuccessListener { result.success(null) }
|
||||
.addOnFailureListener { error ->
|
||||
|
||||
Reference in New Issue
Block a user