wip(watch): sauvegarde travail en cours lot critique (#157 #163 #164 #174 #175 #178)

This commit is contained in:
2026-07-29 12:34:07 +02:00
parent f523a5a8b5
commit 74d6000606
26 changed files with 516 additions and 62 deletions

View File

@ -34,6 +34,8 @@ abstract interface class NativeWatchBridgeClient {
Stream<WatchCommandAckEvent> get acks;
Stream<WatchAlertEnvelope> get alerts;
Stream<WatchBridgeConnectionEvent> get connectionEvents;
Future<void> sendCommand(WatchCommandEnvelope command);
@ -54,11 +56,13 @@ final class MethodChannelNativeWatchBridgeClient
_sensorSampleChannelName,
),
EventChannel ackChannel = const EventChannel(_ackChannelName),
EventChannel alertChannel = const EventChannel(_alertChannelName),
EventChannel connectionChannel = const EventChannel(_connectionChannelName),
}) : _methodChannel = methodChannel,
_projectionChannel = projectionChannel,
_sensorSampleChannel = sensorSampleChannel,
_ackChannel = ackChannel,
_alertChannel = alertChannel,
_connectionChannel = connectionChannel;
static const _methodChannelName = 'gametime.watch_bridge/methods';
@ -66,12 +70,14 @@ final class MethodChannelNativeWatchBridgeClient
static const _sensorSampleChannelName =
'gametime.watch_bridge/sensor_samples';
static const _ackChannelName = 'gametime.watch_bridge/acks';
static const _alertChannelName = 'gametime.watch_bridge/alerts';
static const _connectionChannelName = 'gametime.watch_bridge/connection';
final MethodChannel _methodChannel;
final EventChannel _projectionChannel;
final EventChannel _sensorSampleChannel;
final EventChannel _ackChannel;
final EventChannel _alertChannel;
final EventChannel _connectionChannel;
@override
@ -115,6 +121,16 @@ final class MethodChannelNativeWatchBridgeClient
});
}
@override
Stream<WatchAlertEnvelope> get alerts {
return _alertChannel
.receiveBroadcastStream()
.where((event) => event is Map)
.map((event) {
return WatchAlertEnvelope.fromJson(_stringObjectMap(event));
});
}
@override
Stream<WatchBridgeConnectionEvent> get connectionEvents {
return _connectionChannel