From 3afacca7f64a740988a7de2e076a99426a37453a Mon Sep 17 00:00:00 2001 From: jack Date: Thu, 11 Sep 2025 18:36:15 +0200 Subject: [PATCH] fix(iOS App): resolve merge artifacts in scenePhase handler\n- Remove duplicate didEnterBackground state\n- Fix switch/if braces and logic for foreground restart gating --- bitchat/BitchatApp.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bitchat/BitchatApp.swift b/bitchat/BitchatApp.swift index e1144ec2..2aff329a 100644 --- a/bitchat/BitchatApp.swift +++ b/bitchat/BitchatApp.swift @@ -18,7 +18,6 @@ struct BitchatApp: App { // Skip the very first .active-triggered Tor restart on cold launch @State private var didHandleInitialActive: Bool = false @State private var didEnterBackground: Bool = false - @State private var didEnterBackground: Bool = false #elseif os(macOS) @NSApplicationDelegateAdaptor(MacAppDelegate.self) var appDelegate #endif @@ -70,8 +69,6 @@ struct BitchatApp: App { // Proactively disconnect Nostr to avoid spurious socket errors while Tor is down NostrRelayManager.shared.disconnect() didEnterBackground = true - didEnterBackground = true - break case .active: // Restart services when becoming active chatViewModel.meshService.startServices() @@ -79,15 +76,11 @@ struct BitchatApp: App { // On initial cold launch, Tor was just started in onAppear. // Skip the deterministic restart the first time we become active. if didHandleInitialActive && didEnterBackground { - // Ensure Tor is healthy; restart deterministically, then wait until ready TorManager.shared.ensureRunningOnForeground() } else { didHandleInitialActive = true } didEnterBackground = false - } else { - didHandleInitialActive = true - } Task.detached { let _ = await TorManager.shared.awaitReady(timeout: 60) await MainActor.run {