Add message clear option

This commit is contained in:
Janez T
2026-03-05 11:04:41 +01:00
parent 2d9cb0ddb9
commit 234edf5bb0
14 changed files with 1075 additions and 319 deletions

View File

@@ -69,6 +69,12 @@ class VoiceProvider with ChangeNotifier {
required Uint8List payload,
})?
sendRawPacketCallback;
Future<bool> Function({
required String sessionId,
required int index,
Duration timeout,
})?
waitForFragmentAckCallback;
final Map<String, _OutgoingVoiceSession> _outgoingSessions = {};
@@ -198,11 +204,25 @@ class VoiceProvider with ChangeNotifier {
continue;
}
try {
final ackFuture = waitForFragmentAckCallback?.call(
sessionId: sessionId,
index: packet.index,
timeout: const Duration(seconds: 8),
);
await sendRawPacketCallback!(
contactPath: requester.outPath,
contactPathLen: requester.outPathLen,
payload: packet.encodeBinary(),
);
if (ackFuture != null) {
final acked = await ackFuture;
if (!acked) {
debugPrint(
'⚠️ [VoiceProvider] ACK timeout for $sessionId#${packet.index}',
);
return false;
}
}
} catch (e, st) {
debugPrint(
'❌ [VoiceProvider] Failed serving packet for $sessionId: $e\n$st',