Fixing map loading error and some search screen errors.
This commit is contained in:
parent
a46f90d2f4
commit
cc65dfbc06
@ -147,7 +147,6 @@
|
|||||||
7ABDA80D2D8721B10083C715 /* Substrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABDA80C2D8721B10083C715 /* Substrings.swift */; };
|
7ABDA80D2D8721B10083C715 /* Substrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABDA80C2D8721B10083C715 /* Substrings.swift */; };
|
||||||
7ABDA80F2D8723F90083C715 /* StorageService+AudioRecords.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABDA80E2D8723F90083C715 /* StorageService+AudioRecords.swift */; };
|
7ABDA80F2D8723F90083C715 /* StorageService+AudioRecords.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABDA80E2D8723F90083C715 /* StorageService+AudioRecords.swift */; };
|
||||||
7AC44B822DB390B900ADC026 /* MainTabScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC44B812DB390B900ADC026 /* MainTabScreen.swift */; };
|
7AC44B822DB390B900ADC026 /* MainTabScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC44B812DB390B900ADC026 /* MainTabScreen.swift */; };
|
||||||
7AC44B8A2DB4395300ADC026 /* SearchSplitScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC44B892DB4395300ADC026 /* SearchSplitScreen.swift */; };
|
|
||||||
7AC8B2762D6A01C700190706 /* UISearchTextField+Dumb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC8B2752D6A01C700190706 /* UISearchTextField+Dumb.swift */; };
|
7AC8B2762D6A01C700190706 /* UISearchTextField+Dumb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC8B2752D6A01C700190706 /* UISearchTextField+Dumb.swift */; };
|
||||||
7ACBB91E2CB9B155005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91D2CB9B155005A5168 /* Mockable */; };
|
7ACBB91E2CB9B155005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91D2CB9B155005A5168 /* Mockable */; };
|
||||||
7ACBB9202CB9B16C005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91F2CB9B16C005A5168 /* Mockable */; };
|
7ACBB9202CB9B16C005A5168 /* Mockable in Frameworks */ = {isa = PBXBuildFile; productRef = 7ACBB91F2CB9B16C005A5168 /* Mockable */; };
|
||||||
@ -399,7 +398,6 @@
|
|||||||
7ABDA80C2D8721B10083C715 /* Substrings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Substrings.swift; sourceTree = "<group>"; };
|
7ABDA80C2D8721B10083C715 /* Substrings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Substrings.swift; sourceTree = "<group>"; };
|
||||||
7ABDA80E2D8723F90083C715 /* StorageService+AudioRecords.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StorageService+AudioRecords.swift"; sourceTree = "<group>"; };
|
7ABDA80E2D8723F90083C715 /* StorageService+AudioRecords.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StorageService+AudioRecords.swift"; sourceTree = "<group>"; };
|
||||||
7AC44B812DB390B900ADC026 /* MainTabScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabScreen.swift; sourceTree = "<group>"; };
|
7AC44B812DB390B900ADC026 /* MainTabScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabScreen.swift; sourceTree = "<group>"; };
|
||||||
7AC44B892DB4395300ADC026 /* SearchSplitScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSplitScreen.swift; sourceTree = "<group>"; };
|
|
||||||
7AC8B2752D6A01C700190706 /* UISearchTextField+Dumb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISearchTextField+Dumb.swift"; sourceTree = "<group>"; };
|
7AC8B2752D6A01C700190706 /* UISearchTextField+Dumb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISearchTextField+Dumb.swift"; sourceTree = "<group>"; };
|
||||||
7AD176AF2DC127540023049D /* PNButtonType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNButtonType.swift; sourceTree = "<group>"; };
|
7AD176AF2DC127540023049D /* PNButtonType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNButtonType.swift; sourceTree = "<group>"; };
|
||||||
7ADCBC562DB51739002522C0 /* AutoCatApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCatApp.swift; sourceTree = "<group>"; };
|
7ADCBC562DB51739002522C0 /* AutoCatApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoCatApp.swift; sourceTree = "<group>"; };
|
||||||
@ -722,7 +720,6 @@
|
|||||||
7A5911EC2D63225500EC51BA /* SearchScreen */ = {
|
7A5911EC2D63225500EC51BA /* SearchScreen */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
7AC44B892DB4395300ADC026 /* SearchSplitScreen.swift */,
|
|
||||||
7A5911ED2D63226F00EC51BA /* SearchScreen.swift */,
|
7A5911ED2D63226F00EC51BA /* SearchScreen.swift */,
|
||||||
7A5911EF2D63266B00EC51BA /* SearchViewModel.swift */,
|
7A5911EF2D63266B00EC51BA /* SearchViewModel.swift */,
|
||||||
);
|
);
|
||||||
@ -1314,7 +1311,6 @@
|
|||||||
7A1E78FF2CE91A740004B740 /* Vehicle.swift in Sources */,
|
7A1E78FF2CE91A740004B740 /* Vehicle.swift in Sources */,
|
||||||
7A1441682C297EFD00E79018 /* NotesViewModel.swift in Sources */,
|
7A1441682C297EFD00E79018 /* NotesViewModel.swift in Sources */,
|
||||||
7AFBE8C02C3024E5003C491D /* ACHud.swift in Sources */,
|
7AFBE8C02C3024E5003C491D /* ACHud.swift in Sources */,
|
||||||
7AC44B8A2DB4395300ADC026 /* SearchSplitScreen.swift in Sources */,
|
|
||||||
7AAAFADA2C4D1AFE0050410D /* Zoomable.swift in Sources */,
|
7AAAFADA2C4D1AFE0050410D /* Zoomable.swift in Sources */,
|
||||||
7ADFC9572DAD0288001A43E3 /* GoogleAuthScreen.swift in Sources */,
|
7ADFC9572DAD0288001A43E3 /* GoogleAuthScreen.swift in Sources */,
|
||||||
7AC8B2762D6A01C700190706 /* UISearchTextField+Dumb.swift in Sources */,
|
7AC8B2762D6A01C700190706 /* UISearchTextField+Dumb.swift in Sources */,
|
||||||
@ -1665,7 +1661,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 163;
|
CURRENT_PROJECT_VERSION = 164;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
||||||
@ -1694,7 +1690,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 163;
|
CURRENT_PROJECT_VERSION = 164;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
INFOPLIST_KEY_CFBundleDisplayName = AutoCat;
|
||||||
|
|||||||
@ -20,6 +20,8 @@ struct MapScreen: View {
|
|||||||
|
|
||||||
init(mapInput: MapInput) {
|
init(mapInput: MapInput) {
|
||||||
|
|
||||||
|
print("==== MapScreen init ====")
|
||||||
|
|
||||||
self.viewModel = MapViewModel(
|
self.viewModel = MapViewModel(
|
||||||
apiService: ServiceContainer.shared.resolve(ApiServiceProtocol.self),
|
apiService: ServiceContainer.shared.resolve(ApiServiceProtocol.self),
|
||||||
mapInput: mapInput
|
mapInput: mapInput
|
||||||
@ -49,6 +51,7 @@ struct MapScreen: View {
|
|||||||
}
|
}
|
||||||
.onMapCameraChange(frequency: .onEnd) { context in
|
.onMapCameraChange(frequency: .onEnd) { context in
|
||||||
Task.detached {
|
Task.detached {
|
||||||
|
print("==== on map camera change ====")
|
||||||
await viewModel.reloadMarkers()
|
await viewModel.reloadMarkers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,11 @@ final class MapViewModel: ACHudContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func onAppear() async {
|
func onAppear() async {
|
||||||
|
guard markers.isEmpty else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
print("===== onAppear ====")
|
||||||
|
|
||||||
switch mapInput {
|
switch mapInput {
|
||||||
case .event(let event):
|
case .event(let event):
|
||||||
@ -58,6 +63,7 @@ final class MapViewModel: ACHudContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadEvents(with filter: Filter) async {
|
func loadEvents(with filter: Filter) async {
|
||||||
|
print("==== Loading events ====")
|
||||||
await wrapWithToast { [weak self] in
|
await wrapWithToast { [weak self] in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
let events = try await apiService.events(with: filter)
|
let events = try await apiService.events(with: filter)
|
||||||
@ -69,6 +75,10 @@ final class MapViewModel: ACHudContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nonisolated func reloadMarkers() async {
|
nonisolated func reloadMarkers() async {
|
||||||
|
guard await markers.isEmpty else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
print("==== Reloading markers ====")
|
||||||
async let changes = clusterManager.reload(
|
async let changes = clusterManager.reload(
|
||||||
mapViewSize: mapSize,
|
mapViewSize: mapSize,
|
||||||
coordinateRegion: currentRegion
|
coordinateRegion: currentRegion
|
||||||
|
|||||||
@ -43,7 +43,7 @@ struct SearchScreen: View {
|
|||||||
Task { await viewModel.onAppear() }
|
Task { await viewModel.onAppear() }
|
||||||
}
|
}
|
||||||
.refreshable {
|
.refreshable {
|
||||||
Task { await viewModel.reloadData() }
|
await viewModel.reloadData()
|
||||||
}
|
}
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .primaryAction) {
|
ToolbarItem(placement: .primaryAction) {
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
//
|
|
||||||
// SearchSplitScreen.swift
|
|
||||||
// AutoCat
|
|
||||||
//
|
|
||||||
// Created by Selim Mustafaev on 19.04.2025.
|
|
||||||
// Copyright © 2025 Selim Mustafaev. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import AutoCatCore
|
|
||||||
|
|
||||||
struct SearchSplitScreen: View {
|
|
||||||
|
|
||||||
@State var viewModel: SearchViewModel
|
|
||||||
|
|
||||||
init() {
|
|
||||||
let resolver = ServiceContainer.shared
|
|
||||||
self.viewModel = SearchViewModel(
|
|
||||||
apiService: resolver.resolve(ApiServiceProtocol.self),
|
|
||||||
vehicleService: resolver.resolve(VehicleServiceProtocol.self)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
NavigationSplitView {
|
|
||||||
SearchScreen(viewModel: viewModel)
|
|
||||||
} detail: {
|
|
||||||
if let vehicle = viewModel.selectedVehicle {
|
|
||||||
ReportScreen(vehicle: vehicle, isPersistent: false, onUpdate: viewModel.onVehicleChanged)
|
|
||||||
.id(vehicle.id)
|
|
||||||
} else {
|
|
||||||
Text("No vehicle selected")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.navigationSplitViewStyle(.balanced)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -88,16 +88,17 @@ final class SearchViewModel: ACHudContainer {
|
|||||||
vehicles = []
|
vehicles = []
|
||||||
vehicleSections = []
|
vehicleSections = []
|
||||||
pageToken = nil
|
pageToken = nil
|
||||||
|
vehiclesCount = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadSearchResults(filter: Filter, needResetData: Bool = false) async throws {
|
func loadSearchResults(filter: Filter, needResetData: Bool = false) async throws {
|
||||||
|
|
||||||
let response = try await apiService.getVehicles(with: filter, pageToken: pageToken, pageSize: 20)
|
|
||||||
|
|
||||||
if needResetData {
|
if needResetData {
|
||||||
resetData()
|
resetData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let response = try await apiService.getVehicles(with: filter, pageToken: pageToken, pageSize: 20)
|
||||||
|
|
||||||
if response.items.isEmpty {
|
if response.items.isEmpty {
|
||||||
hasMoreData = false
|
hasMoreData = false
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -14,27 +14,14 @@ struct ACProgressHudModifier: ViewModifier {
|
|||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
|
|
||||||
if let item {
|
ZStack {
|
||||||
ZStack {
|
|
||||||
content
|
|
||||||
makeHud(for: item)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
content
|
content
|
||||||
|
makeHud(for: item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// content
|
|
||||||
// .fullScreenCover(item: $item) { item in
|
|
||||||
// makeHud(for: item)
|
|
||||||
// .presentationBackground(.clear)
|
|
||||||
// }
|
|
||||||
// .transaction { transaction in
|
|
||||||
// transaction.disablesAnimations = true
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func makeHud(for item: ACHud) -> some View {
|
func makeHud(for item: ACHud?) -> some View {
|
||||||
switch item {
|
switch item {
|
||||||
case .progress:
|
case .progress:
|
||||||
ACProgressView()
|
ACProgressView()
|
||||||
@ -48,6 +35,8 @@ struct ACProgressHudModifier: ViewModifier {
|
|||||||
type: type) {
|
type: type) {
|
||||||
self.item = nil
|
self.item = nil
|
||||||
}
|
}
|
||||||
|
case .none:
|
||||||
|
EmptyView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user