diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9bf40ff..237bfb0ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,13 +20,7 @@ Guide: https://keepachangelog.com/en/1.0.0/ - [Privacy] Add Search history collected data for the purpose of product personalization (used for displaying the search history) -- [Discover, Category] Rename Discover to Category and update tests. -- [Category] Rename Discover.Query.Category to Category.Item -- [Category] Move Category.Item "Hot" suggested categories to MapboxSearch out of MapboxSearchUI. - - This adds legacyName (use with Geocoding API engine) and icon fields to the MapboxSearch suggested categories. - - Image assets for these categories remain in MapboxSearchUI. - - This Category.Item replaces MapboxSearchUI.SearchCategory. - - Add an alias for MapboxSearchUI.SearchCategory = MapboxSearch.Category.Item +- [Discover, Category] Discover API to query categories remains available and compatible with 1.0.0 series. - [Core] Default API engine type remains SBS and search-box is available by opt-in. - [License] Update license to reflect 2024 usage diff --git a/MapboxSearch.xcodeproj/project.pbxproj b/MapboxSearch.xcodeproj/project.pbxproj index e526c36f4..59c762adb 100644 --- a/MapboxSearch.xcodeproj/project.pbxproj +++ b/MapboxSearch.xcodeproj/project.pbxproj @@ -38,12 +38,11 @@ 04AB0B4B2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; 04AB0B4C2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; 04AB0B4D2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json in Resources */ = {isa = PBXBuildFile; fileRef = 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */; }; - 04AB0B7B2B6AF43E00FDE7D5 /* CategoryIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AB0B792B6AF37800FDE7D5 /* CategoryIntegrationTests.swift */; }; + 04AB0B7B2B6AF43E00FDE7D5 /* DiscoverIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AB0B792B6AF37800FDE7D5 /* DiscoverIntegrationTests.swift */; }; + 04B3CDF72BB1C7C9002E766E /* SearchCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04B3CDF62BB1C7C9002E766E /* SearchCategory.swift */; }; + 04B3CDF92BB1C7F9002E766E /* Categories.strings in Resources */ = {isa = PBXBuildFile; fileRef = FE049959261CA44500E575A2 /* Categories.strings */; }; 04BBC6342B61898F00E24E99 /* LocalhostMockServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04BBC6332B61898F00E24E99 /* LocalhostMockServiceProvider.swift */; }; 04BBC6372B61ABA500E24E99 /* FeedbackUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9BBFBD02604A4A500DE9C98 /* FeedbackUITestCase.swift */; }; - 04BBF17C2B91180E00A056AD /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04BBF17B2B91180E00A056AD /* Strings.swift */; }; - 04BBF17E2B9118B400A056AD /* Bundle+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04BBF17D2B9118B400A056AD /* Bundle+Extensions.swift */; }; - 04BBF17F2B911C7800A056AD /* Categories.strings in Resources */ = {isa = PBXBuildFile; fileRef = FE049959261CA44500E575A2 /* Categories.strings */; }; 04C0848D2B4C82F3002F9C69 /* SdkInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */; }; 04C127552B62F6BC00884325 /* ApiType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C127542B62F6BC00884325 /* ApiType.swift */; }; 04C127582B62FFDB00884325 /* ApiType+Core.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C127572B62FFDB00884325 /* ApiType+Core.swift */; }; @@ -67,10 +66,10 @@ 04E84D122B76BA230056C269 /* Resources-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 04E84D112B76BA230056C269 /* Resources-Info.plist */; }; 04E84D132B7A8F4D0056C269 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 04E84D072B7691610056C269 /* PrivacyInfo.xcprivacy */; }; 140D1BDC286DB479001A51C2 /* SearchResultAccuracy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */; }; - 140E47A2298BC90E00677E30 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A1298BC90E00677E30 /* Category.swift */; }; - 140E47A5298BC94D00677E30 /* Category+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A4298BC94D00677E30 /* Category+Options.swift */; }; - 140E47A7298BCBDF00677E30 /* Category+Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A6298BCBDF00677E30 /* Category+Item.swift */; }; - 140E47AA298BE3A200677E30 /* Category+Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A9298BE3A200677E30 /* Category+Result.swift */; }; + 140E47A2298BC90E00677E30 /* Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A1298BC90E00677E30 /* Discover.swift */; }; + 140E47A5298BC94D00677E30 /* Discover+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A4298BC94D00677E30 /* Discover+Options.swift */; }; + 140E47A7298BCBDF00677E30 /* Discover+Query+Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A6298BCBDF00677E30 /* Discover+Query+Category.swift */; }; + 140E47AA298BE3A200677E30 /* Discover+Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140E47A9298BE3A200677E30 /* Discover+Result.swift */; }; 14173C2E28783E1000B20E1C /* Country+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14173C2D28783E1000B20E1C /* Country+Tests.swift */; }; 14173C302878437D00B20E1C /* Country+ISO3166-1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14173C2F2878437D00B20E1C /* Country+ISO3166-1.swift */; }; 14173C332878476400B20E1C /* Language+ISO639-1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14173C322878476400B20E1C /* Language+ISO639-1.swift */; }; @@ -86,7 +85,7 @@ 143695F72899291200861F1A /* UIApplication+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 143695F5289927FD00861F1A /* UIApplication+Extensions.swift */; }; 1440BF4D28FD75A9009B3679 /* AddressAutofillMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1440BF4C28FD75A9009B3679 /* AddressAutofillMainViewController.swift */; }; 1440BF4F290019AD009B3679 /* AddressAutofillResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1440BF4E290019AD009B3679 /* AddressAutofillResultViewController.swift */; }; - 144F32F2298D1FCD0082B2D5 /* Category+Address.swift in Sources */ = {isa = PBXBuildFile; fileRef = 144F32F1298D1FCD0082B2D5 /* Category+Address.swift */; }; + 144F32F2298D1FCD0082B2D5 /* Discover+Address.swift in Sources */ = {isa = PBXBuildFile; fileRef = 144F32F1298D1FCD0082B2D5 /* Discover+Address.swift */; }; 144F32F5298D21E70082B2D5 /* AddressComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 144F32F4298D21E70082B2D5 /* AddressComponents.swift */; }; 1488F78329A7AD5800CF373B /* CoreUserActivityReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1488F78229A7AD5800CF373B /* CoreUserActivityReporter.swift */; }; 1488F78629A7C23500CF373B /* CoreUserActivityReporterStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1488F78429A7C22F00CF373B /* CoreUserActivityReporterStub.swift */; }; @@ -103,7 +102,7 @@ 149948EF290A8DD500E7E619 /* Swifter in Frameworks */ = {isa = PBXBuildFile; productRef = 149948EE290A8DD500E7E619 /* Swifter */; }; 149948F1290A8DF900E7E619 /* Swifter in Frameworks */ = {isa = PBXBuildFile; productRef = 149948F0290A8DF900E7E619 /* Swifter */; settings = {ATTRIBUTES = (Required, ); }; }; 14A0B83D2A5FF20B00D281F1 /* PlaceAutocomplet.Result+Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A0B83B2A5FF1B300D281F1 /* PlaceAutocomplet.Result+Tests.swift */; }; - 14B92D5E298BFD19006003C1 /* CategoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B92D5D298BFD19006003C1 /* CategoryViewController.swift */; }; + 14B92D5E298BFD19006003C1 /* DiscoverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14B92D5D298BFD19006003C1 /* DiscoverViewController.swift */; }; 14F71865299FD4BD00D5BC2E /* PlaceAutocomplete+PlaceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F71864299FD4BD00D5BC2E /* PlaceAutocomplete+PlaceType.swift */; }; 14F7186B29A1361700D5BC2E /* PlaceAutocompleteMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F7186929A1341A00D5BC2E /* PlaceAutocompleteMainViewController.swift */; }; 14F7186D29A139BF00D5BC2E /* PlaceAutocompleteDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F7186C29A139BF00D5BC2E /* PlaceAutocompleteDetailsViewController.swift */; }; @@ -407,7 +406,6 @@ FEEDD36C2508E02700DC0A98 /* FavoritesTableViewSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD33A2508E02700DC0A98 /* FavoritesTableViewSource.swift */; }; FEEDD36D2508E02700DC0A98 /* SearchTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD33B2508E02700DC0A98 /* SearchTextField.swift */; }; FEEDD36E2508E02700DC0A98 /* DragIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD33C2508E02700DC0A98 /* DragIndicator.swift */; }; - FEEDD36F2508E02700DC0A98 /* Category+MapboxSearchUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD33D2508E02700DC0A98 /* Category+MapboxSearchUI.swift */; }; FEEDD3702508E02700DC0A98 /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD33E2508E02700DC0A98 /* Images.swift */; }; FEEDD3722508E02700DC0A98 /* CategoriesTableViewSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD3402508E02700DC0A98 /* CategoriesTableViewSource.swift */; }; FEEDD3732508E02700DC0A98 /* CategoriesFavoritesSegmentControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEEDD3412508E02700DC0A98 /* CategoriesFavoritesSegmentControl.swift */; }; @@ -544,11 +542,10 @@ 0477904C2B890F4E00A99528 /* search-box-retrieve-minsk.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "search-box-retrieve-minsk.json"; sourceTree = ""; }; 04970F8C2B7A97C900213763 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04AB0B4A2B6AADB700FDE7D5 /* mapbox.places.san.francisco.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = mapbox.places.san.francisco.json; sourceTree = ""; }; - 04AB0B792B6AF37800FDE7D5 /* CategoryIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryIntegrationTests.swift; sourceTree = ""; }; + 04AB0B792B6AF37800FDE7D5 /* DiscoverIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoverIntegrationTests.swift; sourceTree = ""; }; 04AB0B7C2B6B043C00FDE7D5 /* category-hotel-search-along-route-jp.json */ = {isa = PBXFileReference; explicitFileType = text.json; path = "category-hotel-search-along-route-jp.json"; sourceTree = ""; }; + 04B3CDF62BB1C7C9002E766E /* SearchCategory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchCategory.swift; sourceTree = ""; }; 04BBC6332B61898F00E24E99 /* LocalhostMockServiceProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalhostMockServiceProvider.swift; sourceTree = ""; }; - 04BBF17B2B91180E00A056AD /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = ""; }; - 04BBF17D2B9118B400A056AD /* Bundle+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Extensions.swift"; sourceTree = ""; }; 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SdkInformation.swift; sourceTree = ""; }; 04C127542B62F6BC00884325 /* ApiType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiType.swift; sourceTree = ""; }; 04C127572B62FFDB00884325 /* ApiType+Core.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ApiType+Core.swift"; sourceTree = ""; }; @@ -569,10 +566,10 @@ 04E84D072B7691610056C269 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 04E84D112B76BA230056C269 /* Resources-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Resources-Info.plist"; sourceTree = ""; }; 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultAccuracy.swift; sourceTree = ""; }; - 140E47A1298BC90E00677E30 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; - 140E47A4298BC94D00677E30 /* Category+Options.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Category+Options.swift"; sourceTree = ""; }; - 140E47A6298BCBDF00677E30 /* Category+Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Category+Item.swift"; sourceTree = ""; }; - 140E47A9298BE3A200677E30 /* Category+Result.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Category+Result.swift"; sourceTree = ""; }; + 140E47A1298BC90E00677E30 /* Discover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Discover.swift; sourceTree = ""; }; + 140E47A4298BC94D00677E30 /* Discover+Options.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Discover+Options.swift"; sourceTree = ""; }; + 140E47A6298BCBDF00677E30 /* Discover+Query+Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Discover+Query+Category.swift"; sourceTree = ""; }; + 140E47A9298BE3A200677E30 /* Discover+Result.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Discover+Result.swift"; sourceTree = ""; }; 14173C2D28783E1000B20E1C /* Country+Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Country+Tests.swift"; sourceTree = ""; }; 14173C2F2878437D00B20E1C /* Country+ISO3166-1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Country+ISO3166-1.swift"; sourceTree = ""; }; 14173C322878476400B20E1C /* Language+ISO639-1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Language+ISO639-1.swift"; sourceTree = ""; }; @@ -587,7 +584,7 @@ 143695F5289927FD00861F1A /* UIApplication+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extensions.swift"; sourceTree = ""; }; 1440BF4C28FD75A9009B3679 /* AddressAutofillMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressAutofillMainViewController.swift; sourceTree = ""; }; 1440BF4E290019AD009B3679 /* AddressAutofillResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressAutofillResultViewController.swift; sourceTree = ""; }; - 144F32F1298D1FCD0082B2D5 /* Category+Address.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Category+Address.swift"; sourceTree = ""; }; + 144F32F1298D1FCD0082B2D5 /* Discover+Address.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Discover+Address.swift"; sourceTree = ""; }; 144F32F4298D21E70082B2D5 /* AddressComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressComponents.swift; sourceTree = ""; }; 1488F78229A7AD5800CF373B /* CoreUserActivityReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreUserActivityReporter.swift; sourceTree = ""; }; 1488F78429A7C22F00CF373B /* CoreUserActivityReporterStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreUserActivityReporterStub.swift; sourceTree = ""; }; @@ -601,7 +598,7 @@ 148DE670285777180085684D /* NSLocking+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLocking+Extensions.swift"; sourceTree = ""; }; 148DE68A285A18900085684D /* AddressAutofill+AddressComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressAutofill+AddressComponent.swift"; sourceTree = ""; }; 14A0B83B2A5FF1B300D281F1 /* PlaceAutocomplet.Result+Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PlaceAutocomplet.Result+Tests.swift"; sourceTree = ""; }; - 14B92D5D298BFD19006003C1 /* CategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryViewController.swift; sourceTree = ""; }; + 14B92D5D298BFD19006003C1 /* DiscoverViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoverViewController.swift; sourceTree = ""; }; 14F71864299FD4BD00D5BC2E /* PlaceAutocomplete+PlaceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PlaceAutocomplete+PlaceType.swift"; sourceTree = ""; }; 14F7186929A1341A00D5BC2E /* PlaceAutocompleteMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceAutocompleteMainViewController.swift; sourceTree = ""; }; 14F7186C29A139BF00D5BC2E /* PlaceAutocompleteDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceAutocompleteDetailsViewController.swift; sourceTree = ""; }; @@ -856,7 +853,6 @@ FEEDD33A2508E02700DC0A98 /* FavoritesTableViewSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FavoritesTableViewSource.swift; sourceTree = ""; }; FEEDD33B2508E02700DC0A98 /* SearchTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchTextField.swift; sourceTree = ""; }; FEEDD33C2508E02700DC0A98 /* DragIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragIndicator.swift; sourceTree = ""; }; - FEEDD33D2508E02700DC0A98 /* Category+MapboxSearchUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Category+MapboxSearchUI.swift"; sourceTree = ""; }; FEEDD33E2508E02700DC0A98 /* Images.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = ""; }; FEEDD33F2508E02700DC0A98 /* ActivityProgressView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ActivityProgressView.xib; sourceTree = ""; }; FEEDD3402508E02700DC0A98 /* CategoriesTableViewSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CategoriesTableViewSource.swift; sourceTree = ""; }; @@ -1059,6 +1055,7 @@ 04970F8B2B7A97C900213763 /* Resources */ = { isa = PBXGroup; children = ( + FE049959261CA44500E575A2 /* Categories.strings */, 04970F8C2B7A97C900213763 /* PrivacyInfo.xcprivacy */, ); path = Resources; @@ -1100,22 +1097,22 @@ path = Resources; sourceTree = ""; }; - 140E47A0298BC8F800677E30 /* Category */ = { + 140E47A0298BC8F800677E30 /* Discover */ = { isa = PBXGroup; children = ( 140E47A3298BC94000677E30 /* Models */, - 140E47A1298BC90E00677E30 /* Category.swift */, + 140E47A1298BC90E00677E30 /* Discover.swift */, ); - path = Category; + path = Discover; sourceTree = ""; }; 140E47A3298BC94000677E30 /* Models */ = { isa = PBXGroup; children = ( - 140E47A4298BC94D00677E30 /* Category+Options.swift */, - 140E47A6298BCBDF00677E30 /* Category+Item.swift */, - 140E47A9298BE3A200677E30 /* Category+Result.swift */, - 144F32F1298D1FCD0082B2D5 /* Category+Address.swift */, + 140E47A4298BC94D00677E30 /* Discover+Options.swift */, + 140E47A6298BCBDF00677E30 /* Discover+Query+Category.swift */, + 140E47A9298BE3A200677E30 /* Discover+Result.swift */, + 144F32F1298D1FCD0082B2D5 /* Discover+Address.swift */, ); path = Models; sourceTree = ""; @@ -1323,7 +1320,7 @@ isa = PBXGroup; children = ( 144F32F3298D21D70082B2D5 /* Address Components */, - 140E47A0298BC8F800677E30 /* Category */, + 140E47A0298BC8F800677E30 /* Discover */, 142141672953447D00774439 /* Place Autocomplete */, 148DE65B28574E560085684D /* Address Autofill */, ); @@ -1355,7 +1352,6 @@ isa = PBXGroup; children = ( 148DE660285750100085684D /* Models */, - 04BBF17D2B9118B400A056AD /* Bundle+Extensions.swift */, ); path = Common; sourceTree = ""; @@ -1397,7 +1393,7 @@ 14B92D5C298BFD04006003C1 /* Category */ = { isa = PBXGroup; children = ( - 14B92D5D298BFD19006003C1 /* CategoryViewController.swift */, + 14B92D5D298BFD19006003C1 /* DiscoverViewController.swift */, ); name = Category; sourceTree = ""; @@ -1641,7 +1637,7 @@ 042477C12B7290E700D870D5 /* SearchEngineGeocodingIntegrationTests.swift */, F99190422645ABE6009927A6 /* CategorySearchEngineIntegrationTests.swift */, 046818D22B87F2810082B188 /* search-box */, - 04AB0B792B6AF37800FDE7D5 /* CategoryIntegrationTests.swift */, + 04AB0B792B6AF37800FDE7D5 /* DiscoverIntegrationTests.swift */, F9C5572C2670C88E00BE8B94 /* Info.plist */, ); path = MapboxSearchIntegrationTests; @@ -1800,8 +1796,6 @@ F998AED725D17DFF00230F34 /* SearchResponseInfo.swift */, FEEDD2DF2508DFE400DC0A98 /* ServiceProvider.swift */, 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */, - 04BBF17B2B91180E00A056AD /* Strings.swift */, - FE049959261CA44500E575A2 /* Categories.strings */, ); path = PublicAPI; sourceTree = ""; @@ -1842,7 +1836,6 @@ FEEDD34B2508E02700DC0A98 /* CategoriesProvider.swift */, FEEDD32E2508E02700DC0A98 /* CategoriesTableViewCell.swift */, FEEDD3402508E02700DC0A98 /* CategoriesTableViewSource.swift */, - FEEDD33D2508E02700DC0A98 /* Category+MapboxSearchUI.swift */, FE49CF6A2510EF7C0059C189 /* CategoryDataProvider.swift */, F98E086025386D7F00FDAD1F /* CategorySuggestionsController.swift */, F96535A72538AD380066D699 /* CategorySuggestionsController.xib */, @@ -1874,6 +1867,7 @@ FEEDD3382508E02700DC0A98 /* Reachability.swift */, FEEDD3372508E02700DC0A98 /* SearchBar.swift */, FEEDD32F2508E02700DC0A98 /* SearchBar.xib */, + 04B3CDF62BB1C7C9002E766E /* SearchCategory.swift */, FEEDD3292508E02700DC0A98 /* SearchCategoriesRootView.swift */, FEEDD3502508E02700DC0A98 /* SearchCategoriesRootView.xib */, FEEDD34D2508E02700DC0A98 /* SearchErrorView.swift */, @@ -2210,7 +2204,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 04BBF17F2B911C7800A056AD /* Categories.strings in Resources */, 04E84D132B7A8F4D0056C269 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2351,6 +2344,7 @@ F96535B82538B39D0066D699 /* CategorySuggestionsController.xib in Resources */, FEBB7AE02508F16100B331C3 /* MapboxSearchController.xib in Resources */, FEBB7ADC2508F16100B331C3 /* CategoriesFavoritesSegmentControl.xib in Resources */, + 04B3CDF92BB1C7F9002E766E /* Categories.strings in Resources */, FEBB7ADD2508F16100B331C3 /* FavoriteDetails.xib in Resources */, F9284FF625AC866400C74903 /* SendFeedbackController.xib in Resources */, FEBB7ADE2508F16100B331C3 /* HistoryHeader.xib in Resources */, @@ -2580,17 +2574,16 @@ F93DA6FF274E4B86005595B5 /* CoreSearchEngineStatics.swift in Sources */, 14F71865299FD4BD00D5BC2E /* PlaceAutocomplete+PlaceType.swift in Sources */, F9F6378A25DD6A4E00C99904 /* FeedbackManager.swift in Sources */, - 04BBF17E2B9118B400A056AD /* Bundle+Extensions.swift in Sources */, 04C127582B62FFDB00884325 /* ApiType+Core.swift in Sources */, 148DE65D28574E6E0085684D /* AddressAutofill.swift in Sources */, - 140E47A7298BCBDF00677E30 /* Category+Item.swift in Sources */, + 140E47A7298BCBDF00677E30 /* Discover+Query+Category.swift in Sources */, FEEDD3092508DFE400DC0A98 /* CodablePersistentService.swift in Sources */, FEEDD3192508DFE400DC0A98 /* IndexableDataProvider.swift in Sources */, 04C0848D2B4C82F3002F9C69 /* SdkInformation.swift in Sources */, 14173C302878437D00B20E1C /* Country+ISO3166-1.swift in Sources */, FEEDD3162508DFE400DC0A98 /* SearchCategorySuggestion.swift in Sources */, FEEDD31D2508DFE400DC0A98 /* HighlightsCalculator.swift in Sources */, - 14B92D5E298BFD19006003C1 /* CategoryViewController.swift in Sources */, + 14B92D5E298BFD19006003C1 /* DiscoverViewController.swift in Sources */, 14FA657C2953497600056E5B /* PlaceAutocomplete+Options.swift in Sources */, F9A0B8402562B10E00CAD907 /* SearchResultMetadata.swift in Sources */, FE097B7D264EAA1A001EAC2F /* CustomNSError.swift in Sources */, @@ -2600,7 +2593,6 @@ F914EE5A2743E03B00D4F173 /* Array+Extensions.swift in Sources */, FEEDD31B2508DFE400DC0A98 /* LocalDataProviders.swift in Sources */, FEEDD2F42508DFE400DC0A98 /* CoreResponseProvider.swift in Sources */, - 04BBF17C2B91180E00A056AD /* Strings.swift in Sources */, FEEDD30C2508DFE400DC0A98 /* IndexableRecord.swift in Sources */, 043A3D4D2B30F38300DB681B /* CoreAddress+AddressComponents.swift in Sources */, FE097B7B264EAA1A001EAC2F /* AddOfflineRegionError.swift in Sources */, @@ -2608,7 +2600,7 @@ FEEDD2FA2508DFE400DC0A98 /* CoreSearchEngineProtocol.swift in Sources */, FEEDD3052508DFE400DC0A98 /* BoundingBox.swift in Sources */, FEEDD2FE2508DFE400DC0A98 /* CoreSearchResultProtocol.swift in Sources */, - 140E47A5298BC94D00677E30 /* Category+Options.swift in Sources */, + 140E47A5298BC94D00677E30 /* Discover+Options.swift in Sources */, DFBC8A6D2AD42F5F00D394EF /* Any+dumpAsString.swift in Sources */, F914EE642743E4F400D4F173 /* CoreAliases.swift in Sources */, F998AED825D17DFF00230F34 /* SearchResponseInfo.swift in Sources */, @@ -2626,7 +2618,7 @@ F931B35225A32CC400AA1674 /* SearchQuerySuggestion.swift in Sources */, F9F88289258227D200062A82 /* CoreImageInfoProtocol.swift in Sources */, FEEDD2FC2508DFE400DC0A98 /* CoreSearchResponseProtocol.swift in Sources */, - 144F32F2298D1FCD0082B2D5 /* Category+Address.swift in Sources */, + 144F32F2298D1FCD0082B2D5 /* Discover+Address.swift in Sources */, FEEDD2FB2508DFE400DC0A98 /* WrapperLocationProvider.swift in Sources */, FE7C73A62566804E0047CA20 /* CoreUserRecordsLayerProtocol.swift in Sources */, 04E5FF992B48829200DADC18 /* SearchAddressRegion.swift in Sources */, @@ -2642,7 +2634,7 @@ 14FA6590295454F100056E5B /* Image.swift in Sources */, 148DE6642857503A0085684D /* AddressAutofill+Options.swift in Sources */, 148DE666285750710085684D /* Language.swift in Sources */, - 140E47AA298BE3A200677E30 /* Category+Result.swift in Sources */, + 140E47AA298BE3A200677E30 /* Discover+Result.swift in Sources */, FE059C61251A0E27001F7701 /* SearchSuggestType.swift in Sources */, FEEDD3112508DFE400DC0A98 /* AbstractSearchEngine.swift in Sources */, 148DE68B285A18900085684D /* AddressAutofill+AddressComponent.swift in Sources */, @@ -2674,7 +2666,7 @@ FEEDD3042508DFE400DC0A98 /* SearchResultType.swift in Sources */, F91FD66C258CCB41008CB8E1 /* CoreResultType+Extensions.swift in Sources */, FEEDD3152508DFE400DC0A98 /* ServerSearchResult.swift in Sources */, - 140E47A2298BC90E00677E30 /* Category.swift in Sources */, + 140E47A2298BC90E00677E30 /* Discover.swift in Sources */, 14FA65872953644400056E5B /* PlaceAutocomplete+Suggestion.swift in Sources */, 04C127552B62F6BC00884325 /* ApiType.swift in Sources */, FE059C5A251A0AE6001F7701 /* SearchCategorySuggestionImpl.swift in Sources */, @@ -2827,7 +2819,7 @@ F9C557C12670CD8C00BE8B94 /* CoreSearchOptions+Samples.swift in Sources */, 1420F31C29A2800300D4A511 /* CoreSearchResultStub+Samples.swift in Sources */, F9C557B72670CC5600BE8B94 /* CoreSearchResultStub.swift in Sources */, - 04AB0B7B2B6AF43E00FDE7D5 /* CategoryIntegrationTests.swift in Sources */, + 04AB0B7B2B6AF43E00FDE7D5 /* DiscoverIntegrationTests.swift in Sources */, F9C557BF2670CD4300BE8B94 /* CoreRequestOptions+Samples.swift in Sources */, F9C557BB2670CCC000BE8B94 /* SearchResultType+Extensions.swift in Sources */, F9C557BA2670CCAB00BE8B94 /* TestDataProviderRecord.swift in Sources */, @@ -2890,7 +2882,6 @@ F914EE5F2743E38E00D4F173 /* SearchSuggestionCell.swift in Sources */, FEEDD37E2508E02700DC0A98 /* SearchErrorView.swift in Sources */, FEEDD37A2508E02700DC0A98 /* PlaceholderView.swift in Sources */, - FEEDD36F2508E02700DC0A98 /* Category+MapboxSearchUI.swift in Sources */, FEEDD3602508E02700DC0A98 /* CategoriesTableViewCell.swift in Sources */, FEEDD3702508E02700DC0A98 /* Images.swift in Sources */, FE49CF6E2510EFD00059C189 /* DefaultCategoryDataProvider.swift in Sources */, @@ -2914,6 +2905,7 @@ FE41BEB82721768B00607603 /* SearchUI Documentation.docc in Sources */, FEEDD36B2508E02700DC0A98 /* HotCategoryButton.swift in Sources */, FEADB4EE25A4981500FD17F3 /* Colors.swift in Sources */, + 04B3CDF72BB1C7C9002E766E /* SearchCategory.swift in Sources */, FEEDD37B2508E02700DC0A98 /* Bundle+Extensions.swift in Sources */, FEEDD3692508E02700DC0A98 /* SearchBar.swift in Sources */, FEEDD3582508E02700DC0A98 /* SearchHistoryTableViewSource.swift in Sources */, diff --git a/Sources/Demo/Base.lproj/Main.storyboard b/Sources/Demo/Base.lproj/Main.storyboard index f18a3b4d9..806f40fba 100644 --- a/Sources/Demo/Base.lproj/Main.storyboard +++ b/Sources/Demo/Base.lproj/Main.storyboard @@ -229,11 +229,11 @@ - + - + @@ -245,10 +245,10 @@ - + - + diff --git a/Sources/Demo/CategoryViewController.swift b/Sources/Demo/DiscoverViewController.swift similarity index 83% rename from Sources/Demo/CategoryViewController.swift rename to Sources/Demo/DiscoverViewController.swift index be12b3ce6..c4d86c665 100644 --- a/Sources/Demo/CategoryViewController.swift +++ b/Sources/Demo/DiscoverViewController.swift @@ -1,11 +1,11 @@ import MapKit import UIKit -final class CategoryViewController: UIViewController { +final class DiscoverViewController: UIViewController { @IBOutlet private var mapView: MKMapView! @IBOutlet private var segmentedControl: UISegmentedControl! - private let category = Category() + private let category = Discover() override func viewDidLoad() { super.viewDidLoad() @@ -16,7 +16,7 @@ final class CategoryViewController: UIViewController { // MARK: - Actions -extension CategoryViewController { +extension DiscoverViewController { @IBAction private func handleSearchInRegionAction() { let regionResultsLimit: Int @@ -45,7 +45,7 @@ extension CategoryViewController { // MARK: - Private -extension CategoryViewController { +extension DiscoverViewController { private var currentBoundingBox: BoundingBox { let rect = mapView.visibleMapRect let neMapPoint = MKMapPoint(x: rect.maxX, y: rect.origin.y) @@ -57,11 +57,11 @@ extension CategoryViewController { return .init(swCoordinate, neCoordinate) } - private var currentSelectedCategory: Category.Item { - let allDemoCategories: [Category.Item] = [ - .parking, - .restaurant, - .museum, + private var currentSelectedCategory: Discover.Query { + let allDemoCategories: [Discover.Query] = [ + .Category.parking, + .Category.restaurant, + .Category.museum, ] return allDemoCategories[segmentedControl.selectedSegmentIndex] @@ -78,7 +78,7 @@ extension CategoryViewController { mapView.setRegion(region, animated: false) } - private func showCategoryResults(_ results: [Category.Result]) { + private func showCategoryResults(_ results: [Discover.Result]) { mapView.removeAnnotations(mapView.annotations) let annotations: [MKPointAnnotation] = results.map { diff --git a/Sources/MapboxSearch/PublicAPI/Common/Bundle+Extensions.swift b/Sources/MapboxSearch/PublicAPI/Common/Bundle+Extensions.swift deleted file mode 100644 index 63600a89a..000000000 --- a/Sources/MapboxSearch/PublicAPI/Common/Bundle+Extensions.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -extension Bundle { -/// Access to MapboxSearch resource bundle -/// -/// Resource bundle may be located: -/// - inside dynamic framework -/// -/// `MapboxSearch.framework/MapboxSearch.bundle` -/// - as a plain bundle in the application root (for static lib distribution) -/// -/// `Demo.app/MapboxSearch.bundle` -/// -/// We use `CoreSearchResultResponse` class as an anchor to detect the bundle -#if SWIFT_PACKAGE - static let mapboxSearch = module -#else - static let mapboxSearch = Bundle(for: CoreSearchResultResponse.self) -#endif -} diff --git a/Sources/MapboxSearch/PublicAPI/Strings.swift b/Sources/MapboxSearch/PublicAPI/Strings.swift deleted file mode 100644 index 90d1ede25..000000000 --- a/Sources/MapboxSearch/PublicAPI/Strings.swift +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright © 2024 Mapbox. All rights reserved. - -import Foundation - -enum Strings { - enum Categories { - static let gas = NSLocalizedString( - "gas_station.short", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Gas title" - ) - static let parking = NSLocalizedString( - "parking_lot", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Parking title" - ) - static let food = NSLocalizedString( - "restaurant.alias.food", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Food title" - ) - static let cafe = NSLocalizedString( - "cafe", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Cafe title" - ) - static let restaurant = NSLocalizedString( - "restaurants", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Restaurants title" - ) - static let bar = NSLocalizedString( - "bar", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Bars title" - ) - static let coffeeShop = NSLocalizedString( - "cafe.long", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Coffee Shop title" - ) - static let hotel = NSLocalizedString( - "hotel", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Hotel title" - ) - static let gasStation = NSLocalizedString( - "gas_station", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Gas Station title" - ) - static let chargingStation = NSLocalizedString( - "charging_station", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category EV Charging Station title" - ) - static let busStation = NSLocalizedString( - "bus_station", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Bus station title" - ) - static let railwayStation = NSLocalizedString( - "railway_station", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Train station title" - ) - static let shoppingMall = NSLocalizedString( - "shopping_mall", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Shopping malls title" - ) - static let grocery = NSLocalizedString( - "grocery", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Supermarket / Grocery title" - ) - static let clothingStore = NSLocalizedString( - "clothing_store", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Clothing / shoes title" - ) - static let pharmacy = NSLocalizedString( - "pharmacy", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Pharmacy title" - ) - static let museum = NSLocalizedString( - "museum", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Museums title" - ) - static let park = NSLocalizedString( - "park", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Parks title" - ) - static let cinema = NSLocalizedString( - "cinema", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Movie Theaters title" - ) - static let fitnessCentre = NSLocalizedString( - "fitness_center", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Gym / Fitness title" - ) - static let nightclub = NSLocalizedString( - "nightclub", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Night clubs title" - ) - static let autoRepair = NSLocalizedString( - "auto_repair", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Auto repair / mechanic title" - ) - static let atm = NSLocalizedString( - "atm", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category ATM title" - ) - static let hospital = NSLocalizedString( - "hospital", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category Hospital title" - ) - static let emergencyRoom = NSLocalizedString( - "emergency_room", - tableName: "Categories", - bundle: .mapboxSearch, - comment: "Category ER title" - ) - } -} diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Item.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Item.swift deleted file mode 100644 index 6cbf12e4a..000000000 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Item.swift +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright © 2023 Mapbox. All rights reserved. - -import Foundation - -extension Category { - public struct Item: Codable, Hashable { - public let name: String - - public var id: String { - canonicalId - } - - public let iconName: Maki - public let legacyName: String - public let canonicalId: String - - public init(canonicalId: String, name: String, legacyName: String, iconName: Maki) { - self.canonicalId = canonicalId - self.name = name - self.legacyName = legacyName - self.iconName = iconName - } - } -} - -extension Category.Item { - static let empty = Category.Item(canonicalId: "", name: "?", legacyName: "unknown", iconName: Maki.marker) - - // MARK: - Hot categories - - /// Fuel station category. - public static let gas = - Category.Item(canonicalId: "gas_station", name: Strings.Categories.gas, legacyName: "fuel", iconName: Maki.fuel) - - /// Parking lot category. - public static let parking = - Category.Item( - canonicalId: "parking_lot", - name: Strings.Categories.parking, - legacyName: "parking", - iconName: Maki.parking - ) - - /// Food category. - public static let food = - Category.Item( - canonicalId: "restaurant", - name: Strings.Categories.food, - legacyName: "restaurant", - iconName: Maki.restaurant - ) - - /// Cafe category. - public static let cafe = - Category.Item(canonicalId: "cafe", name: Strings.Categories.cafe, legacyName: "cafe", iconName: Maki.cafe) - - // MARK: - Other categories - - /// Restaurant category. - public static let restaurant = - Category.Item( - canonicalId: "restaurant", - name: Strings.Categories.restaurant, - legacyName: "restaurant", - iconName: Maki.restaurant - ) - - /// Bar category. - public static let bar = - Category.Item(canonicalId: "bar", name: Strings.Categories.bar, legacyName: "bar", iconName: Maki.bar) - - /// Cafe category. - public static let coffeeShop = - Category.Item(canonicalId: "cafe", name: Strings.Categories.coffeeShop, legacyName: "cafe", iconName: Maki.cafe) - - /// Hotel category. - public static let hotel = - Category.Item(canonicalId: "hotel", name: Strings.Categories.hotel, legacyName: "hotel", iconName: Maki.lodging) - - /// Gas Station category. - public static let gasStation = - Category.Item( - canonicalId: "gas_station", - name: Strings.Categories.gasStation, - legacyName: "fuel", - iconName: Maki.fuel - ) - - /// EV Charging station category. - public static let chargingStation = - Category.Item( - canonicalId: "ev_charging_station", - name: Strings.Categories.chargingStation, - legacyName: "charging station", - iconName: Maki.chargingStation - ) - - /// Bus station category. - public static let busStation = - Category.Item( - canonicalId: "bus_station", - name: Strings.Categories.busStation, - legacyName: "bus station", - iconName: Maki.bus - ) - - /// Railway station category. - public static let railwayStation = - Category.Item( - canonicalId: "railway_station", - name: Strings.Categories.railwayStation, - legacyName: "train station", - iconName: Maki.rail - ) - - /// Shopping mall category. - public static let shoppingMall = - Category.Item( - canonicalId: "shopping_mall", - name: Strings.Categories.shoppingMall, - legacyName: "mall", - iconName: Maki.shop - ) - - /// Grocery category. - public static let grocery = - Category.Item( - canonicalId: "grocery", - name: Strings.Categories.grocery, - legacyName: "grocery", - iconName: Maki.grocery - ) - - /// Clothing store category. - public static let clothingStore = - Category.Item( - canonicalId: "clothing_store", - name: Strings.Categories.clothingStore, - legacyName: "clothes", - iconName: Maki.clothingStore - ) - - /// Pharmacy category. - public static let pharmacy = - Category.Item( - canonicalId: "pharmacy", - name: Strings.Categories.pharmacy, - legacyName: "pharmacy", - iconName: Maki.pharmacy - ) - - /// Museum category. - public static let museum = - Category.Item( - canonicalId: "museum", - name: Strings.Categories.museum, - legacyName: "museum", - iconName: Maki.museum - ) - - /// Park category. - public static let park = - Category.Item(canonicalId: "park", name: Strings.Categories.park, legacyName: "park", iconName: Maki.park) - - /// Cinema category. - public static let cinema = - Category.Item( - canonicalId: "cinema", - name: Strings.Categories.cinema, - legacyName: "cinema", - iconName: Maki.cinema - ) - - /// Fitness center category. - public static let fitnessCentre = - Category.Item( - canonicalId: "fitness_center", - name: Strings.Categories.fitnessCentre, - legacyName: "fitness center", - iconName: Maki.fitnessCentre - ) - - /// Nightclub category. - public static let nightclub = - Category.Item( - canonicalId: "nightclub", - name: Strings.Categories.nightclub, - legacyName: "nightclub", - iconName: Maki.nightclub - ) - - /// Auto repair category. - public static let autoRepair = - Category.Item( - canonicalId: "auto_repair", - name: Strings.Categories.autoRepair, - legacyName: "auto repair", - iconName: Maki.carRepair - ) - - /// ATM category. - public static let atm = - Category.Item(canonicalId: "atm", name: Strings.Categories.atm, legacyName: "atm", iconName: Maki.bank) - - /// Hospital category. - public static let hospital = - Category.Item( - canonicalId: "hospital", - name: Strings.Categories.hospital, - legacyName: "hospital", - iconName: Maki.hospital - ) - - /// Emergency Room category. - public static let emergencyRoom = - Category.Item( - canonicalId: "emergency_room", - name: Strings.Categories.emergencyRoom, - legacyName: "emergency room", - iconName: Maki.emergencyPhone - ) -} diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Category.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Discover.swift similarity index 94% rename from Sources/MapboxSearch/PublicAPI/Use Cases/Category/Category.swift rename to Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Discover.swift index f0316794d..82d2d2a85 100644 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Category.swift +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Discover.swift @@ -1,7 +1,7 @@ import CoreLocation import Foundation -public final class Category { +public final class Discover { private let searchEngine: CategorySearchEngine private let userActivityReporter: CoreUserActivityReporter @@ -47,7 +47,7 @@ public final class Category { } } -extension Category { +extension Discover { /// Search for places nearby the specified geographic point. /// - Parameters: /// - item: Search item @@ -56,7 +56,7 @@ extension Category { /// - completion: Result of the search request, one of error or value. /// public func search( - for item: Item, + for item: Discover.Query, proximity: CLLocationCoordinate2D, options: Options = .init(), completion: @escaping (Swift.Result<[Result], Error>) -> Void @@ -82,7 +82,7 @@ extension Category { /// - completion: Result of the search request, one of error or value. /// public func search( - for item: Item, + for item: Discover.Query, in region: BoundingBox, proximity: CLLocationCoordinate2D? = nil, options: Options = .init(), @@ -109,7 +109,7 @@ extension Category { /// - completion: Result of the search request, one of error or value. /// public func search( - for item: Item, + for item: Discover.Query, route: RouteOptions, options: Options = .init(), completion: @escaping (Swift.Result<[Result], Error>) -> Void @@ -131,19 +131,19 @@ extension Category { // MARK: - Private -extension Category { +extension Discover { private func search( - for item: Item, + for item: Discover.Query, with searchOptions: SearchOptions, completion: @escaping (Swift.Result<[Result], Error>) -> Void ) { searchEngine.search( - categoryName: item.canonicalId, + categoryName: item.rawValue, options: searchOptions ) { result in switch result { case .success(let searchResults): - let categoryResults = searchResults.map(Category.Result.from(_:)) + let categoryResults = searchResults.map(Discover.Result.from(_:)) completion(.success(categoryResults)) case .failure(let error): diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Address.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Address.swift similarity index 98% rename from Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Address.swift rename to Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Address.swift index e8d627f40..0472699d0 100644 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Address.swift +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Address.swift @@ -1,7 +1,7 @@ import Contacts import Foundation -extension Category { +extension Discover { public struct Address { /// House number of the individual residential or business addresses. public let houseNumber: String? @@ -80,7 +80,7 @@ extension Category { // MARK: - Contacts extension -extension Category.Address { +extension Discover.Address { /// The postal address associated with the location, formatted for use with the Contacts framework. public var postalAddress: CNPostalAddress { let streetNameAndNumber = [houseNumber, street] diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Options.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Options.swift similarity index 99% rename from Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Options.swift rename to Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Options.swift index 6b44fa9f3..9cfcfaab2 100644 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Options.swift +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Options.swift @@ -1,6 +1,6 @@ import Foundation -extension Category { +extension Discover { public struct Options { /// Maximum number of results to return. /// The maximum allowed value for SBS APIs is 100 results. diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Query+Category.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Query+Category.swift new file mode 100644 index 000000000..3f3398187 --- /dev/null +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Query+Category.swift @@ -0,0 +1,95 @@ +// Copyright © 2023 Mapbox. All rights reserved. + +import Foundation + +extension Discover { + /// String representing a category name to be searched for. + /// Use one of the suggested categories listed in the enum extension or search for a given string. + public struct Query { + let rawValue: String + } +} + +extension Discover.Query { + /// Top categories that reflect common usage. + public enum Category { + // MARK: - Hot categories + + /// Fuel station category. + public static let gas = Discover.Query(rawValue: "gas_station") + + /// Parking lot category. + public static let parking = Discover.Query(rawValue: "parking_lot") + + /// Food category. + public static let food = Discover.Query(rawValue: "restaurant") + + /// Cafe category. + public static let cafe = Discover.Query(rawValue: "cafe") + + // MARK: - Additional top categories + + /// Restaurant category. + public static let restaurant = Discover.Query(rawValue: "restaurant") + + /// Bar category. + public static let bar = Discover.Query(rawValue: "bar") + + /// Cafe category. + public static let coffeeShop = Discover.Query(rawValue: "cafe") + + /// Hotel category. + public static let hotel = Discover.Query(rawValue: "hotel") + + /// Gas Station category. + public static let gasStation = Discover.Query(rawValue: "gas_station") + + /// EV Charging station category. + public static let chargingStation = Discover.Query(rawValue: "ev_charging_station") + + /// Bus station category. + public static let busStation = Discover.Query(rawValue: "bus_station") + + /// Railway station category. + public static let railwayStation = Discover.Query(rawValue: "railway_station") + + /// Shopping mall category. + public static let shoppingMall = Discover.Query(rawValue: "shopping_mall") + + /// Grocery category. + public static let grocery = Discover.Query(rawValue: "grocery") + + /// Clothing store category. + public static let clothingStore = Discover.Query(rawValue: "clothing_store") + + /// Pharmacy category. + public static let pharmacy = Discover.Query(rawValue: "pharmacy") + + /// Museum category. + public static let museum = Discover.Query(rawValue: "museum") + + /// Park category. + public static let park = Discover.Query(rawValue: "park") + + /// Cinema category. + public static let cinema = Discover.Query(rawValue: "cinema") + + /// Fitness center category. + public static let fitnessCentre = Discover.Query(rawValue: "fitness_center") + + /// Nightclub category. + public static let nightclub = Discover.Query(rawValue: "nightclub") + + /// Auto repair category. + public static let autoRepair = Discover.Query(rawValue: "auto_repair") + + /// ATM category. + public static let atm = Discover.Query(rawValue: "atm") + + /// Hospital category. + public static let hospital = Discover.Query(rawValue: "hospital") + + /// Emergency Room category. + public static let emergencyRoom = Discover.Query(rawValue: "emergency_room") + } +} diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Result.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Result.swift similarity index 96% rename from Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Result.swift rename to Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Result.swift index e85e3fdd1..ef2c09638 100644 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Category/Models/Category+Result.swift +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover/Models/Discover+Result.swift @@ -1,7 +1,7 @@ import CoreLocation import Foundation -extension Category { +extension Discover { public struct Result { /// Result's name public let name: String @@ -23,7 +23,7 @@ extension Category { } } -extension Category.Result { +extension Discover.Result { static func from(_ searchResult: SearchResult) -> Self { var routablePointsArray: NonEmptyArray? if let routablePoints = searchResult.routablePoints, let first = searchResult.routablePoints?.first { diff --git a/Sources/MapboxSearchUI/CategoriesTableViewCell.swift b/Sources/MapboxSearchUI/CategoriesTableViewCell.swift index 1d94ac426..1ab966560 100644 --- a/Sources/MapboxSearchUI/CategoriesTableViewCell.swift +++ b/Sources/MapboxSearchUI/CategoriesTableViewCell.swift @@ -22,7 +22,7 @@ class CategoriesTableViewCell: UITableViewCell { backgroundColor = configuration.style.primaryBackgroundColor textLabel?.textColor = configuration.style.primaryTextColor - let icon = UIImage(named: category.iconName.xcassetName, in: .mapboxSearchUI, compatibleWith: nil) ?? Images + let icon = UIImage(named: category.iconName, in: .mapboxSearchUI, compatibleWith: nil) ?? Images .unknownIcon imageView?.image = icon.withRenderingMode(.alwaysTemplate) imageView?.tintColor = configuration.style.iconTintColor diff --git a/Sources/MapboxSearchUI/Category+MapboxSearchUI.swift b/Sources/MapboxSearchUI/Category+MapboxSearchUI.swift deleted file mode 100644 index 84ed78413..000000000 --- a/Sources/MapboxSearchUI/Category+MapboxSearchUI.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation -import MapboxSearch -import UIKit - -/// Category entity to present on MapboxSearchController UI -extension MapboxSearch.Category.Item { - /// Category icon from embedded bundle - public var icon: UIImage? { UIImage(named: iconName.name, in: .mapboxSearchUI, compatibleWith: nil) } - - /// Make a category with existing name. Icon and metadata would be hooked from sdk bundle - /// - Parameter name: Category name from embedded catalog - /// - Returns: New category if we have enough data for constructor - public static func makeServerCategory(name: String) -> Self? { - return CategoriesProvider.shared.categories.first { $0.name == name } - } - - static func makeUnsafeCategory( - canonicalId: String, - name: String, - legacyName: String, - iconName: String - ) -> SearchCategory { - let existingCategory = CategoriesProvider.shared.categories.first(where: { - $0.canonicalId == canonicalId && - $0.name == name && - $0.iconName.name == iconName && - $0.legacyName == legacyName - }) - if let existingCategory { - return existingCategory - } - - return SearchCategory( - canonicalId: canonicalId, - name: name, - legacyName: legacyName, - iconName: Maki(rawValue: iconName) ?? .marker - ) - } -} diff --git a/Sources/MapboxSearchUI/Configuration.swift b/Sources/MapboxSearchUI/Configuration.swift index caf03a679..3d59a7964 100644 --- a/Sources/MapboxSearchUI/Configuration.swift +++ b/Sources/MapboxSearchUI/Configuration.swift @@ -8,7 +8,7 @@ public struct Configuration { /// - Parameters: /// - allowsFeedbackUI: Allow to show feedback related UI /// - categoryDataProvider: Custom dataProvider to change Categories elements - /// - locationProvider: location provider for both SearchEngine and Category SearchEngine. DefaultLocationProvider + /// - locationProvider: location provider for both SearchEngine and Discover SearchEngine. DefaultLocationProvider /// used as default value. /// - hideCategorySlots: Hide horizontal set of category buttons (aka hot category buttons or category slots) /// - style: Style to be used for Search UI elements. diff --git a/Sources/MapboxSearchUI/HotCategoryButton.swift b/Sources/MapboxSearchUI/HotCategoryButton.swift index 1781bbc93..dcc396fe9 100644 --- a/Sources/MapboxSearchUI/HotCategoryButton.swift +++ b/Sources/MapboxSearchUI/HotCategoryButton.swift @@ -1,14 +1,5 @@ import UIKit -extension SearchCategory { - static let empty = SearchCategory( - canonicalId: "", - name: "?", - legacyName: "unknown", - iconName: Maki.marker - ) -} - class HotCategoryButton: UIControl { @IBOutlet private var categoryButton: UIButton! @IBOutlet private var textLabel: UILabel! diff --git a/Sources/MapboxSearchUI/MapboxSearchController.swift b/Sources/MapboxSearchUI/MapboxSearchController.swift index c99120626..e415ecf3e 100644 --- a/Sources/MapboxSearchUI/MapboxSearchController.swift +++ b/Sources/MapboxSearchUI/MapboxSearchController.swift @@ -2,8 +2,6 @@ import CoreLocation @_exported import MapboxSearch import UIKit -public typealias SearchCategory = MapboxSearch.Category.Item - /// Defines methods to provide location results from ``MapboxSearchController``. public protocol SearchControllerDelegate: AnyObject { /// Selected search result in the search panel. diff --git a/Sources/MapboxSearch/PublicAPI/en.lproj/Categories.strings b/Sources/MapboxSearchUI/Resources/en.lproj/Categories.strings similarity index 100% rename from Sources/MapboxSearch/PublicAPI/en.lproj/Categories.strings rename to Sources/MapboxSearchUI/Resources/en.lproj/Categories.strings diff --git a/Sources/MapboxSearchUI/SearchCategory.swift b/Sources/MapboxSearchUI/SearchCategory.swift new file mode 100644 index 000000000..18f5b41a1 --- /dev/null +++ b/Sources/MapboxSearchUI/SearchCategory.swift @@ -0,0 +1,285 @@ +import Foundation +import MapboxSearch +import UIKit + +/// Category entity to present on MapboxSearchController UI +public struct SearchCategory: Codable, Hashable { + /// Name to display + public let name: String + + public var id: String { + canonicalId + } + + let iconName: String + let legacyName: String + let canonicalId: String + + /// Category icon from embedded bundle + public var icon: UIImage? { UIImage(named: iconName, in: .mapboxSearchUI, compatibleWith: nil) } + + init(canonicalId: String, name: String, legacyName: String, iconName: String) { + self.canonicalId = canonicalId + self.name = name + self.legacyName = legacyName + self.iconName = iconName + } + + /// Make a category with existing name. Icon and metadata would be hooked from sdk bundle + /// - Parameter name: Category name from embedded catalog + /// - Returns: New category if we have enough data for constructor + public static func makeServerCategory(name: String) -> SearchCategory? { + return CategoriesProvider.shared.categories.first { $0.name == name } + } + + static func makeUnsafeCategory( + canonicalId: String, + name: String, + legacyName: String, + iconName: String + ) -> SearchCategory { + let existingCategory = CategoriesProvider.shared.categories.first(where: { $0.canonicalId == canonicalId && + $0.name == name && + $0.iconName == iconName && + $0.legacyName == legacyName + }) + if let existingCategory { + return existingCategory + } + + return SearchCategory(canonicalId: canonicalId, name: name, legacyName: legacyName, iconName: iconName) + } +} + +extension SearchCategory { + static let empty = SearchCategory(canonicalId: "", name: "?", legacyName: "unknown", iconName: "unknown icon") + + // MARK: - Hot categories + + /// Fuel station category. + public static let gas = + SearchCategory( + canonicalId: "gas_station", + name: Strings.Categories.gas, + legacyName: "fuel", + iconName: Maki.fuel.xcassetName + ) + + /// Parking lot category. + public static let parking = + SearchCategory( + canonicalId: "parking_lot", + name: Strings.Categories.parking, + legacyName: "parking", + iconName: Maki.parking.xcassetName + ) + + /// Food category. + public static let food = + SearchCategory( + canonicalId: "restaurant", + name: Strings.Categories.food, + legacyName: "restaurant", + iconName: Maki.restaurant.xcassetName + ) + + /// Cafe category. + public static let cafe = + SearchCategory( + canonicalId: "cafe", + name: Strings.Categories.cafe, + legacyName: "cafe", + iconName: Maki.cafe.xcassetName + ) + + // MARK: - Other categories + + /// Restaurant category. + public static let restaurant = + SearchCategory( + canonicalId: "restaurant", + name: Strings.Categories.restaurant, + legacyName: "restaurant", + iconName: Maki.restaurant.xcassetName + ) + + /// Bar category. + public static let bar = + SearchCategory( + canonicalId: "bar", + name: Strings.Categories.bar, + legacyName: "bar", + iconName: Maki.bar.xcassetName + ) + + /// Cafe category. + public static let coffeeShop = + SearchCategory( + canonicalId: "cafe", + name: Strings.Categories.coffeeShop, + legacyName: "cafe", + iconName: Maki.cafe.xcassetName + ) + + /// Hotel category. + public static let hotel = + SearchCategory( + canonicalId: "hotel", + name: Strings.Categories.hotel, + legacyName: "hotel", + iconName: Maki.lodging.xcassetName + ) + + /// Gas Station category. + public static let gasStation = + SearchCategory( + canonicalId: "gas_station", + name: Strings.Categories.gasStation, + legacyName: "fuel", + iconName: Maki.fuel.xcassetName + ) + + /// EV Charging station category. + public static let chargingStation = + SearchCategory( + canonicalId: "charging_station", + name: Strings.Categories.chargingStation, + legacyName: "charging station", + iconName: Maki.chargingStation.xcassetName + ) + + /// Bus station category. + public static let busStation = + SearchCategory( + canonicalId: "bus_station", + name: Strings.Categories.busStation, + legacyName: "bus station", + iconName: Maki.bus.xcassetName + ) + + /// Railway station category. + public static let railwayStation = + SearchCategory( + canonicalId: "railway_station", + name: Strings.Categories.railwayStation, + legacyName: "train station", + iconName: Maki.rail.xcassetName + ) + + /// Shopping mall category. + public static let shoppingMall = + SearchCategory( + canonicalId: "shopping_mall", + name: Strings.Categories.shoppingMall, + legacyName: "mall", + iconName: Maki.shop.xcassetName + ) + + /// Grocery category. + public static let grocery = + SearchCategory( + canonicalId: "grocery", + name: Strings.Categories.grocery, + legacyName: "grocery", + iconName: Maki.grocery.xcassetName + ) + + /// Clothing store category. + public static let clothingStore = + SearchCategory( + canonicalId: "clothing_store", + name: Strings.Categories.clothingStore, + legacyName: "clothes", + iconName: Maki.clothingStore.xcassetName + ) + + /// Pharmacy category. + public static let pharmacy = + SearchCategory( + canonicalId: "pharmacy", + name: Strings.Categories.pharmacy, + legacyName: "pharmacy", + iconName: Maki.pharmacy.xcassetName + ) + + /// Museum category. + public static let museum = + SearchCategory( + canonicalId: "museum", + name: Strings.Categories.museum, + legacyName: "museum", + iconName: Maki.museum.xcassetName + ) + + /// Park category. + public static let park = + SearchCategory( + canonicalId: "park", + name: Strings.Categories.park, + legacyName: "park", + iconName: Maki.park.xcassetName + ) + + /// Cinema category. + public static let cinema = + SearchCategory( + canonicalId: "cinema", + name: Strings.Categories.cinema, + legacyName: "cinema", + iconName: Maki.cinema.xcassetName + ) + + /// Fitness center category. + public static let fitnessCentre = + SearchCategory( + canonicalId: "fitness_center", + name: Strings.Categories.fitnessCentre, + legacyName: "fitness center", + iconName: Maki.fitnessCentre.xcassetName + ) + + /// Nightclub category. + public static let nightclub = + SearchCategory( + canonicalId: "nightclub", + name: Strings.Categories.nightclub, + legacyName: "nightclub", + iconName: Maki.nightclub.xcassetName + ) + + /// Auto repair category. + public static let autoRepair = + SearchCategory( + canonicalId: "auto_repair", + name: Strings.Categories.autoRepair, + legacyName: "auto repair", + iconName: Maki.carRepair.xcassetName + ) + + /// ATM category. + public static let atm = + SearchCategory( + canonicalId: "atm", + name: Strings.Categories.atm, + legacyName: "atm", + iconName: Maki.bank.xcassetName + ) + + /// Hospital category. + public static let hospital = + SearchCategory( + canonicalId: "hospital", + name: Strings.Categories.hospital, + legacyName: "hospital", + iconName: Maki.hospital.xcassetName + ) + + /// Emergency Room category. + public static let emergencyRoom = + SearchCategory( + canonicalId: "emergency_room", + name: Strings.Categories.emergencyRoom, + legacyName: "emergency room", + iconName: Maki.emergencyPhone.xcassetName + ) +} diff --git a/Sources/MapboxSearchUI/Strings.swift b/Sources/MapboxSearchUI/Strings.swift index f0a678403..b79fa4a0f 100644 --- a/Sources/MapboxSearchUI/Strings.swift +++ b/Sources/MapboxSearchUI/Strings.swift @@ -166,6 +166,159 @@ enum Strings { ) } + enum Categories { + static let gas = NSLocalizedString( + "gas_station.short", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Gas title" + ) + static let parking = NSLocalizedString( + "parking_lot", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Parking title" + ) + static let food = NSLocalizedString( + "restaurant.alias.food", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Food title" + ) + static let cafe = NSLocalizedString( + "cafe", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Cafe title" + ) + static let restaurant = NSLocalizedString( + "restaurants", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Restaurants title" + ) + static let bar = NSLocalizedString( + "bar", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Bars title" + ) + static let coffeeShop = NSLocalizedString( + "cafe.long", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Coffee Shop title" + ) + static let hotel = NSLocalizedString( + "hotel", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Hotel title" + ) + static let gasStation = NSLocalizedString( + "gas_station", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Gas Station title" + ) + static let chargingStation = NSLocalizedString( + "charging_station", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category EV Charging Station title" + ) + static let busStation = NSLocalizedString( + "bus_station", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Bus station title" + ) + static let railwayStation = NSLocalizedString( + "railway_station", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Train station title" + ) + static let shoppingMall = NSLocalizedString( + "shopping_mall", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Shopping malls title" + ) + static let grocery = NSLocalizedString( + "grocery", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Supermarket / Grocery title" + ) + static let clothingStore = NSLocalizedString( + "clothing_store", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Clothing / shoes title" + ) + static let pharmacy = NSLocalizedString( + "pharmacy", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Pharmacy title" + ) + static let museum = NSLocalizedString( + "museum", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Museums title" + ) + static let park = NSLocalizedString( + "park", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Parks title" + ) + static let cinema = NSLocalizedString( + "cinema", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Movie Theaters title" + ) + static let fitnessCentre = NSLocalizedString( + "fitness_center", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Gym / Fitness title" + ) + static let nightclub = NSLocalizedString( + "nightclub", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Night clubs title" + ) + static let autoRepair = NSLocalizedString( + "auto_repair", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Auto repair / mechanic title" + ) + static let atm = NSLocalizedString( + "atm", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category ATM title" + ) + static let hospital = NSLocalizedString( + "hospital", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category Hospital title" + ) + static let emergencyRoom = NSLocalizedString( + "emergency_room", + tableName: "Categories", + bundle: .mapboxSearchUI, + comment: "Category ER title" + ) + } + enum Feedback { static let report = NSLocalizedString( "search.feedback.reportButton.name", diff --git a/Tests/MapboxSearchIntegrationTests/CategoryIntegrationTests.swift b/Tests/MapboxSearchIntegrationTests/DiscoverIntegrationTests.swift similarity index 86% rename from Tests/MapboxSearchIntegrationTests/CategoryIntegrationTests.swift rename to Tests/MapboxSearchIntegrationTests/DiscoverIntegrationTests.swift index dc8b5e515..3021bf41f 100644 --- a/Tests/MapboxSearchIntegrationTests/CategoryIntegrationTests.swift +++ b/Tests/MapboxSearchIntegrationTests/DiscoverIntegrationTests.swift @@ -2,8 +2,9 @@ import CoreLocation @testable import MapboxSearch import XCTest -class CategoryIntegrationTests: MockServerIntegrationTestCase { - lazy var searchEngine = Category(locationProvider: DefaultLocationProvider()) +/// Aka Category +class DiscoverIntegrationTests: MockServerIntegrationTestCase { + lazy var searchEngine = Discover(locationProvider: DefaultLocationProvider()) func testCategorySearchAlongRouteWithCountryProximityOrigin() throws { try server.setResponse(.categoryHotelSearchAlongRoute_JP) @@ -16,7 +17,7 @@ class CategoryIntegrationTests: MockServerIntegrationTestCase { let mapboxSearchRoute = MapboxSearch.Route(coordinates: coordinates) let rOptions: MapboxSearch.RouteOptions = RouteOptions(route: mapboxSearchRoute, time: 1000) - let options = Category.Options( + let options = Discover.Options( limit: 10, language: nil, country: Country(countryCode: "jp"), @@ -28,7 +29,7 @@ class CategoryIntegrationTests: MockServerIntegrationTestCase { ) searchEngine.search( - for: Category.Item.hotel, + for: Discover.Query.Category.hotel, route: rOptions, options: options ) { result in diff --git a/Tests/MapboxSearchIntegrationTests/OwningObjectDeallocatedErrorTests.swift b/Tests/MapboxSearchIntegrationTests/OwningObjectDeallocatedErrorTests.swift index cad98f7cd..d8ff7dc08 100644 --- a/Tests/MapboxSearchIntegrationTests/OwningObjectDeallocatedErrorTests.swift +++ b/Tests/MapboxSearchIntegrationTests/OwningObjectDeallocatedErrorTests.swift @@ -14,8 +14,8 @@ final class OwningObjectDeallocatedErrorTests: MockServerIntegrationTestCase