From 85ad7e9144cb7d5a2a1342ab24c59a41c3c30c26 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Tue, 30 Jul 2024 18:52:38 +0300 Subject: [PATCH] Add reverse geocoding query when checking number --- AutoCat.xcodeproj/project.pbxproj | 4 ++-- AutoCat/Controllers/CheckController.swift | 5 +++-- AutoCatCore/Models/DTO/VehicleEventDto.swift | 18 ------------------ 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 0a54cb9..52d04a2 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1543,7 +1543,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 129; + CURRENT_PROJECT_VERSION = 130; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; @@ -1569,7 +1569,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 129; + CURRENT_PROJECT_VERSION = 130; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; diff --git a/AutoCat/Controllers/CheckController.swift b/AutoCat/Controllers/CheckController.swift index 849c3ff..d603a89 100644 --- a/AutoCat/Controllers/CheckController.swift +++ b/AutoCat/Controllers/CheckController.swift @@ -389,8 +389,9 @@ class CheckController: UIViewController, UITableViewDelegate, UISearchResultsUpd } do { - let event = try await getEvent(for: action) - try? await event.findAddress() + var event = try await getEvent(for: action) + event.address = try? await RxLocationManager.getAddressForLocation(latitude: event.latitude, + longitude: event.longitude) return (event: event, error: nil) } catch { return (event: nil, error: error) diff --git a/AutoCatCore/Models/DTO/VehicleEventDto.swift b/AutoCatCore/Models/DTO/VehicleEventDto.swift index 7a4f1ee..8654030 100644 --- a/AutoCatCore/Models/DTO/VehicleEventDto.swift +++ b/AutoCatCore/Models/DTO/VehicleEventDto.swift @@ -48,22 +48,4 @@ public struct VehicleEventDto: Codable, Sendable { return "\(latitude), \(longitude)" } } - - public func findAddress() async throws { - guard address == nil else { - return - } - - /* - return RxLocationManager - .getAddressForLocation(latitude: self.latitude, longitude: self.longitude) - .map { addr in - if let realm = self.realm { - try realm.write { self.address = addr } - } else { - self.address = addr - } - } - */ - } }