Skip to content

Commit

Permalink
internal to main merge. (#92)
Browse files Browse the repository at this point in the history
* Fix issue with map spinning when setting destBearing and sourceBearing to 102 (#1793) (#1828)

Co-authored-by: Niwaka <61189782+NiwakaDev@users.noreply.github.com>

* Enable CircleCI contexts for shared environment variables (#1852)

* Use the latest v4 Slack Orb

* Add 'Slack Orb' context for each job

* MAPSIOS-556: Adopt shared context for CocoaPods trunk token

* MAPSIOS-558: Adopt shared context for Fastlane Match password

* MAPSIOS-557: Adopt shared context for SDK Registry token

* MAPSIOS-555: Adopt shared context for Apple credentials/ASC token

* Remove unused license template (#1857)

* Fix missing contexts, reuse CircleCI token (#1859)

* Enable GoogleCloud shared credentials (#1861)

* Enable 'Retry on Failure' up to 3 times for all tests (#1860)

* Add missing public mapbox token (#1863)

* Run IntegrationTests even when unit tests failing (#1864)

* Add Mapbox public token to unit tests (#1865)

* Move mapbox token to build unit tests (#1866)

* Add public Mapbox token to build unit test jobs

* Revert "Add Mapbox public token to unit tests (#1865)"

This reverts commit efba681.

* Improve stability of attribution parsing (#1849)

* Mapsios 567 mark no op and deprecate v10.11.0 properties (#1867)

* Extract integration tests to the separate CircleCI job (#1870)

* Rename job to build host tests

* Rename job to build tests

* Rename job to build firebase tests

* Rename Build tests job

* Run integration tests

* Code coverage command

* Enable codecoverage by default

* Run integration tests on nightly bases

* Utilize default values for run-integration-tests job

* Remove unused arg

* Enable Expression to be created without an operator (#1855)

* Change clusterProperties to accept array

* Break up expression and reassemble for clusterProperties

* Adjust example so app can run

* Introduce operatorless expression

* Add additional tests, update comments

* Enable operatorless encoding, add tests

* Add property back, update filtering

* Remove generated update

* Fix argument and operator access

* Update Sources/MapboxMaps/Style/Types/Expression.swift

Co-authored-by: Mai Mai <mai.mai@mapbox.com>

* Add changelog, update expression operator to simplify

Co-authored-by: Mai Mai <mai.mai@mapbox.com>

* Bump activesupport from 6.1.5 to 6.1.7.2 in /scripts/doc-generation (#1874)

Bumps [activesupport](https://github.com/rails/rails) from 6.1.5 to 6.1.7.2.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v7.0.4.2/activesupport/CHANGELOG.md)
- [Commits](rails/rails@v6.1.5...v6.1.7.2)

---
updated-dependencies:
- dependency-name: activesupport
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Maps versions (#1875)

* Update CoreMaps and Common

* Update license

* Update changelog

* Generate development DocC on PR merges (#1873)

* Generate DocC

* Upload DocC to the 'latest'

* Fix test results collection

* Debug

* Extra push to force CI trigger

* Last fixes

* Code review fixes

* Add 10.11.0-rc.1 changelog entry (#1876)

* Update SDK version (#1877)

* Add missing changelog for #1828 (#1880)

* Skip codecov for Xcode 12.5.1 (#1879)

* Replace test skips with failures (#1862)

* Couple of fixes for release workflow (#1883)

* Add basic signposts for rendering tracing (#1818)

* Add basic signposts for rendering tracing

* turn on signposts in tests

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Patrick Leonard <pjleonard37@users.noreply.github.com>
Co-authored-by: Niwaka <61189782+NiwakaDev@users.noreply.github.com>
Co-authored-by: Roman Gardukevich <roman.gardukevich@mapbox.com>
Co-authored-by: Roman Laitarenko <roman.laitarenko@mapbox.com>
Co-authored-by: Mai Mai <mai.mai@mapbox.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ivan Persidsky <ivan.persidskii@mapbox.com>
  • Loading branch information
8 people committed Jan 27, 2023
1 parent 4c3ae16 commit ea3705a
Show file tree
Hide file tree
Showing 61 changed files with 1,371 additions and 516 deletions.
665 changes: 479 additions & 186 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ENV["SPACESHIP_SKIP_2FA_UPGRADE"] = "1"
platform :ios do

lane :build_examples_tests do
app_store_connect_api_key
setup_circle_ci
sync_code_signing
update_code_signing_settings(
Expand Down
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": "d6e7b7d8df0ec523eb63412daf2f2fa4f58e0a55",
"version": "23.3.0-beta.1"
"revision": "775d6d749821f41ab25798eeaad1089ae250fd4c",
"version": "23.3.0-rc.1"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "439dc92d71ee10f7fb6c3ca89468586c65bb5108",
"version": "10.11.0-beta.1"
"revision": "d16dc2b0a053611b81b3b2ce4052a8662f849d72",
"version": "10.11.0-rc.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "MAPBOX_MAPS_SIGNPOSTS_ENABLED"
value = ""
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<LocationScenarioReference
identifier = "London, England"
referenceType = "1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "MAPBOX_MAPS_SIGNPOSTS_ENABLED"
value = ""
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,30 @@ class PointAnnotationClusteringExample: UIViewController, ExampleProtocol {
UIColor.lightPink
}

// Create a cluster property to add to each cluster feature
// This will be added to the cluster textField below
let clusterProperty: [String: Expression] = ["pointString": Exp(.string) { "Count:\n" }]
// Create expression to get the total count of hydrants in a cluster
let sumExpression = Exp {
Exp(.sum) {
Exp(.accumulated)
Exp(.get) { "sum" }
}
1
}

// Create a cluster property to add to each cluster
let clusterProperties: [String: Expression] = [
"sum": sumExpression
]

// Select the options for clustering and pass them to the PointAnnotationManager to display
let clusterOptions = ClusterOptions(circleRadius: .expression(circleRadiusExpression),
circleColor: .expression(circleColorExpression),
textColor: .constant(StyleColor(.black)),
textField: .expression(Exp(.concat) {
Exp(.get) {"pointString"}
Exp(.get) {"point_count"}
Exp(.string) { "Count:\n" }
Exp(.get) {"sum"} // alternatively, you can use the built-in "point_count" property: Exp(.get) {"point_count"}
}),
clusterRadius: 75,
clusterProperties: clusterProperty)
clusterProperties: clusterProperties)
let pointAnnotationManager = mapView.annotations.makePointAnnotationManager(id: clusterLayerID, clusterOptions: clusterOptions)
pointAnnotationManager.annotations = annotations
pointAnnotationManager.delegate = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,38 @@ class SymbolClusteringExample: UIViewController, ExampleProtocol {
// Enable clustering for this source.
source.cluster = true
source.clusterRadius = 75

// Create expression to identify the max flow rate of one hydrant in the cluster
// ["max", ["get", "FLOW"]]
let maxExpression = Exp(.max) {Exp(.get) { "FLOW" }}

// Create expression to determine if a hydrant with EngineID E-9 is in the cluster
// ["any", ["==", ["get", "ENGINEID"], "E-9"]]
let ine9Expression = Exp(.any) {
Exp(.eq) {
Exp(.get) { "ENGINEID" }
"E-9"
}
}

// Create expression to get the sum of all of the flow rates in the cluster
// [["+", ["accumulated"], ["get", "sum"]], ["get", "FLOW"]]
let sumExpression = Exp {
Exp(.sum) {
Exp(.accumulated)
Exp(.get) { "sum" }
}
Exp(.get) { "FLOW" }
}

// Add the expressions to the cluster as ClusterProperties so they can be accessed below
let clusterProperties: [String: Expression] = [
"max": maxExpression,
"in_e9": ine9Expression,
"sum": sumExpression
]
source.clusterProperties = clusterProperties

let sourceID = "fire-hydrant-source"

var clusteredLayer = createClusteredLayer()
Expand Down Expand Up @@ -153,10 +185,14 @@ class SymbolClusteringExample: UIViewController, ExampleProtocol {
// 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,
case let .number(pointCount) = selectedFeatureProperties["point_count"],
case let .number(clusterId) = selectedFeatureProperties["cluster_id"] {
// If the tap landed on a cluster, pass the cluster ID and point count to the alert.
self?.showAlert(withTitle: "Cluster ID \(Int(clusterId))", and: "There are \(Int(pointCount)) points in this cluster")
case let .number(pointCount) = selectedFeatureProperties["point_count"],
case let .number(clusterId) = selectedFeatureProperties["cluster_id"],
case let .number(maxFlow) = selectedFeatureProperties["max"],
case let .number(sum) = selectedFeatureProperties["sum"],
case let .boolean(in_e9) = selectedFeatureProperties["in_e9"] {
// If the tap landed on a cluster, pass the cluster ID and point count to the alert.
let inEngineNine = in_e9 ? "Some hydrants belong to Engine 9." : "No hydrants belong to Engine 9."
self?.showAlert(withTitle: "Cluster ID \(Int(clusterId))", and: "There are \(Int(pointCount)) hydrants in this cluster. The highest water flow is \(Int(maxFlow)) and the collective flow is \(Int(sum)). \(inEngineNine)")
}
case .failure(let error):
self?.showAlert(withTitle: "An error occurred: \(error.localizedDescription)", and: "Please try another hydrant")
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
Mapbox welcomes participation and contributions from everyone.

* Introduce `model-scale-mode` API to enable 3d puck size to stay similar in screen-space. ([#94](https://github.com/mapbox/mapbox-maps-ios-private/pull/94))
## main
* Added basic signposts for performance profiling. To enable them, use `MAPBOX_MAPS_SIGNPOSTS_ENABLED` environment variable. ([#1818](https://github.com/mapbox/mapbox-maps-ios/pull/1818))

## 10.11.0-rc.1 - January 26, 2023

* Improve stability of attribution parsing. ([#1849](https://github.com/mapbox/mapbox-maps-ios/pull/1849))
* Enable `Expression` to be created without an operator so `clusterProperties` can support advanced use cases. ([#1855](https://github.com/mapbox/mapbox-maps-ios/pull/1855))
* Update CoreMaps `10.11.0-rc.1` and CommonSDK `23.3.0-rc.1`. ([#1856](https://github.com/mapbox/mapbox-maps-ios/pull/1875))
* Angle normalization function was improved to prevent map spinning on close angles. ([#1828](https://github.com/mapbox/mapbox-maps-ios/pull/1828))

## 10.11.0-beta.1 - January 12, 2023

Expand All @@ -20,7 +29,7 @@ Mapbox welcomes participation and contributions from everyone.

## 10.10.1 - December 20, 2022

* [CarPlay] Fix map view permanently pausing when moving to window on foreground ([#1808])(https://github.com/mapbox/mapbox-maps-ios/pull/1808)
* [CarPlay] Fix map view permanently pausing when moving to window on foreground ([#1808](https://github.com/mapbox/mapbox-maps-ios/pull/1808))

## 10.10.0 - December 8, 2022

Expand Down
8 changes: 8 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,11 @@ own `UIWindow` and root view controller, before adding the MapView to it.

* Check out this [doc](https://github.com/mapbox/mapbox-maps-ios/blob/main/Apps/Examples/README.md)
to get more information about adding examples to our project.

## Tracing map performance

Internal events of MapboxMaps can captured in Xcode Instruments using [signposts](https://developer.apple.com/documentation/os/logging/recording_performance_data). Most useful examples of them:
- Rendering calls
- Gestures points of interests

In order to enable them, set `MAPBOX_MAPS_SIGNPOSTS_ENABLED` environment variable to your Profile Scheme.
3 changes: 1 addition & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The software and files in this repository (collectively, “Software”) are lic
## Acknowledgements

This application makes use of the following third party libraries:
### MapboxCoreMaps,10.11.0-beta.1,Mapbox ToS,Mapbox,https://www.mapbox.com/
### MapboxCoreMaps,10.11.0-rc.1,Mapbox ToS,Mapbox,https://www.mapbox.com/

```
Mapbox Core Maps version 10.0
Expand Down Expand Up @@ -1424,4 +1424,3 @@ All other rights reserved.
```

---

6 changes: 3 additions & 3 deletions MapboxMaps.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|

maps_version = '10.10.1-private'
maps_version = '10.11.0-rc.1-private'

m.name = 'MapboxMaps'
m.version = maps_version
Expand All @@ -21,9 +21,9 @@ Pod::Spec.new do |m|
m.source_files = 'Sources/MapboxMaps/**/*.{swift,h}'
m.resources = ['Sources/**/*.{xcassets,strings}', 'Sources/MapboxMaps/MapboxMaps.json']

m.dependency 'MapboxCoreMaps', '10.11.0-beta.1'
m.dependency 'MapboxCoreMaps', '10.11.0-rc.1'
m.dependency 'MapboxMobileEvents', '1.0.10'
m.dependency 'MapboxCommon', '23.3.0-beta.1'
m.dependency 'MapboxCommon', '23.3.0-rc.1'
m.dependency 'Turf', '~> 2.0'

end
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": "d6e7b7d8df0ec523eb63412daf2f2fa4f58e0a55",
"version": "23.3.0-beta.1"
"revision": "775d6d749821f41ab25798eeaad1089ae250fd4c",
"version": "23.3.0-rc.1"
}
},
{
"package": "MapboxCoreMaps",
"repositoryURL": "https://github.com/mapbox/mapbox-core-maps-ios.git",
"state": {
"branch": null,
"revision": "439dc92d71ee10f7fb6c3ca89468586c65bb5108",
"version": "10.11.0-beta.1"
"revision": "d16dc2b0a053611b81b3b2ce4052a8662f849d72",
"version": "10.11.0-rc.1"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ let package = Package(
targets: ["MapboxMaps"]),
],
dependencies: [
.package(name: "MapboxCoreMaps", url: "https://github.com/mapbox/mapbox-core-maps-ios.git", .exact("10.11.0-beta.1")),
.package(name: "MapboxCoreMaps", url: "https://github.com/mapbox/mapbox-core-maps-ios.git", .exact("10.11.0-rc.1")),
// We keep MME dependency for compatibility reasons
.package(name: "MapboxMobileEvents", url: "https://github.com/mapbox/mapbox-events-ios.git", .exact("1.0.10")),
.package(name: "MapboxCommon", url: "https://github.com/mapbox/mapbox-common-ios.git", .exact("23.3.0-beta.1")),
.package(name: "MapboxCommon", url: "https://github.com/mapbox/mapbox-common-ios.git", .exact("23.3.0-rc.1")),
.package(name: "Turf", url: "https://github.com/mapbox/turf-swift.git", from: "2.0.0"),
.package(name: "CocoaImageHashing", url: "https://github.com/ameingast/cocoaimagehashing", .exact("1.9.0"))
],
Expand Down
30 changes: 26 additions & 4 deletions Sources/MapboxMaps/Annotations/ClusterOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,34 @@ public struct ClusterOptions: Equatable {
/// clustered points. Has the form `{"property_name": [operator, map_expression]}`.
/// `operator` is any expression function that accepts at
/// least 2 operands (e.g. `"+"` or `"max"`) — it accumulates the property value from clusters/points the
/// cluster contains; `map_expression` produces the value of a single point.
/// cluster contains; `map_expression` produces the value of a single point. Example:
///
/// Example: `{"sum": ["+", ["get", "scalerank"]]}`.
/// ``Expression`` syntax:
/// ```
/// let expression = Exp(.sum) {
/// Exp(.get) { "scalerank" }
/// }
/// clusterProperties: ["sum": expression]
/// ```
///
/// For more advanced use cases, in place of `operator`, you can use a custom reduce expression
/// that references a special `["accumulated"]` value, e.g.:
/// JSON syntax:
/// `{"sum": ["+", ["get", "scalerank"]]}`
///
/// For more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `["accumulated"]` value. Example:
///
/// ``Expression`` syntax:
/// ```
/// let expression = Exp {
/// Exp(.sum) {
/// Exp(.accumulated)
/// Exp(.get) { "sum" }
/// }
/// Exp(.get) { "scalerank" }
/// }
/// clusterProperties: ["sum": expression]
/// ```
///
/// JSON syntax:
/// `{"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}`
var clusterProperties: [String: Expression]?

Expand Down
19 changes: 19 additions & 0 deletions Sources/MapboxMaps/Foundation/MapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@_implementationOnly import MapboxCoreMaps_Private
@_implementationOnly import MapboxCommon_Private
import UIKit
import os

// swiftlint:disable type_body_length
open class MapView: UIView {
Expand Down Expand Up @@ -181,6 +182,8 @@ open class MapView: UIView {
/// `ResourceOptionsManager.default` to retrieve a shared default resource option, including the access token.
@available(iOSApplicationExtension, unavailable)
public init(frame: CGRect, mapInitOptions: MapInitOptions = MapInitOptions()) {
let trace = OSLog.platform.beginInterval("MapView.init")
defer { trace.end() }
let orientationProvider: InterfaceOrientationProvider
if #available(iOS 13, *) {
orientationProvider = DefaultInterfaceOrientationProvider()
Expand Down Expand Up @@ -211,6 +214,8 @@ open class MapView: UIView {
mapInitOptions: MapInitOptions = MapInitOptions(),
orientationProvider: InterfaceOrientationProvider,
urlOpener: AttributionURLOpener) {
let trace = OSLog.platform.beginInterval("MapView.init")
defer { trace.end() }
dependencyProvider = MapViewDependencyProvider(interfaceOrientationProvider: orientationProvider)
attributionUrlOpener = urlOpener
notificationCenter = dependencyProvider.notificationCenter
Expand All @@ -232,6 +237,8 @@ open class MapView: UIView {
public init(frame: CGRect,
mapInitOptions: MapInitOptions = MapInitOptions(),
urlOpener: AttributionURLOpener) {
let trace = OSLog.platform.beginInterval("MapView.init")
defer { trace.end() }
dependencyProvider = MapViewDependencyProvider(
interfaceOrientationProvider: DefaultInterfaceOrientationProvider()
)
Expand All @@ -247,6 +254,8 @@ open class MapView: UIView {

@available(iOSApplicationExtension, unavailable)
required public init?(coder: NSCoder) {
let trace = OSLog.platform.beginInterval("MapView.init")
defer { trace.end() }
let orientationProvider: InterfaceOrientationProvider
if #available(iOS 13, *) {
orientationProvider = DefaultInterfaceOrientationProvider()
Expand All @@ -268,6 +277,8 @@ open class MapView: UIView {
mapInitOptions: MapInitOptions,
dependencyProvider: MapViewDependencyProviderProtocol,
urlOpener: AttributionURLOpener) {
let trace = OSLog.platform.beginInterval("MapView.init")
defer { trace.end() }
self.dependencyProvider = dependencyProvider
attributionUrlOpener = urlOpener
notificationCenter = dependencyProvider.notificationCenter
Expand Down Expand Up @@ -571,20 +582,28 @@ open class MapView: UIView {

@_spi(Metrics) public var metricsReporter: MapViewMetricsReporter?
private func updateFromDisplayLink(displayLink: CADisplayLink) {
let trace = OSLog.platform.beginInterval("MapView.displayLink")
defer { trace.end() }

metricsReporter?.beforeDisplayLinkCallback(displayLink: displayLink)
defer { metricsReporter?.afterDisplayLinkCallback(displayLink: displayLink) }

if window == nil {
return
}

for participant in displayLinkParticipants.allObjects {
participant.participate()
}
trace.event(message: "Participants")

cameraAnimatorsRunner.update()
trace.event(message: "Camera animations")

if needsDisplayRefresh {
needsDisplayRefresh = false
let trace = OSLog.platform.beginInterval("MetalView.draw")
defer { trace.end() }
metricsReporter?.beforeMetalViewDrawCallback(metalView: metalView)
metalView?.draw()
metricsReporter?.afterMetalViewDrawCallback(metalView: metalView)
Expand Down
5 changes: 2 additions & 3 deletions Sources/MapboxMaps/Foundation/MapboxMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,8 @@ extension MapboxMap {
// MARK: - Attribution

extension MapboxMap: AttributionDataSource {
internal func attributions() -> [Attribution] {
let attributions = Attribution.parse(style.sourceAttributions())
return attributions
internal func loadAttributions(completion: @escaping ([Attribution]) -> Void) {
Attribution.parse(style.sourceAttributions(), completion: completion)
}
}

Expand Down
Loading

0 comments on commit ea3705a

Please sign in to comment.