diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index f25c195..fed2422 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1661,7 +1661,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 164; + CURRENT_PROJECT_VERSION = 165; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; @@ -1690,7 +1690,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 164; + CURRENT_PROJECT_VERSION = 165; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; diff --git a/AutoCat/Screens/MapScreen/MapScreen.swift b/AutoCat/Screens/MapScreen/MapScreen.swift index be24c55..b6adc02 100644 --- a/AutoCat/Screens/MapScreen/MapScreen.swift +++ b/AutoCat/Screens/MapScreen/MapScreen.swift @@ -20,8 +20,6 @@ struct MapScreen: View { init(mapInput: MapInput) { - print("==== MapScreen init ====") - self.viewModel = MapViewModel( apiService: ServiceContainer.shared.resolve(ApiServiceProtocol.self), mapInput: mapInput @@ -51,7 +49,6 @@ struct MapScreen: View { } .onMapCameraChange(frequency: .onEnd) { context in Task.detached { - print("==== on map camera change ====") await viewModel.reloadMarkers() } } diff --git a/AutoCat/Screens/MapScreen/MapViewModel.swift b/AutoCat/Screens/MapScreen/MapViewModel.swift index edd04e9..1bf7be5 100644 --- a/AutoCat/Screens/MapScreen/MapViewModel.swift +++ b/AutoCat/Screens/MapScreen/MapViewModel.swift @@ -29,6 +29,13 @@ final class MapViewModel: ACHudContainer { var mapSize: CGSize = .zero var currentRegion: MKCoordinateRegion = .init() + var isFilter: Bool { + switch mapInput { + case .event: false + case .filter: true + } + } + init(apiService: ApiServiceProtocol, mapInput: MapInput) { self.apiService = apiService @@ -40,8 +47,6 @@ final class MapViewModel: ACHudContainer { return } - print("===== onAppear ====") - switch mapInput { case .event(let event): markers = [makeMarkerModel(from: event)] @@ -63,7 +68,6 @@ final class MapViewModel: ACHudContainer { } func loadEvents(with filter: Filter) async { - print("==== Loading events ====") await wrapWithToast { [weak self] in guard let self else { return } let events = try await apiService.events(with: filter) @@ -75,10 +79,10 @@ final class MapViewModel: ACHudContainer { } nonisolated func reloadMarkers() async { - guard await markers.isEmpty else { + guard await isFilter else { return } - print("==== Reloading markers ====") + async let changes = clusterManager.reload( mapViewSize: mapSize, coordinateRegion: currentRegion