fix(watch): finalise correctif sync workoutHistory/exercise et distance live montre (#157)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
const int watchBridgeSchemaVersion = 4;
|
||||
const int watchBridgeSchemaVersion = 5;
|
||||
|
||||
enum WatchCommandType {
|
||||
startCurrentExercise,
|
||||
@ -140,6 +140,7 @@ final class WatchSessionProjection {
|
||||
required this.deviceSessionId,
|
||||
required this.revision,
|
||||
required this.projectedAtEpochMs,
|
||||
this.expiresAtEpochMs = 0,
|
||||
required this.phase,
|
||||
required this.phoneReachable,
|
||||
required this.seriesIndex,
|
||||
@ -166,6 +167,7 @@ final class WatchSessionProjection {
|
||||
this.canDecrementScore = false,
|
||||
this.manualScoreTargetValue,
|
||||
this.manualScoreTargetLabel,
|
||||
this.manualScoreRepsTargetValue,
|
||||
this.manualScoreScope,
|
||||
});
|
||||
|
||||
@ -178,6 +180,7 @@ final class WatchSessionProjection {
|
||||
deviceSessionId: _stringFromJson(json['deviceSessionId']),
|
||||
revision: _intFromJson(json['revision'], 0),
|
||||
projectedAtEpochMs: _intFromJson(json['projectedAtEpochMs'], 0),
|
||||
expiresAtEpochMs: _intFromJson(json['expiresAtEpochMs'], 0),
|
||||
phase: _enumFromJson(
|
||||
json['phase'],
|
||||
WatchSessionPhase.values,
|
||||
@ -221,6 +224,9 @@ final class WatchSessionProjection {
|
||||
manualScoreTargetLabel: _nullableStringFromJson(
|
||||
json['manualScoreTargetLabel'],
|
||||
),
|
||||
manualScoreRepsTargetValue: _nullableIntFromJson(
|
||||
json['manualScoreRepsTargetValue'],
|
||||
),
|
||||
manualScoreScope: _nullableEnumFromJson(
|
||||
json['manualScoreScope'],
|
||||
WatchManualScoreScope.values,
|
||||
@ -232,6 +238,7 @@ final class WatchSessionProjection {
|
||||
final String deviceSessionId;
|
||||
final int revision;
|
||||
final int projectedAtEpochMs;
|
||||
final int expiresAtEpochMs;
|
||||
final WatchSessionPhase phase;
|
||||
final bool phoneReachable;
|
||||
final int seriesIndex;
|
||||
@ -258,6 +265,7 @@ final class WatchSessionProjection {
|
||||
final bool canDecrementScore;
|
||||
final double? manualScoreTargetValue;
|
||||
final String? manualScoreTargetLabel;
|
||||
final int? manualScoreRepsTargetValue;
|
||||
final WatchManualScoreScope? manualScoreScope;
|
||||
|
||||
Map<String, Object?> toJson() {
|
||||
@ -266,6 +274,7 @@ final class WatchSessionProjection {
|
||||
'deviceSessionId': deviceSessionId,
|
||||
'revision': revision,
|
||||
'projectedAtEpochMs': projectedAtEpochMs,
|
||||
'expiresAtEpochMs': expiresAtEpochMs,
|
||||
'phase': phase.name,
|
||||
'phoneReachable': phoneReachable,
|
||||
'seriesIndex': seriesIndex,
|
||||
@ -296,6 +305,7 @@ final class WatchSessionProjection {
|
||||
'canDecrementScore': canDecrementScore,
|
||||
'manualScoreTargetValue': manualScoreTargetValue,
|
||||
'manualScoreTargetLabel': manualScoreTargetLabel,
|
||||
'manualScoreRepsTargetValue': manualScoreRepsTargetValue,
|
||||
'manualScoreScope': manualScoreScope?.name,
|
||||
};
|
||||
}
|
||||
@ -308,6 +318,7 @@ final class WatchSessionProjection {
|
||||
deviceSessionId == other.deviceSessionId &&
|
||||
revision == other.revision &&
|
||||
projectedAtEpochMs == other.projectedAtEpochMs &&
|
||||
expiresAtEpochMs == other.expiresAtEpochMs &&
|
||||
phase == other.phase &&
|
||||
phoneReachable == other.phoneReachable &&
|
||||
seriesIndex == other.seriesIndex &&
|
||||
@ -334,6 +345,7 @@ final class WatchSessionProjection {
|
||||
canDecrementScore == other.canDecrementScore &&
|
||||
manualScoreTargetValue == other.manualScoreTargetValue &&
|
||||
manualScoreTargetLabel == other.manualScoreTargetLabel &&
|
||||
manualScoreRepsTargetValue == other.manualScoreRepsTargetValue &&
|
||||
manualScoreScope == other.manualScoreScope;
|
||||
}
|
||||
|
||||
@ -344,6 +356,7 @@ final class WatchSessionProjection {
|
||||
deviceSessionId,
|
||||
revision,
|
||||
projectedAtEpochMs,
|
||||
expiresAtEpochMs,
|
||||
phase,
|
||||
phoneReachable,
|
||||
seriesIndex,
|
||||
@ -370,6 +383,7 @@ final class WatchSessionProjection {
|
||||
canDecrementScore,
|
||||
manualScoreTargetValue,
|
||||
manualScoreTargetLabel,
|
||||
manualScoreRepsTargetValue,
|
||||
manualScoreScope,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -148,6 +148,7 @@ void main() {
|
||||
deviceSessionId: 'session-${phase.name}-${primaryAction.name}',
|
||||
revision: 4,
|
||||
projectedAtEpochMs: 1710000000100,
|
||||
expiresAtEpochMs: 1710000012100,
|
||||
phase: phase,
|
||||
phoneReachable: true,
|
||||
seriesIndex: 2,
|
||||
@ -174,6 +175,7 @@ void main() {
|
||||
canDecrementScore: true,
|
||||
manualScoreTargetValue: 10,
|
||||
manualScoreTargetLabel: 'Cible',
|
||||
manualScoreRepsTargetValue: 12,
|
||||
manualScoreScope: WatchManualScoreScope.step,
|
||||
);
|
||||
|
||||
@ -220,6 +222,7 @@ void main() {
|
||||
expect(projection.canDecrementScore, isFalse);
|
||||
expect(projection.manualScoreTargetValue, isNull);
|
||||
expect(projection.manualScoreTargetLabel, isNull);
|
||||
expect(projection.manualScoreRepsTargetValue, isNull);
|
||||
expect(projection.manualScoreScope, isNull);
|
||||
});
|
||||
|
||||
@ -230,6 +233,7 @@ void main() {
|
||||
expect(projection.deviceSessionId, '');
|
||||
expect(projection.revision, 0);
|
||||
expect(projection.projectedAtEpochMs, 0);
|
||||
expect(projection.expiresAtEpochMs, 0);
|
||||
expect(projection.phase, WatchSessionPhase.noActiveSession);
|
||||
expect(projection.phoneReachable, false);
|
||||
expect(projection.seriesIndex, 0);
|
||||
@ -244,6 +248,7 @@ void main() {
|
||||
expect(projection.canDecrementScore, isFalse);
|
||||
expect(projection.manualScoreTargetValue, isNull);
|
||||
expect(projection.manualScoreTargetLabel, isNull);
|
||||
expect(projection.manualScoreRepsTargetValue, isNull);
|
||||
expect(projection.manualScoreScope, isNull);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user