From eca70e69e72b53fdd5bf1e5ed799f35d79020d9c Mon Sep 17 00:00:00 2001 From: Ryan Nair Date: Sat, 19 Jul 2025 22:01:23 -0400 Subject: [PATCH] Fix Crash when receiving notification from the background In my testing the app crashes in the background when receiving a notification. This is probably due to UIFeedbackGenerator requiring the main thread which isn't available --- bitchat/ViewModels/ChatViewModel.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitchat/ViewModels/ChatViewModel.swift b/bitchat/ViewModels/ChatViewModel.swift index 6b27676f..20f360fb 100644 --- a/bitchat/ViewModels/ChatViewModel.swift +++ b/bitchat/ViewModels/ChatViewModel.swift @@ -3436,7 +3436,9 @@ extension ChatViewModel: BitchatDelegate { #if os(iOS) // Haptic feedback for iOS only - + guard UIApplication.shared.applicationState == .active else { + return + } // Check if this is a hug message directed at the user let isHugForMe = message.content.contains("🫂") && (message.content.contains("hugs \(nickname)") ||