Fix voice recording and notification issues

- Fix mic button gesture handling by removing Button wrapper
  - Use direct gesture on ZStack for more reliable touch detection
  - Add debug logging for recording start/stop

- Fix notification delivery on iOS
  - Change from checking .background to checking != .active
  - Notifications now work when app is inactive or background
  - Add NSUserNotificationsUsageDescription to Info.plist

- Improve voice note fragment transmission
  - Reduce fragment size from 400 to 200 bytes for better reliability
  - Simplify fragment timing from batch-based to linear 100ms delays
  - Lower packet size threshold from 512 to 400 bytes for fragmentation
  - Add peripheral connection state checking before writes
  - Better error logging throughout transmission pipeline

- Add comprehensive debug logging for troubleshooting
  - Log audio file size and duration
  - Log peripheral connection states during broadcast
  - Log fragment send progress with timing info
This commit is contained in:
jack
2025-07-03 23:14:42 +02:00
parent 2993fc3e06
commit 6652d1f429
5 changed files with 77 additions and 51 deletions
+5 -2
View File
@@ -25,11 +25,14 @@ class NotificationService {
func sendLocalNotification(title: String, body: String, identifier: String) {
#if os(iOS)
guard UIApplication.shared.applicationState == .background else {
print("[NOTIFICATIONS] App is in foreground, skipping notification")
// Send notification if app is not active (background or inactive)
guard UIApplication.shared.applicationState != .active else {
print("[NOTIFICATIONS] App is active/foreground, skipping notification")
return
}
print("[NOTIFICATIONS] App state: \(UIApplication.shared.applicationState.rawValue), sending notification")
let content = UNMutableNotificationContent()
content.title = title
content.body = body