feat: inline user message editing

This commit is contained in:
cogwheel0
2025-09-07 22:37:52 +05:30
parent 679eac4dd6
commit a850a567a1
5 changed files with 224 additions and 119 deletions

View File

@@ -143,4 +143,18 @@ class SocketService {
} catch (_) {}
_socket = null;
}
// Best-effort: ensure there is an active connection and wait briefly.
// Returns true if connected by the end of the timeout.
Future<bool> ensureConnected({Duration timeout = const Duration(seconds: 2)}) async {
if (isConnected) return true;
try {
await connect();
} catch (_) {}
final start = DateTime.now();
while (!isConnected && DateTime.now().difference(start) < timeout) {
await Future.delayed(const Duration(milliseconds: 50));
}
return isConnected;
}
}