From 5a74197ef226794ae9a5c4854faf2f580f368000 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Thu, 11 Jul 2024 21:53:29 -0400 Subject: [PATCH 01/19] test testing to see if commit works --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ .../Models/Helpers/Types/PrimaryType.swift | 4 +++ .../Nearby Table/NearbyTableFilter.swift | 36 +++++++++++++------ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 8da90fc4..6bf1df43 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -11,6 +11,10 @@ import Foundation enum PrimaryType: String, CaseIterable, Type { case transit + case food + case park + case business + case hotel func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index baed5815..8dc43d25 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -19,7 +19,11 @@ struct NearbyTableFilter: Equatable { static var defaultFilters: [NearbyTableFilter] { return [ .defaultFilter, - NearbyTableFilter(type: .transit) + NearbyTableFilter(type: .transit), + NearbyTableFilter(type: .food), + NearbyTableFilter(type: .park), + NearbyTableFilter(type: .business), + NearbyTableFilter(type: .hotel) ] } @@ -51,15 +55,27 @@ struct NearbyTableFilter: Equatable { if let type = type { switch type { - case .transit: - self.localizedString = GDLocalizedString("filter.transit") - self.image = UIImage(named: "Transit") - } - } else { - // There is no `PrimaryType` filter selected - self.localizedString = GDLocalizedString("filter.all") - self.image = UIImage(named: "AllPlaces") - } + case .transit: + self.localizedString = GDLocalizedString("filter.transit") + self.image = UIImage(named: "Transit") + case .food: + self.localizedString = GDLocalizedString("filter.food") + self.image = UIImage(named: "Food") + case .park: + self.localizedString = GDLocalizedString("filter.park") + self.image = UIImage(named: "Park") + case .business: + self.localizedString = GDLocalizedString("filter.business") + self.image = UIImage(named: "Business") + case .hotel: + self.localizedString = GDLocalizedString("filter.hotel") + self.image = UIImage(named: "Hotel") + } + } else { + // There is no `PrimaryType` filter selected + self.localizedString = GDLocalizedString("filter.all") + self.image = UIImage(named: "AllPlaces") + } } // MARK: Equatable From e507a880b769439fe8611eec4fa1725917312982 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Thu, 11 Jul 2024 21:54:06 -0400 Subject: [PATCH 02/19] Revert "test" This reverts commit 5a74197ef226794ae9a5c4854faf2f580f368000. --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ----- .../Models/Helpers/Types/PrimaryType.swift | 4 --- .../Nearby Table/NearbyTableFilter.swift | 36 ++++++------------- 3 files changed, 10 insertions(+), 38 deletions(-) delete mode 100644 apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 6bf1df43..8da90fc4 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -11,10 +11,6 @@ import Foundation enum PrimaryType: String, CaseIterable, Type { case transit - case food - case park - case business - case hotel func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index 8dc43d25..baed5815 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -19,11 +19,7 @@ struct NearbyTableFilter: Equatable { static var defaultFilters: [NearbyTableFilter] { return [ .defaultFilter, - NearbyTableFilter(type: .transit), - NearbyTableFilter(type: .food), - NearbyTableFilter(type: .park), - NearbyTableFilter(type: .business), - NearbyTableFilter(type: .hotel) + NearbyTableFilter(type: .transit) ] } @@ -55,27 +51,15 @@ struct NearbyTableFilter: Equatable { if let type = type { switch type { - case .transit: - self.localizedString = GDLocalizedString("filter.transit") - self.image = UIImage(named: "Transit") - case .food: - self.localizedString = GDLocalizedString("filter.food") - self.image = UIImage(named: "Food") - case .park: - self.localizedString = GDLocalizedString("filter.park") - self.image = UIImage(named: "Park") - case .business: - self.localizedString = GDLocalizedString("filter.business") - self.image = UIImage(named: "Business") - case .hotel: - self.localizedString = GDLocalizedString("filter.hotel") - self.image = UIImage(named: "Hotel") - } - } else { - // There is no `PrimaryType` filter selected - self.localizedString = GDLocalizedString("filter.all") - self.image = UIImage(named: "AllPlaces") - } + case .transit: + self.localizedString = GDLocalizedString("filter.transit") + self.image = UIImage(named: "Transit") + } + } else { + // There is no `PrimaryType` filter selected + self.localizedString = GDLocalizedString("filter.all") + self.image = UIImage(named: "AllPlaces") + } } // MARK: Equatable From b9d0795ed5c06bd1ba962ba435d94454956a6394 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Thu, 11 Jul 2024 21:56:30 -0400 Subject: [PATCH 03/19] testing again --- .../Code/Data/Models/Helpers/Types/PrimaryType.swift | 4 ++++ .../Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 8da90fc4..6bf1df43 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -11,6 +11,10 @@ import Foundation enum PrimaryType: String, CaseIterable, Type { case transit + case food + case park + case business + case hotel func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index baed5815..e353d9fe 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -19,7 +19,11 @@ struct NearbyTableFilter: Equatable { static var defaultFilters: [NearbyTableFilter] { return [ .defaultFilter, - NearbyTableFilter(type: .transit) + NearbyTableFilter(type: .transit), + NearbyTableFilter(type: .food), + NearbyTableFilter(type: .park), + NearbyTableFilter(type: .business), + NearbyTableFilter(type: .hotel) ] } From 72de1ae31e4803ecf6d71d86b88b861855199b19 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Thu, 11 Jul 2024 23:11:18 -0400 Subject: [PATCH 04/19] added tests and need to implement logic --- apps/ios/GuideDogs.xcodeproj/project.pbxproj | 4 ++ .../en-US.lproj/Localizable.strings | 3 + .../GDASpatialDataResultEntity+Typeable.swift | 41 +++++++++++- .../Models/Helpers/Types/SecondaryType.swift | 4 ++ .../Nearby Table/NearbyTableFilter.swift | 24 +++++-- .../NearbyTableFilterTest.swift | 63 +++++++++++++++++++ 6 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift diff --git a/apps/ios/GuideDogs.xcodeproj/project.pbxproj b/apps/ios/GuideDogs.xcodeproj/project.pbxproj index a0f47a49..0308756c 100644 --- a/apps/ios/GuideDogs.xcodeproj/project.pbxproj +++ b/apps/ios/GuideDogs.xcodeproj/project.pbxproj @@ -669,6 +669,7 @@ 91C82AAD2A5DCF040086D126 /* GeolocationManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91C82AAC2A5DCF040086D126 /* GeolocationManagerTest.swift */; }; 91C82ABE2A6B08500086D126 /* RouteGuidanceTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91C82ABD2A6B08500086D126 /* RouteGuidanceTest.swift */; }; 91DC0CF92A46134600244CC8 /* GeometryUtilsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 914DEBDC2A3CE901007B161C /* GeometryUtilsTest.swift */; }; + AC3A3EE22C40C9080061EEB8 /* NearbyTableFilterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC3A3EE12C40C9080061EEB8 /* NearbyTableFilterTest.swift */; }; B90C27D61EAF81D600007368 /* Sound.swift in Sources */ = {isa = PBXBuildFile; fileRef = B90C27D51EAF81D600007368 /* Sound.swift */; }; B918EE9825100FFF00A5354A /* CalloutRangeContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = B918EE9725100FFF00A5354A /* CalloutRangeContext.swift */; }; B91D3F6427AB5546004159A8 /* UserAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = B91D3F6327AB5546004159A8 /* UserAction.swift */; }; @@ -1587,6 +1588,7 @@ 915FF9F42ADE3F91002B3690 /* AuthoredActivityContentTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthoredActivityContentTest.swift; sourceTree = ""; }; 91C82AAC2A5DCF040086D126 /* GeolocationManagerTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = " GeolocationManagerTest.swift"; path = "UnitTests/Sensors/Geolocation/Geolocation Manager/ GeolocationManagerTest.swift"; sourceTree = SOURCE_ROOT; }; 91C82ABD2A6B08500086D126 /* RouteGuidanceTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RouteGuidanceTest.swift; path = "UnitTests/Behaviors/Route Guidance/RouteGuidanceTest.swift"; sourceTree = SOURCE_ROOT; }; + AC3A3EE12C40C9080061EEB8 /* NearbyTableFilterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NearbyTableFilterTest.swift; sourceTree = ""; }; B90C27D51EAF81D600007368 /* Sound.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Sound.swift; path = Code/Audio/Protocols/Sound.swift; sourceTree = ""; }; B918EE9725100FFF00A5354A /* CalloutRangeContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalloutRangeContext.swift; sourceTree = ""; }; B91D3F6327AB5546004159A8 /* UserAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserAction.swift; sourceTree = ""; }; @@ -4283,6 +4285,7 @@ isa = PBXGroup; children = ( 914BAAF22AD745E400CB2171 /* DestinationManagerTest.swift */, + AC3A3EE12C40C9080061EEB8 /* NearbyTableFilterTest.swift */, ); path = "Destination Manager"; sourceTree = ""; @@ -5545,6 +5548,7 @@ 914BAAFD2AD7483300CB2171 /* AudioEngineTest.swift in Sources */, 914BAAF32AD745E400CB2171 /* DestinationManagerTest.swift in Sources */, 91C82ABE2A6B08500086D126 /* RouteGuidanceTest.swift in Sources */, + AC3A3EE22C40C9080061EEB8 /* NearbyTableFilterTest.swift in Sources */, 91C82AAD2A5DCF040086D126 /* GeolocationManagerTest.swift in Sources */, 91DC0CF92A46134600244CC8 /* GeometryUtilsTest.swift in Sources */, ); diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index a95174bc..c848942e 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,6 +1533,9 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; +/* Filters, Food */ +"filter.transit" = "Restaurant"; + /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index a7b1c1fa..43af97da 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -12,13 +12,31 @@ extension GDASpatialDataResultEntity: Typeable { func isOfType(_ type: PrimaryType) -> Bool { switch type { - case .transit: return isOfType(.transitStop) + case .transit: + return isOfType(.transitStop) + case .food: + return isFood() + case .park: + return isPark() + case .business: + return isBusiness() + case .hotel: + return isHotel() } } func isOfType(_ type: SecondaryType) -> Bool { switch type { - case .transitStop: return isTransitStop() + case .transitStop: + return isTransitStop() + case .food: + return isFood() + case .park: + return isPark() + case .business: + return isBusiness() + case .hotel: + return isHotel() } } @@ -29,5 +47,24 @@ extension GDASpatialDataResultEntity: Typeable { return category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) } + + private func isFood() -> Bool { + // Implement your logic for food type + return false + } + + private func isPark() -> Bool { + // Implement your logic for park type + return false + } + private func isBusiness() -> Bool { + // Implement your logic for business type + return false + } + + private func isHotel() -> Bool { + // Implement your logic for hotel type + return false + } } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift index 5a0da034..9f8abc5a 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift @@ -11,6 +11,10 @@ import Foundation enum SecondaryType: Type { case transitStop + case food + case park + case business + case hotel func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index e353d9fe..e5192022 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -54,12 +54,24 @@ struct NearbyTableFilter: Equatable { self.type = type if let type = type { - switch type { - case .transit: - self.localizedString = GDLocalizedString("filter.transit") - self.image = UIImage(named: "Transit") - } - } else { + switch type { + case .transit: + self.localizedString = GDLocalizedString("filter.transit") + self.image = UIImage(named: "Transit") + case .food: + self.localizedString = GDLocalizedString("filter.food") + self.image = UIImage(named: "Food") + case .park: + self.localizedString = GDLocalizedString("filter.park") + self.image = UIImage(named: "Park") + case .business: + self.localizedString = GDLocalizedString("filter.business") + self.image = UIImage(named: "Business") + case .hotel: + self.localizedString = GDLocalizedString("filter.hotel") + self.image = UIImage(named: "Hotel") + } + } else { // There is no `PrimaryType` filter selected self.localizedString = GDLocalizedString("filter.all") self.image = UIImage(named: "AllPlaces") diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift new file mode 100644 index 00000000..317a4f00 --- /dev/null +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -0,0 +1,63 @@ +// +// NearbyTableFilterTest.swift +// UnitTests +// +// Created by Jonathan Ha on 7/11/24. +// Copyright © 2024 Soundscape community. All rights reserved. +// + +import XCTest +@testable import Soundscape + +final class NearbyTableFilterTest: XCTestCase { + + override func setUpWithError() throws { + continueAfterFailure = false + } + + override func tearDownWithError() throws { + } + + func testDefaultFilter() throws { + let filter = NearbyTableFilter.defaultFilter + XCTAssertNil(filter.type) + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.all")) + XCTAssertEqual(filter.image, UIImage(named: "AllPlaces")) + } + + func testPrimaryTypeFilters() throws { + let filters = NearbyTableFilter.primaryTypeFilters + XCTAssertEqual(filters.count, PrimaryType.allCases.count + 1) // +1 for the default filter + + for (index, type) in PrimaryType.allCases.enumerated() { + let filter = filters[index + 1] // First filter is the default filter + XCTAssertEqual(filter.type, type) + switch type { + case .transit: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.transit")) + XCTAssertEqual(filter.image, UIImage(named: "Transit")) + case .food: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food")) + XCTAssertEqual(filter.image, UIImage(named: "Food")) + case .park: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.park")) + XCTAssertEqual(filter.image, UIImage(named: "Park")) + case .business: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.business")) + XCTAssertEqual(filter.image, UIImage(named: "Business")) + case .hotel: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.hotel")) + XCTAssertEqual(filter.image, UIImage(named: "Hotel")) + } + } + } + + func testEquality() throws { + let filter1 = NearbyTableFilter(type: .transit) + let filter2 = NearbyTableFilter(type: .transit) + let filter3 = NearbyTableFilter(type: .food) + + XCTAssertEqual(filter1, filter2) + XCTAssertNotEqual(filter1, filter3) + } +} From 0784e5bae6e6a254f879cf6c4ea3d34a2b0e772b Mon Sep 17 00:00:00 2001 From: jonha1 Date: Thu, 11 Jul 2024 23:24:32 -0400 Subject: [PATCH 05/19] changed name of filters on app --- .../Assets/Localization/en-US.lproj/Localizable.strings | 3 --- .../Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift | 4 ++-- .../Data/Destination Manager/NearbyTableFilterTest.swift | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index c848942e..a95174bc 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,9 +1533,6 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; -/* Filters, Food */ -"filter.transit" = "Restaurant"; - /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index e5192022..636f423d 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -59,8 +59,8 @@ struct NearbyTableFilter: Equatable { self.localizedString = GDLocalizedString("filter.transit") self.image = UIImage(named: "Transit") case .food: - self.localizedString = GDLocalizedString("filter.food") - self.image = UIImage(named: "Food") + self.localizedString = GDLocalizedString("filter.food_drink") + self.image = UIImage(named: "Food and Drinks") case .park: self.localizedString = GDLocalizedString("filter.park") self.image = UIImage(named: "Park") diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift index 317a4f00..11e8d49b 100644 --- a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -37,7 +37,7 @@ final class NearbyTableFilterTest: XCTestCase { XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.transit")) XCTAssertEqual(filter.image, UIImage(named: "Transit")) case .food: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food")) + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food_drink")) XCTAssertEqual(filter.image, UIImage(named: "Food")) case .park: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.park")) From 7c08f362898b195d1a4640b17f66ac26d4722bc1 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Sun, 14 Jul 2024 16:36:41 -0400 Subject: [PATCH 06/19] switch filtering to education --- .../Assets/Localization/en-US.lproj/Localizable.strings | 3 +++ .../OSM Entity/GDASpatialDataResultEntity+Typeable.swift | 8 ++++---- .../Code/Data/Models/Helpers/Types/PrimaryType.swift | 2 +- .../Helpers/Nearby Table/NearbyTableFilter.swift | 6 +++--- .../Data/Destination Manager/NearbyTableFilterTest.swift | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index a95174bc..4addcd3c 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,6 +1533,9 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; +/* Filters, education */ +"filter.education" = "Education"; + /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 43af97da..6a63f3a6 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -16,8 +16,8 @@ extension GDASpatialDataResultEntity: Typeable { return isOfType(.transitStop) case .food: return isFood() - case .park: - return isPark() + case .education: + return isEducation() case .business: return isBusiness() case .hotel: @@ -32,7 +32,7 @@ extension GDASpatialDataResultEntity: Typeable { case .food: return isFood() case .park: - return isPark() + return isEducation() case .business: return isBusiness() case .hotel: @@ -53,7 +53,7 @@ extension GDASpatialDataResultEntity: Typeable { return false } - private func isPark() -> Bool { + private func isEducation() -> Bool { // Implement your logic for park type return false } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 6bf1df43..9df20c4f 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -12,7 +12,7 @@ enum PrimaryType: String, CaseIterable, Type { case transit case food - case park + case education case business case hotel diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index 636f423d..cbd27968 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -21,7 +21,7 @@ struct NearbyTableFilter: Equatable { .defaultFilter, NearbyTableFilter(type: .transit), NearbyTableFilter(type: .food), - NearbyTableFilter(type: .park), + NearbyTableFilter(type: .education), NearbyTableFilter(type: .business), NearbyTableFilter(type: .hotel) ] @@ -61,8 +61,8 @@ struct NearbyTableFilter: Equatable { case .food: self.localizedString = GDLocalizedString("filter.food_drink") self.image = UIImage(named: "Food and Drinks") - case .park: - self.localizedString = GDLocalizedString("filter.park") + case .education: + self.localizedString = GDLocalizedString("filter.education") self.image = UIImage(named: "Park") case .business: self.localizedString = GDLocalizedString("filter.business") diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift index 11e8d49b..ce645a1c 100644 --- a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -40,7 +40,7 @@ final class NearbyTableFilterTest: XCTestCase { XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food_drink")) XCTAssertEqual(filter.image, UIImage(named: "Food")) case .park: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.park")) + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.education")) XCTAssertEqual(filter.image, UIImage(named: "Park")) case .business: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.business")) From 38f7713e83546ac6eaa3b7726b44a5efdef3de16 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Sun, 14 Jul 2024 17:27:32 -0400 Subject: [PATCH 07/19] debuggign finding nearby restaurants --- .../GDASpatialDataResultEntity+Typeable.swift | 17 +++++++++++------ .../Data/Models/Helpers/SuperCategory.swift | 1 + .../Models/Helpers/Types/SecondaryType.swift | 2 +- .../NearbyTableFilterTest.swift | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 6a63f3a6..da0f49c6 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -31,7 +31,7 @@ extension GDASpatialDataResultEntity: Typeable { return isTransitStop() case .food: return isFood() - case .park: + case .education: return isEducation() case .business: return isBusiness() @@ -49,22 +49,27 @@ extension GDASpatialDataResultEntity: Typeable { } private func isFood() -> Bool { - // Implement your logic for food type - return false + guard let category = SuperCategory(rawValue: superCategory) else { + return false + } + let isFoodLocation = category == .food && localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased()) + + if isFoodLocation { + print("Food location found: \(localizedName)") + } + + return isFoodLocation } private func isEducation() -> Bool { - // Implement your logic for park type return false } private func isBusiness() -> Bool { - // Implement your logic for business type return false } private func isHotel() -> Bool { - // Implement your logic for hotel type return false } } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift index e7d043b1..3de1a349 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift @@ -21,6 +21,7 @@ enum SuperCategory: String { case landmarks = "landmark" case places = "place" case mobility = "mobility" + case food = "food" case information = "information" case objects = "object" case safety = "safety" diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift index 9f8abc5a..587c6526 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift @@ -12,7 +12,7 @@ enum SecondaryType: Type { case transitStop case food - case park + case education case business case hotel diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift index ce645a1c..e7ce542b 100644 --- a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -39,9 +39,9 @@ final class NearbyTableFilterTest: XCTestCase { case .food: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food_drink")) XCTAssertEqual(filter.image, UIImage(named: "Food")) - case .park: + case .education: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.education")) - XCTAssertEqual(filter.image, UIImage(named: "Park")) + XCTAssertEqual(filter.image, UIImage(named: "Education")) case .business: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.business")) XCTAssertEqual(filter.image, UIImage(named: "Business")) From 2d72132ce1ad47dbf4b57c2e434ce7cb303cb301 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Mon, 15 Jul 2024 22:31:58 -0400 Subject: [PATCH 08/19] addingn filter for landmakrs instead of education debugging filters --- .../en-US.lproj/Localizable.strings | 4 +-- .../GDASpatialDataResultEntity+Typeable.swift | 34 ++++++++++++++----- .../Models/Helpers/Types/PrimaryType.swift | 2 +- .../Models/Helpers/Types/SecondaryType.swift | 2 +- .../JSON Parsing/OSM/GeoJsonFeature.swift | 11 ++++++ .../Nearby Table/NearbyTableFilter.swift | 6 ++-- .../NearbyTableFilterTest.swift | 6 ++-- 7 files changed, 47 insertions(+), 18 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index 4addcd3c..ae3172da 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,8 +1533,8 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; -/* Filters, education */ -"filter.education" = "Education"; +/* Filters, lnadmarks */ +"filter.landmarks" = "Landmarks"; /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index da0f49c6..e2bd4711 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -16,8 +16,8 @@ extension GDASpatialDataResultEntity: Typeable { return isOfType(.transitStop) case .food: return isFood() - case .education: - return isEducation() + case .landmarks: + return isLandmarks() case .business: return isBusiness() case .hotel: @@ -31,8 +31,8 @@ extension GDASpatialDataResultEntity: Typeable { return isTransitStop() case .food: return isFood() - case .education: - return isEducation() + case .landmarks: + return isLandmarks() case .business: return isBusiness() case .hotel: @@ -44,16 +44,24 @@ extension GDASpatialDataResultEntity: Typeable { guard let category = SuperCategory(rawValue: superCategory) else { return false } + print("category: \(category)") + let isTransitLocation = category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) + print("tranist: \(isTransitLocation)") + if isTransitLocation { + print("Transit location found: \(localizedName)") + } + return isTransitLocation +// return category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) - return category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) } private func isFood() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { return false } + print("categroy: \(category)") let isFoodLocation = category == .food && localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased()) - + print("FOOD: \(isFoodLocation)") if isFoodLocation { print("Food location found: \(localizedName)") } @@ -61,8 +69,18 @@ extension GDASpatialDataResultEntity: Typeable { return isFoodLocation } - private func isEducation() -> Bool { - return false + private func isLandmarks() -> Bool { + guard let category = SuperCategory(rawValue: superCategory) else { + return false + } + print("category: \(category)") + let isLandmarkLocation = category == .landmarks && localizedName.lowercased().contains(GDLocalizedString("osm.tag.landmark").lowercased()) + print("LANDMARK: \(isLandmarkLocation)") + if isLandmarkLocation { + print("Landmark location found: \(localizedName)") + } + + return isLandmarkLocation } private func isBusiness() -> Bool { diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 9df20c4f..26a66fd2 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -12,7 +12,7 @@ enum PrimaryType: String, CaseIterable, Type { case transit case food - case education + case landmarks case business case hotel diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift index 587c6526..c6db9650 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift @@ -12,7 +12,7 @@ enum SecondaryType: Type { case transitStop case food - case education + case landmarks case business case hotel diff --git a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift index 1bc9e9eb..a052e9cc 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift @@ -207,6 +207,17 @@ class GeoJsonFeature { return } + //TODO JON + if value == "college"{ + superCategory = SuperCategory.landmarks + return + } + + if value == "bridge"{ + superCategory = SuperCategory.landmarks + return + } + // Case: Banks if value == "bank" { superCategory = SuperCategory.places diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index cbd27968..4f2911c0 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -21,7 +21,7 @@ struct NearbyTableFilter: Equatable { .defaultFilter, NearbyTableFilter(type: .transit), NearbyTableFilter(type: .food), - NearbyTableFilter(type: .education), + NearbyTableFilter(type: .landmarks), NearbyTableFilter(type: .business), NearbyTableFilter(type: .hotel) ] @@ -61,8 +61,8 @@ struct NearbyTableFilter: Equatable { case .food: self.localizedString = GDLocalizedString("filter.food_drink") self.image = UIImage(named: "Food and Drinks") - case .education: - self.localizedString = GDLocalizedString("filter.education") + case .landmarks: + self.localizedString = GDLocalizedString("filter.landmarks") self.image = UIImage(named: "Park") case .business: self.localizedString = GDLocalizedString("filter.business") diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift index e7ce542b..c891f386 100644 --- a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -39,9 +39,9 @@ final class NearbyTableFilterTest: XCTestCase { case .food: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food_drink")) XCTAssertEqual(filter.image, UIImage(named: "Food")) - case .education: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.education")) - XCTAssertEqual(filter.image, UIImage(named: "Education")) + case .landmarks: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.landmarks")) + XCTAssertEqual(filter.image, UIImage(named: "Landmarks")) case .business: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.business")) XCTAssertEqual(filter.image, UIImage(named: "Business")) From aa738eeefe60b4565524c2ce05fa0f3a4ecf0366 Mon Sep 17 00:00:00 2001 From: jonha1 Date: Sun, 21 Jul 2024 18:38:42 -0400 Subject: [PATCH 09/19] filter by restaurants and landmarks --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++ .../en-US.lproj/Localizable.strings | 2 + .../GDASpatialDataResultEntity+Typeable.swift | 50 ++++++++++++------- 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index ae3172da..2ec27e0a 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -3243,6 +3243,8 @@ /* Open Street Map term. A bus stop is a place where passengers can board or alight from a bus. Its position may be marked by a shelter, pole, bus lay-by, or road markings. */ "osm.tag.bus_stop" = "Bus Stop"; +/* Open Street Map term. A bus stop is a place where passengers can go to a landmark*/ +"osm.tag.landmark" = "Landmark"; /* Open Street Map term. Used as a display name for place or a location. %@ is a bus stop name, such as "London Bus Stop". */ "osm.tag.bus_stop.named" = "%@ Bus Stop"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index e2bd4711..38aaff69 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -41,46 +41,58 @@ extension GDASpatialDataResultEntity: Typeable { } private func isTransitStop() -> Bool { + print("Raw superCategory: \(superCategory)") guard let category = SuperCategory(rawValue: superCategory) else { + print("Failed to map superCategory to SuperCategory enum") return false } - print("category: \(category)") + print("Mapped category: \(category)") let isTransitLocation = category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) - print("tranist: \(isTransitLocation)") + print("Transit location check: \(isTransitLocation)") if isTransitLocation { print("Transit location found: \(localizedName)") } return isTransitLocation -// return category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) - } + //convinence store private func isFood() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { return false } - print("categroy: \(category)") - let isFoodLocation = category == .food && localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased()) - print("FOOD: \(isFoodLocation)") - if isFoodLocation { - print("Food location found: \(localizedName)") + + // Expanded keywords or patterns to identify food-related places + let foodKeywords = [ + "restaurant", "cafe", "bistro", "diner", "eatery", + "bakery", "pub", "bar", "coffee", "tea", + "fast food", "food truck", "pizzeria", + "buffet", "deli" + ] + + for keyword in foodKeywords { + if localizedName.lowercased().contains(keyword) { + return true + } } - - return isFoodLocation + + return category == .food } - + + private func isLandmarks() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { return false } - print("category: \(category)") - let isLandmarkLocation = category == .landmarks && localizedName.lowercased().contains(GDLocalizedString("osm.tag.landmark").lowercased()) - print("LANDMARK: \(isLandmarkLocation)") - if isLandmarkLocation { - print("Landmark location found: \(localizedName)") + + let landmarkKeywords = ["monument", "statue", "museum", "historic", "landmark", "cathedral"] + + for keyword in landmarkKeywords { + if localizedName.lowercased().contains(keyword) { + return true + } } - - return isLandmarkLocation + + return category == .landmarks } private func isBusiness() -> Bool { From 26f477e6be5035e1b26b9473ada41d65873355d0 Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:28:12 -0400 Subject: [PATCH 10/19] testing parks nearby function need to check this and other filters --- .../en-GB.lproj/Localizable.strings | Bin 257390 -> 257478 bytes .../en-US.lproj/Localizable.strings | 5 +- .../GDASpatialDataResultEntity+Typeable.swift | 50 +++++++++++++++--- .../Data/Models/Helpers/SuperCategory.swift | 3 +- .../Models/Helpers/Types/PrimaryType.swift | 2 +- .../Models/Helpers/Types/SecondaryType.swift | 2 +- .../Nearby Table/NearbyTableFilter.swift | 10 ++-- 7 files changed, 56 insertions(+), 16 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings index eaaa9b4349b9cba604dcce8736e0f6c7839572d8..7d238dbc9a85f6ba6312e8711b41cac579a036d4 100644 GIT binary patch delta 102 zcmaENi~rbd{)R1#9A@(R3|b5d3~mgW3^@!X45mCaB*JOEV}jSWhoZXOf(rV9LnTu4Tpu#7x_@%$Qxa0|43)7e4?1 delta 34 ocmX?hoB!P{{)R1#9A=Y!T!p3!m@@LUH<&R3G1K-2GiJB#0O$D(1^@s6 diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index 2ec27e0a..c1921749 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,9 +1533,12 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; -/* Filters, lnadmarks */ +/* Filters, Landmarks */ "filter.landmarks" = "Landmarks"; +/* Filters, Parks */ +"filter.park" = "Park"; + /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 38aaff69..68c5b9b6 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -18,8 +18,8 @@ extension GDASpatialDataResultEntity: Typeable { return isFood() case .landmarks: return isLandmarks() - case .business: - return isBusiness() + case .park: + return isPark() case .hotel: return isHotel() } @@ -33,8 +33,8 @@ extension GDASpatialDataResultEntity: Typeable { return isFood() case .landmarks: return isLandmarks() - case .business: - return isBusiness() + case .park: + return isPark() case .hotel: return isHotel() } @@ -75,7 +75,7 @@ extension GDASpatialDataResultEntity: Typeable { } } - return category == .food + return category == .foods } @@ -95,9 +95,45 @@ extension GDASpatialDataResultEntity: Typeable { return category == .landmarks } - private func isBusiness() -> Bool { - return false + private func isPark() -> Bool { + guard let category = SuperCategory(rawValue: superCategory) else { + return false + } + + let parkKeywords = [ + "park", "garden", "green space", "recreation area", "playground", + "nature reserve", "botanical garden", "public garden", "field", "reserve" + ] + + // Keywords to exclude parking lots + let excludeKeywords = [ + "parking lot", "car park", "parking", "garage", "park and ride" + ] + + let lowercasedName = localizedName.lowercased() + + // Check if the name contains any park keyword + var containsParkKeyword = false + for keyword in parkKeywords { + if lowercasedName.contains(keyword) { + containsParkKeyword = true + break + } + } + + // Check if the name contains any exclude keyword + var containsExcludeKeyword = false + for keyword in excludeKeywords { + if lowercasedName.contains(keyword) { + containsExcludeKeyword = true + break + } + } + + return containsParkKeyword && !containsExcludeKeyword } + + private func isHotel() -> Bool { return false diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift index 3de1a349..9e3f6917 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift @@ -21,7 +21,8 @@ enum SuperCategory: String { case landmarks = "landmark" case places = "place" case mobility = "mobility" - case food = "food" + case foods = "food" + case parks = "park" case information = "information" case objects = "object" case safety = "safety" diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index 26a66fd2..eb70afc7 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -13,7 +13,7 @@ enum PrimaryType: String, CaseIterable, Type { case transit case food case landmarks - case business + case park case hotel func matches(poi: POI) -> Bool { diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift index c6db9650..41c28f0a 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift @@ -13,7 +13,7 @@ enum SecondaryType: Type { case transitStop case food case landmarks - case business + case park case hotel func matches(poi: POI) -> Bool { diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index 4f2911c0..16c7f36b 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -22,7 +22,7 @@ struct NearbyTableFilter: Equatable { NearbyTableFilter(type: .transit), NearbyTableFilter(type: .food), NearbyTableFilter(type: .landmarks), - NearbyTableFilter(type: .business), + NearbyTableFilter(type: .park), NearbyTableFilter(type: .hotel) ] } @@ -63,10 +63,10 @@ struct NearbyTableFilter: Equatable { self.image = UIImage(named: "Food and Drinks") case .landmarks: self.localizedString = GDLocalizedString("filter.landmarks") - self.image = UIImage(named: "Park") - case .business: - self.localizedString = GDLocalizedString("filter.business") - self.image = UIImage(named: "Business") + self.image = UIImage(named: "Landmarks") + case .park: + self.localizedString = GDLocalizedString("filter.park") + self.image = UIImage(named: "Parks") case .hotel: self.localizedString = GDLocalizedString("filter.hotel") self.image = UIImage(named: "Hotel") From fc66606ee952c2c6fefd6af21a4c83ce3a13bd1b Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Mon, 22 Jul 2024 19:47:37 -0400 Subject: [PATCH 11/19] trying to create isFood filter --- .../en-US.lproj/Localizable.strings | 26 ++++++++++++----- .../GDASpatialDataResultEntity+Typeable.swift | 29 ++++++++++--------- .../JSON Parsing/OSM/GeoJsonFeature.swift | 21 +++++++++++--- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index c1921749..1ba0a5c2 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -3220,12 +3220,6 @@ /* Open Street Map term. Refers to any parking space designed for bicycles, where one can leave a pedal cycle unattended in reasonable security. */ "osm.tag.bike_parking" = "Bike Parking"; -/* Open Street Map term. An informal place with sit-down facilities selling beverages and light meals and/or snacks. */ -"osm.tag.cafe" = "Cafe"; - -/* Open Street Map term. Generally a formal eating places with sit-down facilities selling full meals served by waiters and often licensed (where allowed) to sell alcoholic drinks. */ -"osm.tag.restaurant" = "Restaurant"; - /* Open Street Map term. A public telephone, phone box, or telephone on a stand or wall. Usually you pay to use them, often only via a pre-pay card. */ "osm.tag.telephone" = "Telephone"; @@ -3246,12 +3240,30 @@ /* Open Street Map term. A bus stop is a place where passengers can board or alight from a bus. Its position may be marked by a shelter, pole, bus lay-by, or road markings. */ "osm.tag.bus_stop" = "Bus Stop"; -/* Open Street Map term. A bus stop is a place where passengers can go to a landmark*/ +/* Open Street Map term. A bus stop is a place where passengers can go to a landmark */ "osm.tag.landmark" = "Landmark"; /* Open Street Map term. Used as a display name for place or a location. %@ is a bus stop name, such as "London Bus Stop". */ "osm.tag.bus_stop.named" = "%@ Bus Stop"; +/* Open Street Map term. An informal place with sit-down facilities selling beverages and light meals and/or snacks. */ +"osm.tag.cafe" = "Cafe"; + +/* Open Street Map term. Generally a formal eating places with sit-down facilities selling full meals served by waiters and often licensed (where allowed) to sell alcoholic drinks. */ +"osm.tag.restaurant" = "Restaurant"; + +/* Open Street Map term. Fast food is a place where food that is prepared and served very quickly. */ +"osm.tag.fast_food" = "fast_food"; + +/* Open Street Map term. A bar is an place where alcoholic beverages are served. */ +"osm.tag.bar" = "bar"; + +/* Open Street Map term. An ice cream shop is a place where ice cream is sold. */ +"osm.tag.ice_cream" = "amenity=ice_cream"; + +/* Open Street Map term. A pub is a place selling beer and other alcoholic drinks; may also provide food or accommodation (UK). */ +"osm.tag.pub" = "amenity=pub"; + /* Open Street Map term. Used as a display name for place or a location. %@ is a bus stop id, such as "Bus Stop 7" or "Bus Stop B". */ "osm.tag.bus_stop.refed" = "Bus Stop %@"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 68c5b9b6..84db1034 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -57,28 +57,29 @@ extension GDASpatialDataResultEntity: Typeable { //convinence store private func isFood() -> Bool { + print("Raw superCategory: \(superCategory)") guard let category = SuperCategory(rawValue: superCategory) else { + print("Failed to map superCategory to SuperCategory enum") return false } + print("Mapped category: \(category)") + let isFoodLocation = category == .places && + localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased()) +// let osmTags = ["amenity=restaurant", "amenity=bar", "amenity=cafe", "amenity=fast_food", "amenity=ice_cream", "amenity=pub"] - // Expanded keywords or patterns to identify food-related places - let foodKeywords = [ - "restaurant", "cafe", "bistro", "diner", "eatery", - "bakery", "pub", "bar", "coffee", "tea", - "fast food", "food truck", "pizzeria", - "buffet", "deli" - ] - - for keyword in foodKeywords { - if localizedName.lowercased().contains(keyword) { - return true - } + // List of restaurant-related OSM tags using localized strings + print("Transit location check: \(isFoodLocation)") + + if isFoodLocation { + print("Food location found: \(localizedName)") } - - return category == .foods + + return isFoodLocation } + + private func isLandmarks() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { return false diff --git a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift index a052e9cc..8ef95069 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift @@ -208,16 +208,29 @@ class GeoJsonFeature { } //TODO JON - if value == "college"{ - superCategory = SuperCategory.landmarks + if value == "fast_food"{ + superCategory = SuperCategory.foods return } - if value == "bridge"{ - superCategory = SuperCategory.landmarks + if value == "restaurants"{ + superCategory = SuperCategory.foods return } + + if value == "food"{ + superCategory = SuperCategory.foods + return + } + + + if value == "deli"{ + superCategory = SuperCategory.foods + return + } + + // Case: Banks if value == "bank" { superCategory = SuperCategory.places From 79a062942987245ea383045cec00857111578a50 Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:45:00 -0400 Subject: [PATCH 12/19] fixing food and landmark --- .../en-US.lproj/Localizable.strings | 16 ++++- .../GDASpatialDataResultEntity+Typeable.swift | 58 +++++++++++++------ 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index 1ba0a5c2..fb768c34 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -3259,10 +3259,22 @@ "osm.tag.bar" = "bar"; /* Open Street Map term. An ice cream shop is a place where ice cream is sold. */ -"osm.tag.ice_cream" = "amenity=ice_cream"; +"osm.tag.ice_cream" = "ice_cream"; /* Open Street Map term. A pub is a place selling beer and other alcoholic drinks; may also provide food or accommodation (UK). */ -"osm.tag.pub" = "amenity=pub"; +"osm.tag.pub" = "pub"; + +/* Open Street Map term. A coffee shop isa place that typically sells coffee and pastries. */ +"osm.tag.coffee_shop" = "coffee_shop"; + +/* Open Street Map term. A monument is a structure created to commemorate a person. */ +"osm.tag.monument" = "monument"; +/* Other OSM tags... */ +"osm.tag.statue" = "statue"; +"osm.tag.museum" = "museum"; +"osm.tag.historic" = "historic"; +"osm.tag.landmark" = "landmark"; +"osm.tag.cathedral" = "cathedral"; /* Open Street Map term. Used as a display name for place or a location. %@ is a bus stop id, such as "Bus Stop 7" or "Bus Stop B". */ "osm.tag.bus_stop.refed" = "Bus Stop %@"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 84db1034..b5cf2afb 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -58,43 +58,63 @@ extension GDASpatialDataResultEntity: Typeable { //convinence store private func isFood() -> Bool { print("Raw superCategory: \(superCategory)") + guard let category = SuperCategory(rawValue: superCategory) else { print("Failed to map superCategory to SuperCategory enum") return false } print("Mapped category: \(category)") - let isFoodLocation = category == .places && - localizedName.lowercased().contains(GDLocalizedString("osm.tag.restaurant").lowercased()) -// let osmTags = ["amenity=restaurant", "amenity=bar", "amenity=cafe", "amenity=fast_food", "amenity=ice_cream", "amenity=pub"] - - // List of restaurant-related OSM tags using localized strings - print("Transit location check: \(isFoodLocation)") - if isFoodLocation { - print("Food location found: \(localizedName)") + let restaurantTags = [ + GDLocalizedString("osm.tag.restaurant"), + GDLocalizedString("osm.tag.fast_food"), + GDLocalizedString("osm.tag.cafe"), + GDLocalizedString("osm.tag.bar"), + GDLocalizedString("osm.tag.ice_cream"), + GDLocalizedString("osm.tag.pub"), + GDLocalizedString("osm.tag.coffee_shop") + + ] + + let isRestaurantLocation = category == .places && restaurantTags.contains(amenity) + + print("Place name: \(localizedName)") + print("Restaurant location check: \(isRestaurantLocation)") + + if isRestaurantLocation { + print("Restaurant location found with amenity: \(amenity)") } - return isFoodLocation + return isRestaurantLocation } - - - private func isLandmarks() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { return false } - let landmarkKeywords = ["monument", "statue", "museum", "historic", "landmark", "cathedral"] + let landmarkTags = [ + GDLocalizedString("osm.tag.monument"), + GDLocalizedString("osm.tag.statue"), + GDLocalizedString("osm.tag.museum"), + GDLocalizedString("osm.tag.historic"), + GDLocalizedString("osm.tag.landmark"), + GDLocalizedString("osm.tag.cathedral") + ] - for keyword in landmarkKeywords { - if localizedName.lowercased().contains(keyword) { - return true - } - } + let lowercasedAmenity = amenity.lowercased() + + let isLandmarkLocation = landmarkTags.contains(lowercasedAmenity) - return category == .landmarks + // Print the debug statements + print("Place name: \(localizedName)") + print("Landmark location check: \(isLandmarkLocation)") + print("Raw superCategory: \(superCategory)") + print("Mapped category: \(category)") + + return isLandmarkLocation || category == .landmarks } + private func isPark() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { From 60f11c0d8b3e29f4cce58861c9108976aafb23cc Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:11:30 -0400 Subject: [PATCH 13/19] fixed landmark and food - need to fix OSM tags and isPark --- .../en-US.lproj/Localizable.strings | 16 ++++-- .../GDASpatialDataResultEntity+Typeable.swift | 51 ++++++++----------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index fb768c34..b9e3a2fb 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -3250,7 +3250,7 @@ "osm.tag.cafe" = "Cafe"; /* Open Street Map term. Generally a formal eating places with sit-down facilities selling full meals served by waiters and often licensed (where allowed) to sell alcoholic drinks. */ -"osm.tag.restaurant" = "Restaurant"; +"osm.tag.restaurant" = "restaurant"; /* Open Street Map term. Fast food is a place where food that is prepared and served very quickly. */ "osm.tag.fast_food" = "fast_food"; @@ -3310,8 +3310,18 @@ "osm.tag.garden" = "Garden"; /* Open Street Map term. An area of open space for recreational use, usually designed and in semi-natural state with grassy areas, trees and bushes. Parks are usually urban, but not always. */ -"osm.tag.park" = "Park"; - +"osm.tag.park" = "leisure=park"; + +//TODO JON +"osm.tag.garden" = "leisure=garden"; +"osm.tag.playground" = "leisure=playground"; +"osm.tag.nature_reserve" = "leisure=nature_reserve"; +"osm.tag.botanical_garden" = "leisure=botanical_garden"; +"osm.tag.public_garden" = "leisure=public_garden"; +"osm.tag.field" = "leisure=field"; +"osm.tag.reserve" = "leisure=reserve"; +"osm.tag.green_space" = "leisure=green_space"; +"osm.tag.recreation_area" = "leisure=recreation_area"; /* Open Street Map term. A table with benches, ideal for food and rest. */ "osm.tag.picnic_table" = "Picnic Table"; diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index b5cf2afb..17901f1e 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -98,7 +98,6 @@ extension GDASpatialDataResultEntity: Typeable { GDLocalizedString("osm.tag.statue"), GDLocalizedString("osm.tag.museum"), GDLocalizedString("osm.tag.historic"), - GDLocalizedString("osm.tag.landmark"), GDLocalizedString("osm.tag.cathedral") ] @@ -112,7 +111,7 @@ extension GDASpatialDataResultEntity: Typeable { print("Raw superCategory: \(superCategory)") print("Mapped category: \(category)") - return isLandmarkLocation || category == .landmarks + return isLandmarkLocation } @@ -121,40 +120,34 @@ extension GDASpatialDataResultEntity: Typeable { return false } - let parkKeywords = [ - "park", "garden", "green space", "recreation area", "playground", - "nature reserve", "botanical garden", "public garden", "field", "reserve" - ] - - // Keywords to exclude parking lots - let excludeKeywords = [ - "parking lot", "car park", "parking", "garage", "park and ride" + // OSM tags related to parks and green spaces + let parkTags = [ + GDLocalizedString("osm.tag.park"), + GDLocalizedString("osm.tag.garden"), + GDLocalizedString("osm.tag.green_space"), + GDLocalizedString("osm.tag.recreation_area"), + GDLocalizedString("osm.tag.playground"), + GDLocalizedString("osm.tag.nature_reserve"), + GDLocalizedString("osm.tag.botanical_garden"), + GDLocalizedString("osm.tag.public_garden"), + GDLocalizedString("osm.tag.field"), + GDLocalizedString("osm.tag.reserve") ] - let lowercasedName = localizedName.lowercased() + let lowercasedAmenity = amenity.lowercased() - // Check if the name contains any park keyword - var containsParkKeyword = false - for keyword in parkKeywords { - if lowercasedName.contains(keyword) { - containsParkKeyword = true - break - } - } - - // Check if the name contains any exclude keyword - var containsExcludeKeyword = false - for keyword in excludeKeywords { - if lowercasedName.contains(keyword) { - containsExcludeKeyword = true - break - } - } + let isParkLocation = parkTags.contains(lowercasedAmenity) - return containsParkKeyword && !containsExcludeKeyword + print("Place name: \(localizedName)") + print("Park location check: \(isParkLocation)") + print("Raw superCategory: \(superCategory)") + print("Mapped category: \(category)") + + return isParkLocation } + private func isHotel() -> Bool { return false From 0cf1e84a949c8ce9557fcee554a52f6efeea36be Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Sun, 28 Jul 2024 20:58:25 -0400 Subject: [PATCH 14/19] cleanup --- .../AutoCalloutSettingsProvider.swift | 2 +- .../GDASpatialDataResultEntity+Typeable.swift | 59 +++++-------------- 2 files changed, 17 insertions(+), 44 deletions(-) diff --git a/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift b/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift index e331d4bd..5b945ee3 100644 --- a/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift +++ b/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift @@ -10,7 +10,7 @@ protocol AutoCalloutSettingsProvider: AnyObject { var automaticCalloutsEnabled: Bool { get set } var placeSenseEnabled: Bool { get set } var landmarkSenseEnabled: Bool { get set } - var mobilitySenseEnabled: Bool { get set } + var x3SenseEnabled: Bool { get set } var informationSenseEnabled: Bool { get set } var safetySenseEnabled: Bool { get set } var intersectionSenseEnabled: Bool { get set } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 17901f1e..4adc7314 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -43,24 +43,18 @@ extension GDASpatialDataResultEntity: Typeable { private func isTransitStop() -> Bool { print("Raw superCategory: \(superCategory)") guard let category = SuperCategory(rawValue: superCategory) else { - print("Failed to map superCategory to SuperCategory enum") return false } print("Mapped category: \(category)") let isTransitLocation = category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) - print("Transit location check: \(isTransitLocation)") - if isTransitLocation { - print("Transit location found: \(localizedName)") - } + return isTransitLocation } //convinence store private func isFood() -> Bool { - print("Raw superCategory: \(superCategory)") guard let category = SuperCategory(rawValue: superCategory) else { - print("Failed to map superCategory to SuperCategory enum") return false } print("Mapped category: \(category)") @@ -78,13 +72,6 @@ extension GDASpatialDataResultEntity: Typeable { let isRestaurantLocation = category == .places && restaurantTags.contains(amenity) - print("Place name: \(localizedName)") - print("Restaurant location check: \(isRestaurantLocation)") - - if isRestaurantLocation { - print("Restaurant location found with amenity: \(amenity)") - } - return isRestaurantLocation } @@ -105,45 +92,31 @@ extension GDASpatialDataResultEntity: Typeable { let isLandmarkLocation = landmarkTags.contains(lowercasedAmenity) - // Print the debug statements - print("Place name: \(localizedName)") - print("Landmark location check: \(isLandmarkLocation)") - print("Raw superCategory: \(superCategory)") - print("Mapped category: \(category)") - return isLandmarkLocation } private func isPark() -> Bool { - guard let category = SuperCategory(rawValue: superCategory) else { - return false - } + guard let category = SuperCategory(rawValue: superCategory) else { + print("Failed to map superCategory to SuperCategory enum") + return false + } - // OSM tags related to parks and green spaces - let parkTags = [ - GDLocalizedString("osm.tag.park"), - GDLocalizedString("osm.tag.garden"), - GDLocalizedString("osm.tag.green_space"), - GDLocalizedString("osm.tag.recreation_area"), - GDLocalizedString("osm.tag.playground"), - GDLocalizedString("osm.tag.nature_reserve"), - GDLocalizedString("osm.tag.botanical_garden"), - GDLocalizedString("osm.tag.public_garden"), - GDLocalizedString("osm.tag.field"), - GDLocalizedString("osm.tag.reserve") - ] + // OSM tags related to parks and green spaces in English + let parkTags = [ + "park", "garden", "green_space", "recreation_area", "playground", + "nature_reserve", "botanical_garden", "public_garden", "field", "reserve" + ] let lowercasedAmenity = amenity.lowercased() - let isParkLocation = parkTags.contains(lowercasedAmenity) - - print("Place name: \(localizedName)") - print("Park location check: \(isParkLocation)") - print("Raw superCategory: \(superCategory)") - print("Mapped category: \(category)") + let isParkLocation = category == .places && parkTags.contains { tag in tag == lowercasedAmenity } + print("Place name: \(localizedName)") + print("Park location check: \(isParkLocation)") + print("Raw superCategory: \(superCategory)") + print("Mapped category: \(category)") + return isParkLocation - return isParkLocation } From 4b83c944f310f4d3050abb0f2a20345c4575da29 Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:42:30 -0400 Subject: [PATCH 15/19] parks sitll doenst work but landmakrs works now --- .../App/Settings/AutoCalloutSettingsProvider.swift | 2 +- .../GDASpatialDataResultEntity+Typeable.swift | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift b/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift index 5b945ee3..e331d4bd 100644 --- a/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift +++ b/apps/ios/GuideDogs/Code/App/Settings/AutoCalloutSettingsProvider.swift @@ -10,7 +10,7 @@ protocol AutoCalloutSettingsProvider: AnyObject { var automaticCalloutsEnabled: Bool { get set } var placeSenseEnabled: Bool { get set } var landmarkSenseEnabled: Bool { get set } - var x3SenseEnabled: Bool { get set } + var mobilitySenseEnabled: Bool { get set } var informationSenseEnabled: Bool { get set } var safetySenseEnabled: Bool { get set } var intersectionSenseEnabled: Bool { get set } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 4adc7314..76613a80 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -77,9 +77,11 @@ extension GDASpatialDataResultEntity: Typeable { private func isLandmarks() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { + print("Failed to map superCategory to SuperCategory enum") return false } + // OSM tags related to landmarks in English let landmarkTags = [ GDLocalizedString("osm.tag.monument"), GDLocalizedString("osm.tag.statue"), @@ -90,11 +92,17 @@ extension GDASpatialDataResultEntity: Typeable { let lowercasedAmenity = amenity.lowercased() - let isLandmarkLocation = landmarkTags.contains(lowercasedAmenity) - - return isLandmarkLocation + let isLandmarkLocation = category == .landmarks && landmarkTags.contains { tag in tag == lowercasedAmenity } + + print("Place name: \(localizedName)") + print("Landmark location check: \(isLandmarkLocation)") + print("Raw superCategory: \(superCategory)") + print("Mapped category: \(category)") + + return isLandmarkLocation } + private func isPark() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { From 97e660ee21f176048fd9c1010aeaec64dc94a4a2 Mon Sep 17 00:00:00 2001 From: Jonathan Ha <78988736+jonha1@users.noreply.github.com> Date: Thu, 1 Aug 2024 20:04:18 -0400 Subject: [PATCH 16/19] debugging park --- .../GDASpatialDataResultEntity+Typeable.swift | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 76613a80..03257d0a 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -51,7 +51,6 @@ extension GDASpatialDataResultEntity: Typeable { return isTransitLocation } - //convinence store private func isFood() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { @@ -81,13 +80,8 @@ extension GDASpatialDataResultEntity: Typeable { return false } - // OSM tags related to landmarks in English let landmarkTags = [ - GDLocalizedString("osm.tag.monument"), - GDLocalizedString("osm.tag.statue"), - GDLocalizedString("osm.tag.museum"), - GDLocalizedString("osm.tag.historic"), - GDLocalizedString("osm.tag.cathedral") + "monument", "statue", "museum", "historic", "cathedral" ] let lowercasedAmenity = amenity.lowercased() @@ -102,15 +96,12 @@ extension GDASpatialDataResultEntity: Typeable { return isLandmarkLocation } - - private func isPark() -> Bool { guard let category = SuperCategory(rawValue: superCategory) else { print("Failed to map superCategory to SuperCategory enum") return false } - // OSM tags related to parks and green spaces in English let parkTags = [ "park", "garden", "green_space", "recreation_area", "playground", "nature_reserve", "botanical_garden", "public_garden", "field", "reserve" @@ -126,9 +117,6 @@ extension GDASpatialDataResultEntity: Typeable { return isParkLocation } - - - private func isHotel() -> Bool { return false From 3ffa5334d40b91b8272364f39bdf81b0fe949162 Mon Sep 17 00:00:00 2001 From: "Daniel W. Steinbrook" Date: Sat, 7 Sep 2024 17:33:58 -0400 Subject: [PATCH 17/19] Clean up Places Nearby filter implementation --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 -- .../en-GB.lproj/Localizable.strings | Bin 257478 -> 257482 bytes .../en-US.lproj/Localizable.strings | 51 +++++---- .../AuthoredActivityLoader.swift | 4 +- .../GDASpatialDataResultEntity+Typeable.swift | 98 +++++------------- .../Data/Models/Helpers/SuperCategory.swift | 2 - .../Models/Helpers/Types/PrimaryType.swift | 4 +- .../Models/Helpers/Types/SecondaryType.swift | 4 +- .../JSON Parsing/OSM/GeoJsonFeature.swift | 24 ----- .../Nearby Table/NearbyTableFilter.swift | 40 +++---- 10 files changed, 82 insertions(+), 153 deletions(-) delete mode 100644 apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/apps/ios/GuideDogs.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings index 7d238dbc9a85f6ba6312e8711b41cac579a036d4..73bd2eb8964ee2e829dce12ce212b913674ac8a2 100644 GIT binary patch delta 30 kcmX?hoBz~p{)R1#US`uT$ubMIN0>1JG1K-4Gv>VQ0K<0+PXGV_ delta 55 zcmX?goB!Bt{)R1#US`4y47Lmk3;_&@3`Gpt48;se4A#>p<}gW4PcUWVX>T)Q1Y)M` JZD!0a+X2aR59$B_ diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index b9e3a2fb..fb7e6a50 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1533,11 +1533,21 @@ /* Filters, Transit */ "filter.transit" = "Public Transit"; -/* Filters, Landmarks */ -"filter.landmarks" = "Landmarks"; +/* Filters, Food & Drink */ +"filter.food_drink" = "Food & Drink"; /* Filters, Parks */ -"filter.park" = "Park"; +"filter.parks" = "Parks"; + +/* Filter, Things To Do */ +"filter.things_to_do" = "Things to do"; + +/* Filters, Groceries & Convenience Stores */ +"filter.groceries" = "Groceries & Convenience Stores"; + +/* Filters, Banks & ATMs */ +"filter.banks" = "Banks & ATMs"; + /* Displayed next to the name of the filter to indicate that the filter is currently selected. %@ is the name of a filter */ "filter.selected" = "%@ (selected)"; @@ -3268,13 +3278,13 @@ "osm.tag.coffee_shop" = "coffee_shop"; /* Open Street Map term. A monument is a structure created to commemorate a person. */ -"osm.tag.monument" = "monument"; +"osm.tag.monument" = "Monument"; /* Other OSM tags... */ -"osm.tag.statue" = "statue"; -"osm.tag.museum" = "museum"; -"osm.tag.historic" = "historic"; -"osm.tag.landmark" = "landmark"; -"osm.tag.cathedral" = "cathedral"; +"osm.tag.statue" = "Statue"; +"osm.tag.museum" = "Museum"; +"osm.tag.historic" = "Historic"; +"osm.tag.landmark" = "Landmark"; +"osm.tag.cathedral" = "Cathedral"; /* Open Street Map term. Used as a display name for place or a location. %@ is a bus stop id, such as "Bus Stop 7" or "Bus Stop B". */ "osm.tag.bus_stop.refed" = "Bus Stop %@"; @@ -3310,18 +3320,17 @@ "osm.tag.garden" = "Garden"; /* Open Street Map term. An area of open space for recreational use, usually designed and in semi-natural state with grassy areas, trees and bushes. Parks are usually urban, but not always. */ -"osm.tag.park" = "leisure=park"; - -//TODO JON -"osm.tag.garden" = "leisure=garden"; -"osm.tag.playground" = "leisure=playground"; -"osm.tag.nature_reserve" = "leisure=nature_reserve"; -"osm.tag.botanical_garden" = "leisure=botanical_garden"; -"osm.tag.public_garden" = "leisure=public_garden"; -"osm.tag.field" = "leisure=field"; -"osm.tag.reserve" = "leisure=reserve"; -"osm.tag.green_space" = "leisure=green_space"; -"osm.tag.recreation_area" = "leisure=recreation_area"; +"osm.tag.park" = "Park"; + +"osm.tag.playground" = "Playground"; +"osm.tag.nature_reserve" = "Nature Reserve"; +"osm.tag.botanical_garden" = "Botanical Garden"; +"osm.tag.public_garden" = "Public Garden"; +"osm.tag.field" = "Field"; +"osm.tag.reserve" = "Reserve"; +"osm.tag.green_space" = "Green Space"; +"osm.tag.recreation_area" = "Recreation Area"; + /* Open Street Map term. A table with benches, ideal for food and rest. */ "osm.tag.picnic_table" = "Picnic Table"; diff --git a/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift b/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift index 13008e06..8b87bd40 100644 --- a/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift +++ b/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift @@ -512,7 +512,7 @@ class AuthoredActivityLoader { for (wptIndex, waypoint) in content.waypoints.enumerated() { for (clipIndex, image) in waypoint.images.enumerated() { - guard let key = manager.cacheKey(for: image.url), await manager.imageCache.containsImage!(forKey: key, cacheType: .all) == .none else { + guard let key = manager.cacheKey(for: image.url), await manager.imageCache.containsImage(forKey: key, cacheType: .all) == .none else { GDLogInfo(.authoredContent, "Image \(image.url.lastPathComponent) already cached (waypoint: \(wptIndex), clip: \(clipIndex))") continue } @@ -554,7 +554,7 @@ class AuthoredActivityLoader { for image in images { if let key = manager.cacheKey(for: image) { - manager.imageCache.removeImage!(forKey: key, cacheType: .all) + manager.imageCache.removeImage(forKey: key, cacheType: .all) } } } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift index 03257d0a..eb3fe6c4 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Extensions/OSM Entity/GDASpatialDataResultEntity+Typeable.swift @@ -16,12 +16,12 @@ extension GDASpatialDataResultEntity: Typeable { return isOfType(.transitStop) case .food: return isFood() - case .landmarks: - return isLandmarks() case .park: return isPark() - case .hotel: - return isHotel() + case .bank: + return isBank() + case .grocery: + return isGrocery() } } @@ -31,94 +31,48 @@ extension GDASpatialDataResultEntity: Typeable { return isTransitStop() case .food: return isFood() - case .landmarks: - return isLandmarks() case .park: return isPark() - case .hotel: - return isHotel() + case .bank: + return isBank() + case .grocery: + return isGrocery() } } private func isTransitStop() -> Bool { - print("Raw superCategory: \(superCategory)") guard let category = SuperCategory(rawValue: superCategory) else { return false } - print("Mapped category: \(category)") let isTransitLocation = category == .mobility && localizedName.lowercased().contains(GDLocalizedString("osm.tag.bus_stop").lowercased()) return isTransitLocation } - private func isFood() -> Bool { - - guard let category = SuperCategory(rawValue: superCategory) else { - return false - } - print("Mapped category: \(category)") - - let restaurantTags = [ - GDLocalizedString("osm.tag.restaurant"), - GDLocalizedString("osm.tag.fast_food"), - GDLocalizedString("osm.tag.cafe"), - GDLocalizedString("osm.tag.bar"), - GDLocalizedString("osm.tag.ice_cream"), - GDLocalizedString("osm.tag.pub"), - GDLocalizedString("osm.tag.coffee_shop") - - ] - - let isRestaurantLocation = category == .places && restaurantTags.contains(amenity) - - return isRestaurantLocation + /// All filters follow the same pattern: is amenity any one of a set of tags? + private func isAnyOf(tags: Array) -> Bool { + return tags.contains(amenity) } - private func isLandmarks() -> Bool { - guard let category = SuperCategory(rawValue: superCategory) else { - print("Failed to map superCategory to SuperCategory enum") - return false - } - - let landmarkTags = [ - "monument", "statue", "museum", "historic", "cathedral" - ] - - let lowercasedAmenity = amenity.lowercased() - - let isLandmarkLocation = category == .landmarks && landmarkTags.contains { tag in tag == lowercasedAmenity } - - print("Place name: \(localizedName)") - print("Landmark location check: \(isLandmarkLocation)") - print("Raw superCategory: \(superCategory)") - print("Mapped category: \(category)") - - return isLandmarkLocation + private func isFood() -> Bool { + return isAnyOf(tags: [ + "restaurant", "fast_food", "cafe", "bar", "ice_cream", "pub", + "coffee_shop" + ]); } private func isPark() -> Bool { - guard let category = SuperCategory(rawValue: superCategory) else { - print("Failed to map superCategory to SuperCategory enum") - return false - } - - let parkTags = [ - "park", "garden", "green_space", "recreation_area", "playground", - "nature_reserve", "botanical_garden", "public_garden", "field", "reserve" - ] - - let lowercasedAmenity = amenity.lowercased() - - let isParkLocation = category == .places && parkTags.contains { tag in tag == lowercasedAmenity } - print("Place name: \(localizedName)") - print("Park location check: \(isParkLocation)") - print("Raw superCategory: \(superCategory)") - print("Mapped category: \(category)") - return isParkLocation + return isAnyOf(tags: [ + "park", "garden", "green_space", "recreation_area", "playground", + "nature_reserve", "botanical_garden", "public_garden", "field", "reserve" + ]); + } + private func isBank() -> Bool { + return isAnyOf(tags: ["bank", "atm"]); } - - private func isHotel() -> Bool { - return false + + private func isGrocery() -> Bool { + return isAnyOf(tags: ["convenience", "supermarket"]); } } diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift index 9e3f6917..e7d043b1 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/SuperCategory.swift @@ -21,8 +21,6 @@ enum SuperCategory: String { case landmarks = "landmark" case places = "place" case mobility = "mobility" - case foods = "food" - case parks = "park" case information = "information" case objects = "object" case safety = "safety" diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift index eb70afc7..64b98c3f 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/PrimaryType.swift @@ -12,9 +12,9 @@ enum PrimaryType: String, CaseIterable, Type { case transit case food - case landmarks case park - case hotel + case bank + case grocery func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift index 41c28f0a..839bba6b 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/Helpers/Types/SecondaryType.swift @@ -12,9 +12,9 @@ enum SecondaryType: Type { case transitStop case food - case landmarks case park - case hotel + case bank + case grocery func matches(poi: POI) -> Bool { guard let typeable = poi as? Typeable else { diff --git a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift index 8ef95069..1bc9e9eb 100644 --- a/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift +++ b/apps/ios/GuideDogs/Code/Data/Models/JSON Parsing/OSM/GeoJsonFeature.swift @@ -207,30 +207,6 @@ class GeoJsonFeature { return } - //TODO JON - if value == "fast_food"{ - superCategory = SuperCategory.foods - return - } - - if value == "restaurants"{ - superCategory = SuperCategory.foods - return - } - - - if value == "food"{ - superCategory = SuperCategory.foods - return - } - - - if value == "deli"{ - superCategory = SuperCategory.foods - return - } - - // Case: Banks if value == "bank" { superCategory = SuperCategory.places diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index 16c7f36b..ea5f8c94 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -21,9 +21,9 @@ struct NearbyTableFilter: Equatable { .defaultFilter, NearbyTableFilter(type: .transit), NearbyTableFilter(type: .food), - NearbyTableFilter(type: .landmarks), NearbyTableFilter(type: .park), - NearbyTableFilter(type: .hotel) + NearbyTableFilter(type: .grocery), + NearbyTableFilter(type: .bank), ] } @@ -54,24 +54,24 @@ struct NearbyTableFilter: Equatable { self.type = type if let type = type { - switch type { - case .transit: - self.localizedString = GDLocalizedString("filter.transit") - self.image = UIImage(named: "Transit") - case .food: - self.localizedString = GDLocalizedString("filter.food_drink") - self.image = UIImage(named: "Food and Drinks") - case .landmarks: - self.localizedString = GDLocalizedString("filter.landmarks") - self.image = UIImage(named: "Landmarks") - case .park: - self.localizedString = GDLocalizedString("filter.park") - self.image = UIImage(named: "Parks") - case .hotel: - self.localizedString = GDLocalizedString("filter.hotel") - self.image = UIImage(named: "Hotel") - } - } else { + switch type { + case .transit: + self.localizedString = GDLocalizedString("filter.transit") + self.image = UIImage(named: "Transit") + case .food: + self.localizedString = GDLocalizedString("filter.food_drink") + self.image = UIImage(named: "Food and Drinks") + case .park: + self.localizedString = GDLocalizedString("filter.parks") + self.image = UIImage(named: "Parks") + case .bank: + self.localizedString = GDLocalizedString("filter.banks") + self.image = UIImage(named: "Banks & ATMs") + case .grocery: + self.localizedString = GDLocalizedString("filter.groceries") + self.image = UIImage(named: "Groceries") + } + } else { // There is no `PrimaryType` filter selected self.localizedString = GDLocalizedString("filter.all") self.image = UIImage(named: "AllPlaces") From 02d7c31175dc140e15398be9d32662aaa9270af7 Mon Sep 17 00:00:00 2001 From: "Daniel W. Steinbrook" Date: Sun, 8 Sep 2024 11:57:20 -0400 Subject: [PATCH 18/19] Revert changes to AuthoredActivityLoader.swift --- .../Data/Authored Activities/AuthoredActivityLoader.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift b/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift index 8b87bd40..13008e06 100644 --- a/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift +++ b/apps/ios/GuideDogs/Code/Data/Authored Activities/AuthoredActivityLoader.swift @@ -512,7 +512,7 @@ class AuthoredActivityLoader { for (wptIndex, waypoint) in content.waypoints.enumerated() { for (clipIndex, image) in waypoint.images.enumerated() { - guard let key = manager.cacheKey(for: image.url), await manager.imageCache.containsImage(forKey: key, cacheType: .all) == .none else { + guard let key = manager.cacheKey(for: image.url), await manager.imageCache.containsImage!(forKey: key, cacheType: .all) == .none else { GDLogInfo(.authoredContent, "Image \(image.url.lastPathComponent) already cached (waypoint: \(wptIndex), clip: \(clipIndex))") continue } @@ -554,7 +554,7 @@ class AuthoredActivityLoader { for image in images { if let key = manager.cacheKey(for: image) { - manager.imageCache.removeImage(forKey: key, cacheType: .all) + manager.imageCache.removeImage!(forKey: key, cacheType: .all) } } } From fc6cb05e32b1feb25fc0dc45999e294ce71a89b1 Mon Sep 17 00:00:00 2001 From: "Daniel W. Steinbrook" Date: Sun, 8 Sep 2024 14:13:50 -0400 Subject: [PATCH 19/19] Fix NearbyTableFilterTest switch --- .../Nearby Table/NearbyTableFilter.swift | 36 +++++++++---------- .../NearbyTableFilterTest.swift | 20 +++++------ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift index ea5f8c94..ce759556 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Helpers/Nearby Table/NearbyTableFilter.swift @@ -54,24 +54,24 @@ struct NearbyTableFilter: Equatable { self.type = type if let type = type { - switch type { - case .transit: - self.localizedString = GDLocalizedString("filter.transit") - self.image = UIImage(named: "Transit") - case .food: - self.localizedString = GDLocalizedString("filter.food_drink") - self.image = UIImage(named: "Food and Drinks") - case .park: - self.localizedString = GDLocalizedString("filter.parks") - self.image = UIImage(named: "Parks") - case .bank: - self.localizedString = GDLocalizedString("filter.banks") - self.image = UIImage(named: "Banks & ATMs") - case .grocery: - self.localizedString = GDLocalizedString("filter.groceries") - self.image = UIImage(named: "Groceries") - } - } else { + switch type { + case .transit: + self.localizedString = GDLocalizedString("filter.transit") + self.image = UIImage(named: "Transit") + case .food: + self.localizedString = GDLocalizedString("filter.food_drink") + self.image = UIImage(named: "Food & Drink") + case .park: + self.localizedString = GDLocalizedString("filter.parks") + self.image = UIImage(named: "Parks") + case .bank: + self.localizedString = GDLocalizedString("filter.banks") + self.image = UIImage(named: "Banks & ATMs") + case .grocery: + self.localizedString = GDLocalizedString("filter.groceries") + self.image = UIImage(named: "Groceries & Convenience Stores") + } + } else { // There is no `PrimaryType` filter selected self.localizedString = GDLocalizedString("filter.all") self.image = UIImage(named: "AllPlaces") diff --git a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift index c891f386..0065b990 100644 --- a/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift +++ b/apps/ios/UnitTests/Data/Destination Manager/NearbyTableFilterTest.swift @@ -38,16 +38,16 @@ final class NearbyTableFilterTest: XCTestCase { XCTAssertEqual(filter.image, UIImage(named: "Transit")) case .food: XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.food_drink")) - XCTAssertEqual(filter.image, UIImage(named: "Food")) - case .landmarks: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.landmarks")) - XCTAssertEqual(filter.image, UIImage(named: "Landmarks")) - case .business: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.business")) - XCTAssertEqual(filter.image, UIImage(named: "Business")) - case .hotel: - XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.hotel")) - XCTAssertEqual(filter.image, UIImage(named: "Hotel")) + XCTAssertEqual(filter.image, UIImage(named: "Food & Drink")) + case .park: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.parks")) + XCTAssertEqual(filter.image, UIImage(named: "Parks")) + case .bank: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.banks")) + XCTAssertEqual(filter.image, UIImage(named: "Banks & ATMs")) + case .grocery: + XCTAssertEqual(filter.localizedString, GDLocalizedString("filter.groceries")) + XCTAssertEqual(filter.image, UIImage(named: "Groceries & Convenience Stores ")) } } }