Stop and resume DD Session Replay on app backgrounding and activation to prevent crashes

This commit is contained in:
Ben Meadors 2026-01-30 07:05:28 -06:00
parent beb990e6ef
commit 6cdcb96967

View file

@ -196,6 +196,9 @@ struct MeshtasticAppleApp: App {
switch newScenePhase {
case .background:
Logger.services.info("🎬 [App] Scene is in the background")
// Stop Session Replay when app goes to background to prevent crashes
// from accessing SwiftUI view hierarchy while backgrounded
SessionReplay.stopRecording()
accessoryManager.appDidEnterBackground()
do {
try persistenceController.container.viewContext.save()
@ -209,6 +212,8 @@ struct MeshtasticAppleApp: App {
Logger.services.info("🎬 [App] Scene is inactive")
case .active:
Logger.services.info("🎬 [App] Scene is active")
// Resume Session Replay when app becomes active
SessionReplay.startRecording()
accessoryManager.appDidBecomeActive()
@unknown default:
Logger.services.error("🍎 [App] Apple must have changed something")