Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSDK-650] Restore Discover struct for category search #197

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
84 changes: 38 additions & 46 deletions MapboxSearch.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Sources/Demo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
</objects>
<point key="canvasLocation" x="729" y="1529"/>
</scene>
<!--Category-->
<!--Discover-->
<scene sceneID="Cbv-pg-ufB">
<objects>
<navigationController navigationBarHidden="YES" id="kQh-we-4TL" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Category" image="tag" catalog="system" id="FHv-mk-0xk"/>
<tabBarItem key="tabBarItem" title="Discover" image="tag" catalog="system" id="FHv-mk-0xk"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="XUy-LY-TcY">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand All @@ -245,10 +245,10 @@
</objects>
<point key="canvasLocation" x="-1023" y="2400"/>
</scene>
<!--Category-->
<!--Discover-->
<scene sceneID="cow-iZ-A5n">
<objects>
<viewController title="Category" id="ggU-4h-Z4i" customClass="CategoryViewController" customModule="MapboxSearch" sceneMemberID="viewController">
<viewController title="Discover" id="ggU-4h-Z4i" customClass="DiscoverViewController" customModule="MapboxSearch" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="H51-Up-D8x">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -16,7 +16,7 @@ final class CategoryViewController: UIViewController {

// MARK: - Actions

extension CategoryViewController {
extension DiscoverViewController {
@IBAction
private func handleSearchInRegionAction() {
let regionResultsLimit: Int
Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand All @@ -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 {
Expand Down
20 changes: 0 additions & 20 deletions Sources/MapboxSearch/PublicAPI/Common/Bundle+Extensions.swift

This file was deleted.

158 changes: 0 additions & 158 deletions Sources/MapboxSearch/PublicAPI/Strings.swift

This file was deleted.

Loading