From b33fe8086d2b8bec702ec194593c8756d7d53854 Mon Sep 17 00:00:00 2001 From: jack Date: Tue, 25 Nov 2025 08:08:51 -1000 Subject: [PATCH] Add testable initializer to LocationStateManager Allow tests to create instances with custom UserDefaults storage for isolated testing of bookmark functionality. --- bitchat/Services/LocationStateManager.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bitchat/Services/LocationStateManager.swift b/bitchat/Services/LocationStateManager.swift index a0acfaa4..c8ec79d5 100644 --- a/bitchat/Services/LocationStateManager.swift +++ b/bitchat/Services/LocationStateManager.swift @@ -72,6 +72,13 @@ final class LocationStateManager: NSObject, CLLocationManagerDelegate, Observabl initializePermissionState() } + /// Internal initializer for testing with custom storage + init(storage: UserDefaults) { + self.storage = storage + super.init() + loadPersistedState() + } + private func loadPersistedState() { // Load selected channel if let data = storage.data(forKey: selectedChannelKey),