Skip to content

Commit

Permalink
internal to main merge. (#57)
Browse files Browse the repository at this point in the history
* Send unique report per each run measurement (#1633)

* Prevent view annotation being shown erroneously after options update (#1627)

* Add an example animating a view annotation along a route line (#1639)

* Fix unit tests on iPhone mini 12/13 (#1643)

* Add generated Annotation Manager Tests (#1617)

* Add Initial Annotation Manager Tests

* Add generated tests for all annotation managers

* Resolve swiftlint issues

* Reduce location provider heading orientation update frequency (#1618)

* Increase timeout for view annotation animation example (#1645)

* Expose list of added view annotations (#1621)

* Fix view annotation animation example crashing on iOS 13 (#1653)

* Delay view annotation animation start

* Fiddle with CircleCI

* Delaying animation start

* Fix build errors

* Tangible animation delay + window scene link

* Disable animation altogether

* Finish the example right after setting it up

* Throw away unneeded tests

* Remove all setup

* Uncomment source

* Uncomment layer

* Uncomment view annotations

* Wait for 21 sec

* Wait for 1 sec

* Run animation with 3s delay

* Start the animation immediatedly

* Common mode for display link

* Default mode for display link

* Revert test setup

* Bump CoreMaps to 10.9.0 MapboxCommon to 23.1.0 (#1652)

* Support 120Hz in DebugMap example (#1647)

* Enable 120Hz on supported screens in DebugMap example

* Drop pre-Xcode 13 compilation conditions

* Fix swiftlint warning

* Bump version to 10.9.0 (#1656)

* Use different set of devices for Examples tests (#1660)

* Feature/fix warnings (#1661)

* Ignore deprecated examples in Release config

* Fix warnings

* Update the latest Xcode

* Improve swiftlint configuration

* Store correct artifacts for Examples Tests

* Avoid triggering assertion for the 3D puck layer when returning `allLayerIdentifiers` (#1650)

* Improve reduced accuracy authorization location indicator behavior while zooming (#1644)

* Use iPhone 13 Pro for individul device tests (#1664)

* Add Cluster Support for Point Annotation Managers (#1651)

* Enable clustering of point annotations, create cluster options, add example and tests

* Add first tests for clustering

* Add tests and documentation

* Update Project file paths

* Add new function definition to allowlist

* Improve example, add better documentation

* Add and fix unit tests

* Update access level and fix swiftlint

* Respond to PR comments

* Add changelog entry

* Jazzy docs

* Remove colorLevels in favor of circleColorExpression

* Update destoy to include the added cluster layers

* Reorganize cluster options, expand example

* Adjust documentation

* Bugfix/mapsios 328 better handling set style result observers (#1665)

* Add test case to verify loadStyle handler is invoked exactly once
* Cancel loadStyle observers on first expected events received

* Update CHANGELOG.md (#1667)

* Disable indexing on CI machines (#1672)

* Remove outdated performance baseline (#1671)

* Remove outdates performance baseline

* Remove Baseline related code from XCParty

* Update XCParty to support Xcode 14

* Feature/mapsios 367 frame view annotations (#1634)

* API to get camera options to fit a list of view annotations.

* Run MetricsV2 tests when CIRCLECI_TAG is set (#1674)

* Remove ornament position deprecation (#1676)

Co-authored-by: Roman Gardukevich <roman.gardukevich@mapbox.com>
Co-authored-by: Roman Laitarenko <roman.laitarenko@mapbox.com>
Co-authored-by: Patrick Leonard <pjleonard37@users.noreply.github.com>
Co-authored-by: Mai Mai <mai.mai@mapbox.com>
Co-authored-by: ZiZi <44972592+ZiZasaurus@users.noreply.github.com>
  • Loading branch information
6 people committed Nov 2, 2022
1 parent a494028 commit c78df43
Show file tree
Hide file tree
Showing 31 changed files with 973 additions and 221 deletions.
13 changes: 9 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ workflows:
scheme: Examples
requires:
- Build Examples tests [non-internal]
devices: --device model=iphone8,version=14.7
devices: --device model=iphone13pro,version=15.7

steve:
unless: << pipeline.parameters.turf-revision >>
Expand Down Expand Up @@ -421,15 +421,20 @@ jobs:
- run:
name: Run Workflow
command: |
if [[ $CIRCLE_BRANCH == internal ]]; then
curl -X POST "https://circleci.com/api/v2/project/github/mapbox/mapbox-maps-ios-internal/pipeline" \
RUN_TESTS=false
if [[ $CIRCLE_BRANCH == "internal" || -n $CIRCLE_TAG ]]; then
RUN_TESTS=true
fi
curl -X POST "https://circleci.com/api/v2/project/github/mapbox/mapbox-maps-ios-internal/pipeline" \
-H 'Content-Type: application/json' \
-H "Circle-Token: $CIRCLECI_API_TOKEN_MAPBOX_MAPS_IOS_INTERNAL" \
-d $'{
"branch": "internal",
"parameters": {
"maps-ios-checkout-reference": "<< pipeline.git.revision >>",
"run-tests": true
"run-tests": '$RUN_TESTS'
}
}'
else
Expand Down
6 changes: 3 additions & 3 deletions .fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ platform :ios do
scheme: 'Examples', # XCTest scheme
clean: true, # Recommended: This would ensure the build would not include unnecessary files
configuration: "Release",
xcargs: "ENABLE_TESTABILITY=YES SWIFT_TREAT_WARNINGS_AS_ERRORS=NO",
xcargs: "ENABLE_TESTABILITY=YES SWIFT_TREAT_WARNINGS_AS_ERRORS=NO COMPILER_INDEX_STORE_ENABLE=NO",
skip_detect_devices: true, # Required
build_for_testing: true, # Required
sdk: 'iphoneos', # Required
Expand Down Expand Up @@ -89,7 +89,7 @@ platform :ios do
build_app(
scheme: "Examples",
workspace: "Apps/Apps.xcworkspace",
xcargs: "SWIFT_TREAT_WARNINGS_AS_ERRORS=NO" # Disable to bypass Deprecated error on OfflineManager example
xcargs: "SWIFT_TREAT_WARNINGS_AS_ERRORS=NO COMPILER_INDEX_STORE_ENABLE=NO" # Disable to bypass Deprecated error on OfflineManager example
)
upload_to_testflight(
beta_app_feedback_email: "applemachine@mapbox.com",
Expand Down Expand Up @@ -117,7 +117,7 @@ platform :ios do
scheme: 'MapboxTestHost',
clean: true,
configuration: "Release",
xcargs: "ENABLE_TESTABILITY=YES",
xcargs: "ENABLE_TESTABILITY=YES COMPILER_INDEX_STORE_ENABLE=NO",
build_for_testing: true,
destination: 'generic/platform=iOS',
should_zip_build_products: true,
Expand Down
8 changes: 8 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
304AB3B527439287005B6D09 /* ViewAnnotationMarkerExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 304AB3B427439287005B6D09 /* ViewAnnotationMarkerExample.swift */; };
30517C6A274BD4D300B706E5 /* ViewAnnotationBasicExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30517C69274BD4D300B706E5 /* ViewAnnotationBasicExample.swift */; };
3A3AF0032836499F0036F483 /* route.geojson in Resources */ = {isa = PBXBuildFile; fileRef = 3A3AF0022836499F0036F483 /* route.geojson */; };
3A44669E28F6EA1600664AF5 /* FrameViewAnnotationsExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A44669D28F6EA1600664AF5 /* FrameViewAnnotationsExample.swift */; };
3A7432EF27F3096100E06485 /* DebugMapExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A7432EE27F3096100E06485 /* DebugMapExample.swift */; };
3A7CE986282511C900C3A0B8 /* NavigationSimulatorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A7CE985282511C900C3A0B8 /* NavigationSimulatorExample.swift */; };
3A7CE98B282AB0DE00C3A0B8 /* NavigationSimulator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A7CE98A282AB0DE00C3A0B8 /* NavigationSimulator.swift */; };
Expand All @@ -51,6 +52,7 @@
58A3C0C925C4B93600CAE5F0 /* AnimateGeoJSONLineExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58A3C0C825C4B93600CAE5F0 /* AnimateGeoJSONLineExample.swift */; };
732A550028DA470E00CDBFB7 /* PitchAndDistanceExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 732A54FF28DA470E00CDBFB7 /* PitchAndDistanceExample.swift */; };
73694BD325D4B2CE0064F636 /* TrackingModeExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73694BD225D4B2CE0064F636 /* TrackingModeExample.swift */; };
7395C38828FEDFCF00071A33 /* PointAnnotationClusteringExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7395C38728FEDFCF00071A33 /* PointAnnotationClusteringExample.swift */; };
73E27C2627AF024C0067F277 /* DataJoinExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73E27C2527AF024C0067F277 /* DataJoinExample.swift */; };
7406E3702806B66F002CC41F /* ResizableImageExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7406E36F2806B66F002CC41F /* ResizableImageExample.swift */; };
7412CF6227E8DD1E00F03B1C /* AddOneMarkerSymbolExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7412CF6127E8DD1E00F03B1C /* AddOneMarkerSymbolExample.swift */; };
Expand Down Expand Up @@ -190,6 +192,7 @@
304AB3B427439287005B6D09 /* ViewAnnotationMarkerExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewAnnotationMarkerExample.swift; sourceTree = "<group>"; };
30517C69274BD4D300B706E5 /* ViewAnnotationBasicExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewAnnotationBasicExample.swift; sourceTree = "<group>"; };
3A3AF0022836499F0036F483 /* route.geojson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = route.geojson; sourceTree = "<group>"; };
3A44669D28F6EA1600664AF5 /* FrameViewAnnotationsExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrameViewAnnotationsExample.swift; sourceTree = "<group>"; };
3A7432EE27F3096100E06485 /* DebugMapExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugMapExample.swift; sourceTree = "<group>"; };
3A7CE985282511C900C3A0B8 /* NavigationSimulatorExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSimulatorExample.swift; sourceTree = "<group>"; };
3A7CE98A282AB0DE00C3A0B8 /* NavigationSimulator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationSimulator.swift; sourceTree = "<group>"; };
Expand All @@ -206,6 +209,7 @@
666E0D4925664EE7000B8AF5 /* LayerPositionExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayerPositionExample.swift; sourceTree = "<group>"; };
732A54FF28DA470E00CDBFB7 /* PitchAndDistanceExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PitchAndDistanceExample.swift; sourceTree = "<group>"; };
73694BD225D4B2CE0064F636 /* TrackingModeExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackingModeExample.swift; sourceTree = "<group>"; };
7395C38728FEDFCF00071A33 /* PointAnnotationClusteringExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointAnnotationClusteringExample.swift; sourceTree = "<group>"; };
73E27C2527AF024C0067F277 /* DataJoinExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataJoinExample.swift; sourceTree = "<group>"; };
7406E36F2806B66F002CC41F /* ResizableImageExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResizableImageExample.swift; sourceTree = "<group>"; };
7412CF6127E8DD1E00F03B1C /* AddOneMarkerSymbolExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOneMarkerSymbolExample.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -495,9 +499,11 @@
07A2E03C25CB64E20082BC31 /* SwiftUIExample.swift */,
17E28C5B2672A1160033DF0F /* SymbolClusteringExample.swift */,
30517C69274BD4D300B706E5 /* ViewAnnotationBasicExample.swift */,
3A44669D28F6EA1600664AF5 /* FrameViewAnnotationsExample.swift */,
74797C1928F5B72F0008BBB9 /* ViewAnnotationAnimationExample.swift */,
304AB3B427439287005B6D09 /* ViewAnnotationMarkerExample.swift */,
74A2313D27EE1C630065FB7D /* ViewAnnotationWithPointAnnotationExample.swift */,
7395C38728FEDFCF00071A33 /* PointAnnotationClusteringExample.swift */,
);
path = Annotations;
sourceTree = "<group>";
Expand Down Expand Up @@ -741,6 +747,7 @@
CADCF71F2584990E0065C51B /* DataDrivenSymbolsExample.swift in Sources */,
CADCF7302584990E0065C51B /* LayerPositionExample.swift in Sources */,
CA86E81825BE7C2300E5A1D9 /* BuildingExtrusionsExample.swift in Sources */,
7395C38828FEDFCF00071A33 /* PointAnnotationClusteringExample.swift in Sources */,
C608C107267BC5B1003C86C3 /* LocalizationExample.swift in Sources */,
0706C4A625B1181A008733C0 /* TerrainExample.swift in Sources */,
CADCF7282584990E0065C51B /* LineAnnotationExample.swift in Sources */,
Expand Down Expand Up @@ -770,6 +777,7 @@
0C52BA9825AF8C880054ECA8 /* Custom3DPuckExample.swift in Sources */,
CADCF7292584990E0065C51B /* FeaturesAtPointExample.swift in Sources */,
CADCF71E2584990E0065C51B /* ExternalVectorSourceExample.swift in Sources */,
3A44669E28F6EA1600664AF5 /* FrameViewAnnotationsExample.swift in Sources */,
7412CF6227E8DD1E00F03B1C /* AddOneMarkerSymbolExample.swift in Sources */,
74A2313E27EE1C640065FB7D /* ViewAnnotationWithPointAnnotationExample.swift in Sources */,
73694BD325D4B2CE0064F636 /* TrackingModeExample.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import UIKit
import MapboxMaps

final class FrameViewAnnotationsExample: UIViewController, ExampleProtocol {

private enum Animator {
case flyTo, easeTo, viewport
}

private var flyToButton: UIButton!
private var easeToButton: UIButton!
private var viewportButton: UIButton!
private var resetButton: UIButton!

private var mapView: MapView!
private let initialCamera = CameraOptions(
center: .random,
padding: UIEdgeInsets(top: .random(in: 0...20), left: .random(in: 0...20), bottom: .random(in: 0...20), right: .random(in: 0...20)),
zoom: 0,
bearing: 0,
pitch: 0
)

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .white

mapView = MapView(frame: view.bounds, mapInitOptions: MapInitOptions(cameraOptions: initialCamera))
let buttonsView = makeButtonsView()

view.addSubview(mapView)
view.addSubview(buttonsView)

mapView.translatesAutoresizingMaskIntoConstraints = false
buttonsView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
mapView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
mapView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
mapView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
mapView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
buttonsView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
buttonsView.leadingAnchor.constraint(greaterThanOrEqualTo: view.safeAreaLayoutGuide.leadingAnchor),
buttonsView.bottomAnchor.constraint(equalTo: mapView.ornaments.logoView.topAnchor, constant: -10),
])

addAnnotations()

mapView.mapboxMap.onNext(event: .mapLoaded) { [weak self] _ in
// The below line is used for internal testing purposes only.
self?.finish()
}
}

private func makeButtonsView() -> UIView {
func makeButton(title: String, selector: Selector) -> UIButton {
let button = UIButton()
button.setTitle(title, for: .normal)
button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 20, bottom: 10, right: 20)
button.backgroundColor = .black
button.addTarget(self, action: selector, for: .touchUpInside)
return button
}

flyToButton = makeButton(title: "FlyTo", selector: #selector(flyToButtonTapped(_:)))
easeToButton = makeButton(title: "EaseTo", selector: #selector(easeToButtonTapped(_:)))
viewportButton = makeButton(title: "Viewport", selector: #selector(viewportButtonTapped(_:)))
resetButton = makeButton(title: "Reset camera", selector: #selector(resetButtonTapped(_:)))

let buttonsView = UIStackView(arrangedSubviews: [flyToButton, easeToButton, viewportButton, resetButton])
buttonsView.axis = .horizontal
buttonsView.spacing = 10
buttonsView.distribution = .fillEqually

resetButton.isHidden = true

return buttonsView
}

@objc private func flyToButtonTapped(_ sender: UIButton) {
frameViewAnnotation(with: .flyTo, sender: sender)
}

@objc private func easeToButtonTapped(_ sender: UIButton) {
frameViewAnnotation(with: .easeTo, sender: sender)
}

@objc private func viewportButtonTapped(_ sender: UIButton) {
frameViewAnnotation(with: .viewport, sender: sender)
}

@objc private func resetButtonTapped(_ sender: UIButton) {
mapView.mapboxMap.setCamera(to: initialCamera)
resetButton.isHidden = true
flyToButton.isHidden = false
easeToButton.isHidden = false
viewportButton.isHidden = false
}

private func frameViewAnnotation(with animator: Animator, sender: UIButton) {
flyToButton.isHidden = true
easeToButton.isHidden = true
viewportButton.isHidden = true
resetButton.isHidden = false

let camera = self.mapView.viewAnnotations.camera(
forAnnotations: Array(self.coordinates.keys),
padding: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
bearing: nil,
pitch: nil
)!

switch animator {
case .flyTo:
mapView.camera.fly(to: camera, duration: 1)
case .easeTo:
mapView.camera.ease(to: camera, duration: 1)
case .viewport:
let bounds = mapView.mapboxMap.coordinateBounds(for: camera)
let overviewViewportStateOptions = OverviewViewportStateOptions(
geometry: MultiPoint([bounds.northeast, bounds.southeast, bounds.southwest, bounds.northwest]),
padding: .zero,
bearing: camera.bearing,
pitch: camera.pitch,
animationDuration: 1
)
let overviewViewportState = mapView.viewport.makeOverviewViewportState(options: overviewViewportStateOptions)
mapView.viewport.transition(to: overviewViewportState)
}
}

private func addAnnotations() {
for (id, point) in coordinates {
let options = ViewAnnotationOptions(
geometry: point.geometry,
width: 40,
height: 40,
allowOverlap: true,
anchor: .center,
offsetX: 0,
offsetY: 0)
let annotation = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
annotation.backgroundColor = .green
try! mapView.viewAnnotations.add(annotation, id: id, options: options)
}
}

private let coordinates: [String: Point] = [
"Saigon": .init(LocationCoordinate2D(latitude: 10.823099, longitude: 106.629662)),
"Hanoi": .init(LocationCoordinate2D(latitude: 21.027763, longitude: 105.834160)),
"Tokyo": .init(LocationCoordinate2D(latitude: 35.689487, longitude: 139.691711)),
"Bangkok": .init(LocationCoordinate2D(latitude: 13.756331, longitude: 100.501762)),
"Jakarta": .init(LocationCoordinate2D(latitude: -6.175110, longitude: 106.865036)),
]
}
Loading

0 comments on commit c78df43

Please sign in to comment.