mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 16:45:22 +00:00
Fix message display and add voice note debugging
- Fix escaped backslashes in timestamp and sender name display - Add comprehensive logging for voice note transmission pipeline - Add peripheral write completion logging - Track broadcast success/failure for central updates - Log audio recorder creation and preparation steps - Better diagnostics for troubleshooting voice note issues
This commit is contained in:
@@ -72,10 +72,14 @@ class AudioRecordingService: NSObject, ObservableObject {
|
||||
audioRecorder?.delegate = self
|
||||
audioRecorder?.prepareToRecord() // Important: prepare before recording
|
||||
|
||||
print("[AUDIO] Created recorder with URL: \(audioFilename)")
|
||||
print("[AUDIO] Recorder prepared: \(audioRecorder?.prepareToRecord() ?? false)")
|
||||
|
||||
if audioRecorder?.record() == true {
|
||||
isRecording = true
|
||||
recordingStartTime = Date()
|
||||
recordingTime = 0
|
||||
print("[AUDIO] Recording started successfully")
|
||||
|
||||
// Start timer to update recording time and enforce max duration
|
||||
recordingTimer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { [weak self] _ in
|
||||
|
||||
@@ -373,10 +373,19 @@ class BluetoothMeshService: NSObject {
|
||||
|
||||
// Send to subscribed centrals (as peripheral)
|
||||
if characteristic != nil && !subscribedCentrals.isEmpty {
|
||||
peripheralManager.updateValue(data, for: characteristic, onSubscribedCentrals: subscribedCentrals)
|
||||
print("[BROADCAST] Sent to \(subscribedCentrals.count) subscribed centrals")
|
||||
let success = peripheralManager.updateValue(data, for: characteristic, onSubscribedCentrals: subscribedCentrals)
|
||||
if success {
|
||||
print("[BROADCAST] Successfully sent to \(subscribedCentrals.count) subscribed centrals")
|
||||
} else {
|
||||
print("[BROADCAST] Failed to send to centrals - queue full, will retry on delegate callback")
|
||||
}
|
||||
} else {
|
||||
print("[BROADCAST] No subscribed centrals to send to")
|
||||
if characteristic == nil {
|
||||
print("[BROADCAST] No characteristic available")
|
||||
}
|
||||
if subscribedCentrals.isEmpty {
|
||||
print("[BROADCAST] No subscribed centrals")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user