Skip to content

Commit

Permalink
Update Core and Common (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
macdrevx committed Aug 27, 2021
1 parent cab85f2 commit 500e8f3
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 33 deletions.
8 changes: 4 additions & 4 deletions Apps/Apps.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git",
"state": {
"branch": null,
"revision": "82eaeed75ac3cb7a8f386009a4fca7f1fb3f8697",
"version": "17.1.0"
"revision": "a69e8ec4684ea2db20c94e85bcb54497554500d0",
"version": "18.0.0"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "f619bd71a80be83c8bae6ed28f9c1b218bdde555",
"version": "10.0.0-rc.7.2"
"revision": "d5360ef24a2038150ab68c67ada0893f6d5b5b15",
"version": "10.0.0-rc.8"
}
},
{
Expand Down
19 changes: 10 additions & 9 deletions Apps/Examples/Examples/All Examples/FeatureStateExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class FeatureStateExample: UIViewController, ExampleProtocol {
descriptionView = EarthquakeDescriptionView(frame: .zero)
view.addSubview(descriptionView)
descriptionView.translatesAutoresizingMaskIntoConstraints = false
descriptionView.topAnchor.constraint(equalTo: view.topAnchor, constant: 75.0).isActive = true
descriptionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 2.0).isActive = true
descriptionView.heightAnchor.constraint(equalToConstant: 100).isActive = true
descriptionView.widthAnchor.constraint(equalToConstant: 200).isActive = true
descriptionView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 2.0).isActive = true
Expand Down Expand Up @@ -192,14 +192,16 @@ public class FeatureStateExample: UIViewController, ExampleProtocol {

// Extract the earthquake feature from the queried features
if let earthquakeFeature = queriedfeatures.first?.feature,
let earthquakeId = (earthquakeFeature.identifier as? NSNumber)?.stringValue,
let point = earthquakeFeature.geometry.extractLocations()?.cgPointValue,
let magnitude = earthquakeFeature.properties["mag"] as? NSNumber,
let place = earthquakeFeature.properties["place"] as? String,
let timestamp = earthquakeFeature.properties["time"] as? NSNumber {
case .number(.double(let earthquakeIdDouble)) = earthquakeFeature.identifier,
case .point(let point) = earthquakeFeature.geometry,
let magnitude = earthquakeFeature.properties?["mag"] as? Double,
let place = earthquakeFeature.properties?["place"] as? String,
let timestamp = earthquakeFeature.properties?["time"] as? Double {

let earthquakeId = Int(earthquakeIdDouble).description

// Set the description of the earthquake from the `properties` object
self.setDescription(magnitude: magnitude.doubleValue, timeStamp: timestamp.doubleValue, location: place)
self.setDescription(magnitude: magnitude, timeStamp: timestamp, location: place)

// Set the earthquake to be "selected"
self.setSelectedState(earthquakeId: earthquakeId)
Expand All @@ -211,8 +213,7 @@ public class FeatureStateExample: UIViewController, ExampleProtocol {
self.previouslyTappedEarthquakeId = earthquakeId

// Center the selected earthquake on the screen
let coord = CLLocationCoordinate2D(latitude: CLLocationDegrees(point.x), longitude: CLLocationDegrees(point.y))
self.mapView.camera.fly(to: CameraOptions(center: coord, zoom: 10))
self.mapView.camera.fly(to: CameraOptions(center: point.coordinates, zoom: 10))
}
case .failure(let error):
self.showAlert(with: "An error occurred: \(error.localizedDescription)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class FeaturesAtPointExample: UIViewController, ExampleProtocol {
options: RenderedQueryOptions(layerIds: ["US-states"], filter: nil)) { [weak self] result in
switch result {
case .success(let queriedfeatures):
if let firstFeature = queriedfeatures.first?.feature.properties,
if let firstFeature = queriedfeatures.first?.feature?.properties,
let stateName = firstFeature["STATE_NAME"] as? String {
self?.showAlert(with: "You selected \(stateName)")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ class SymbolClusteringExample: UIViewController, ExampleProtocol {
// Return the first feature at that location, then pass attributes to the alert controller.
// Check whether the feature has values for `ASSETNUM` and `LOCATIONDETAIL`. These properties
// come from the fire hydrant dataset and indicate that the selected feature is not clustered.
if let selectedFeatureProperties = queriedFeatures.first?.feature.properties,
if let selectedFeatureProperties = queriedFeatures.first?.feature?.properties,
let featureInformation = selectedFeatureProperties["ASSETNUM"] as? String,
let location = selectedFeatureProperties["LOCATIONDETAIL"] as? String {
self?.showAlert(withTitle: "Hydrant \(featureInformation)", and: "\(location)")
// If the feature is a cluster, it will have `point_count` and `cluster_id` properties. These are assigned
// when the cluster is created.
} else if let selectedFeatureProperties = queriedFeatures.first?.feature.properties,
} else if let selectedFeatureProperties = queriedFeatures.first?.feature?.properties,
let pointCount = selectedFeatureProperties["point_count"] as? Int,
let clusterId = selectedFeatureProperties["cluster_id"] as? Int {
// If the tap landed on a cluster, pass the cluster ID and point count to the alert.
Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,27 @@ Mapbox welcomes participation and contributions from everyone.

## main

### Breaking changes ⚠️

* `QueriedFeature.feature` is now of type `Turf.Feature?` instead of `MapboxCommon.Feature`. ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Enables error notification in offline mode if the required resource is missing in cache (before map did not emit any notification in this case) ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Suppresses error notifications on missing volatile tiles in offline mode ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Adapt setBounds to gl-js behavior: constraining of coordinates and zoom level is now stricter to prevent out of bounds map area to be visible in the viewport ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Add HTTP interceptor API - HttpServiceInterface has a new method `setInterceptor` that must be implemented ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))

### Features ✨ and improvements 🏁

* It is no longer necessary to `import Turf`. [#622](https://github.com/mapbox/mapbox-maps-ios/pull/622)
* `Geometry` now refers to `Turf.Geometry` instead of `MapboxCommon.Geometry`. [#622](https://github.com/mapbox/mapbox-maps-ios/pull/622)
* It is no longer necessary to `import Turf`. ([#622](https://github.com/mapbox/mapbox-maps-ios/pull/622))
* `Geometry` now refers to `Turf.Geometry` instead of `MapboxCommon.Geometry`. ([#622](https://github.com/mapbox/mapbox-maps-ios/pull/622))
* Annotation managers now sync their annotations to their backing source and layer only once per display link. ([#621](https://github.com/mapbox/mapbox-maps-ios/pull/621))
* Use `syncAnnotationsIfNeeded()` to force the sync to happen earlier if needed.
* Enable instant transitions for data driven paint layer properties ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))

### Bug fixes 🐞

* Fix volatile tiles disappearing on "not modified" response ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Fix crash in MapboxMap.clearData() ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))
* Trigger map redraw when feature state changes ([#628](https://github.com/mapbox/mapbox-maps-ios/pull/628))

## 10.0.0-rc.7 - August 25, 2021

Expand Down
4 changes: 2 additions & 2 deletions MapboxMaps.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Pod::Spec.new do |m|
m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}'
m.resources = 'Sources/**/*.{xcassets,strings}'

m.dependency 'MapboxCoreMaps', '10.0.0-rc.7.2'
m.dependency 'MapboxCommon', '17.1.0'
m.dependency 'MapboxCoreMaps', '10.0.0-rc.8'
m.dependency 'MapboxCommon', '18.0.0'
m.dependency 'MapboxMobileEvents', '1.0.2'
m.dependency 'Turf', '2.0.0-rc.1'

Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"repositoryURL": "https://github.com/mapbox/mapbox-common-ios.git",
"state": {
"branch": null,
"revision": "82eaeed75ac3cb7a8f386009a4fca7f1fb3f8697",
"version": "17.1.0"
"revision": "a69e8ec4684ea2db20c94e85bcb54497554500d0",
"version": "18.0.0"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "f619bd71a80be83c8bae6ed28f9c1b218bdde555",
"version": "10.0.0-rc.7.2"
"revision": "d5360ef24a2038150ab68c67ada0893f6d5b5b15",
"version": "10.0.0-rc.8"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let package = Package(
targets: ["MapboxMaps"]),
],
dependencies: [
.package(name: "MapboxCoreMaps", url: "https://github.com/mapbox/mapbox-core-maps-ios.git", .exact("10.0.0-rc.7.2")),
.package(name: "MapboxCoreMaps", url: "https://github.com/mapbox/mapbox-core-maps-ios.git", .exact("10.0.0-rc.8")),
.package(name: "MapboxMobileEvents", url: "https://github.com/mapbox/mapbox-events-ios.git", .exact("1.0.2")),
.package(name: "MapboxCommon", url: "https://github.com/mapbox/mapbox-common-ios.git", .exact("17.1.0")),
.package(name: "MapboxCommon", url: "https://github.com/mapbox/mapbox-common-ios.git", .exact("18.0.0")),
.package(name: "Turf", url: "https://github.com/mapbox/turf-swift.git", .exact("2.0.0-rc.1")),
.package(name: "CocoaImageHashing", url: "https://github.com/ameingast/cocoaimagehashing", .exact("1.9.0"))
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public class CircleAnnotationManager: AnnotationManager {
switch result {

case .success(let queriedFeatures):
if let annotationIds = queriedFeatures.compactMap(\.feature.properties["annotation-id"]) as? [String] {
if let annotationIds = queriedFeatures.compactMap({ $0.feature?.properties?["annotation-id"] }) as? [String] {

let tappedAnnotations = self.annotations.filter { annotationIds.contains($0.id) }
self.delegate?.annotationManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public class PointAnnotationManager: AnnotationManager {
switch result {

case .success(let queriedFeatures):
if let annotationIds = queriedFeatures.compactMap(\.feature.properties["annotation-id"]) as? [String] {
if let annotationIds = queriedFeatures.compactMap({ $0.feature?.properties?["annotation-id"] }) as? [String] {

let tappedAnnotations = self.annotations.filter { annotationIds.contains($0.id) }
self.delegate?.annotationManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public class PolygonAnnotationManager: AnnotationManager {
switch result {

case .success(let queriedFeatures):
if let annotationIds = queriedFeatures.compactMap(\.feature.properties["annotation-id"]) as? [String] {
if let annotationIds = queriedFeatures.compactMap({ $0.feature?.properties?["annotation-id"] }) as? [String] {

let tappedAnnotations = self.annotations.filter { annotationIds.contains($0.id) }
self.delegate?.annotationManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public class PolylineAnnotationManager: AnnotationManager {
switch result {

case .success(let queriedFeatures):
if let annotationIds = queriedFeatures.compactMap(\.feature.properties["annotation-id"]) as? [String] {
if let annotationIds = queriedFeatures.compactMap({ $0.feature?.properties?["annotation-id"] }) as? [String] {

let tappedAnnotations = self.annotations.filter { annotationIds.contains($0.id) }
self.delegate?.annotationManager(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import MapboxCoreMaps

extension QueriedFeature {
public var feature: Turf.Feature? {
return Turf.Feature(__feature)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal class FeatureQueryingTest: MapViewIntegrationTestCase {

let expectedFilteredFeatures = unfilteredFeatures.filter { queriedFeature in
// `GeometryType(1)` is equal to `GemoetryType`, `point`
return queriedFeature.feature.geometry.geometryType == GeometryType(1)
return queriedFeature.feature?.geometry.type == .Point
}

// Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class CustomHttpService: HttpServiceInterface {
print("TODO: download(for:callback:) conformance")
return 0
}

func setInterceptorForInterceptor(_ interceptor: HttpServiceInterceptorInterface?) {
print("TODO: setInterceptorForInterceptor(_:) conformance")
}
}

class HTTPIntegrationTests: MapViewIntegrationTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ class MigrationGuideIntegrationTests: IntegrationTestCase {
func download(for options: DownloadOptions, callback: @escaping DownloadStatusCallback) -> UInt64 {
fatalError("TODO")
}

func setInterceptorForInterceptor(_ interceptor: HttpServiceInterceptorInterface?) {
fatalError("TODO")
}
}

let appDelegate = AppDelegate()
Expand Down
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-150.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-200.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-250.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-300.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/MapboxMapsTests/Snapshot/testSnapshotAttribution-50.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions scripts/release/packager/versions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"MapboxCoreMaps": "10.0.0-rc.7.2",
"MapboxCommon": "17.1.0",
"MapboxCoreMaps": "10.0.0-rc.8",
"MapboxCommon": "18.0.0",
"Turf": "v2.0.0-rc.1",
"MapboxMobileEvents": "v1.0.2"
}

0 comments on commit 500e8f3

Please sign in to comment.