Add testable initializer to LocationStateManager

Allow tests to create instances with custom UserDefaults storage
for isolated testing of bookmark functionality.
This commit is contained in:
jack
2025-11-25 08:08:51 -10:00
parent 5495874b5a
commit b33fe8086d
@@ -72,6 +72,13 @@ final class LocationStateManager: NSObject, CLLocationManagerDelegate, Observabl
initializePermissionState() initializePermissionState()
} }
/// Internal initializer for testing with custom storage
init(storage: UserDefaults) {
self.storage = storage
super.init()
loadPersistedState()
}
private func loadPersistedState() { private func loadPersistedState() {
// Load selected channel // Load selected channel
if let data = storage.data(forKey: selectedChannelKey), if let data = storage.data(forKey: selectedChannelKey),