From b7439b144a570334b6f7ed3b9fdabf42e636d136 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Thu, 22 May 2025 22:58:17 +0300 Subject: [PATCH] Fixed long history rendering --- AutoCat.xcodeproj/project.pbxproj | 4 ++-- AutoCat/Screens/HistoryScreen/HistoryScreen.swift | 9 +++------ .../Screens/HistoryScreen/HistoryViewModel.swift | 14 +++++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 5c9283d..ca97bf4 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 = 167; + CURRENT_PROJECT_VERSION = 168; 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 = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; diff --git a/AutoCat/Screens/HistoryScreen/HistoryScreen.swift b/AutoCat/Screens/HistoryScreen/HistoryScreen.swift index 053febc..bca639c 100644 --- a/AutoCat/Screens/HistoryScreen/HistoryScreen.swift +++ b/AutoCat/Screens/HistoryScreen/HistoryScreen.swift @@ -26,13 +26,10 @@ struct HistoryScreen: View { ForEach(viewModel.vehicleSections) { section in Section(header: Text(section.header)) { ForEach(section.elements) { vehicle in - if Device.isIPhone { - NavigationLink(value: HistoryRoute.localReport(vehicle)) { - vehicleCell(vehicle) + vehicleCell(vehicle) + .onTapGesture { + viewModel.openVehicleDetail(vehicle) } - } else { - vehicleCell(vehicle) - } } } } diff --git a/AutoCat/Screens/HistoryScreen/HistoryViewModel.swift b/AutoCat/Screens/HistoryScreen/HistoryViewModel.swift index ab4cd6a..1cb93f3 100644 --- a/AutoCat/Screens/HistoryScreen/HistoryViewModel.swift +++ b/AutoCat/Screens/HistoryScreen/HistoryViewModel.swift @@ -145,11 +145,7 @@ final class HistoryViewModel: ACHudContainer { if errors.isEmpty { hud = nil if !vehicle.unrecognized { - if Device.isIPhone { - Router.shared.openLocalReport(vehicle: vehicle) - } else { - selectedVehicleId = vehicle.id - } + openVehicleDetail(vehicle) } } else { showErrors(errors) @@ -159,6 +155,14 @@ final class HistoryViewModel: ACHudContainer { } } + func openVehicleDetail(_ vehicle: VehicleDto) { + if Device.isIPhone { + Router.shared.openLocalReport(vehicle: vehicle) + } else { + selectedVehicleId = vehicle.id + } + } + func checkNewNumber(_ number: String) async { await checkVehicle(number: number, type: .normal) }