Skip to content

Commit

Permalink
[SSDK-650] Restore Discover struct for category search (#197)
Browse files Browse the repository at this point in the history
### Description
Fixes [SSDK-650](https://mapbox.atlassian.net/browse/SSDK-650)

- This change restores the `Discover()` category search API that is source-compatible with the 1.0.0-series
- Previously modified on the `main` branch in PR #172
	- Keep Maki icon updates, test improvements
- Upgrades from 1.0.0-rc.8 to 2.0.0-rc.2 or 2.0.0-rc.3 should be entirely source compatible for this API.

### Checklist
- [x] Update `CHANGELOG`

[SSDK-650]: https://mapbox.atlassian.net/browse/SSDK-650
  • Loading branch information
aokj4ck authored Mar 25, 2024
1 parent e838f69 commit eee15e6
Show file tree
Hide file tree
Showing 23 changed files with 610 additions and 540 deletions.
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

0 comments on commit eee15e6

Please sign in to comment.