Skip to content

Commit

Permalink
internal to main merge. (#48)
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)

Co-authored-by: Roman Gardukevich <roman.gardukevich@mapbox.com>
Co-authored-by: Roman Laitarenko <roman.laitarenko@mapbox.com>
  • Loading branch information
3 people authored Oct 12, 2022
1 parent 6d993ea commit 0f4ec47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Mapbox welcomes participation and contributions from everyone.

## main

* Prevent view annotation being shown erroneously after options update.([#1627](https://github.com/mapbox/mapbox-maps-ios/pull/1627))

## 10.9.0-rc.1 - October 7, 2022

* Fix accuracy ring radius jumping when zooming the map in/out with `.reducedAccuracy` location authorization.([#1625](https://github.com/mapbox/mapbox-maps-ios/pull/1625))
Expand Down
9 changes: 6 additions & 3 deletions Sources/MapboxMaps/Annotations/ViewAnnotationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ public final class ViewAnnotationManager {
}
let currentFeatureId = try? mapboxMap.options(forViewAnnotationWithId: id).associatedFeatureId
try mapboxMap.updateViewAnnotation(withId: id, options: options)
let isHidden = !(options.visible ?? true)
expectedHiddenByView[view] = isHidden
viewsById[id]?.isHidden = isHidden

if options.visible == false {
expectedHiddenByView[view] = true
view.isHidden = true
}

if let id = currentFeatureId, let updatedId = options.associatedFeatureId, id != updatedId {
viewsByFeatureIds[id] = nil
}
Expand Down
11 changes: 11 additions & 0 deletions Tests/MapboxMapsTests/Annotations/ViewAnnotationManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,17 @@ final class ViewAnnotationManagerTests: XCTestCase {
XCTAssertTrue(annotationViewC.isHidden)
}

func testViewAnnotationUpdateDoesNotUnhideHiddenViews() throws {
let annotationView = addTestAnnotationView()
let id = try XCTUnwrap(mapboxMap.addViewAnnotationStub.invocations.last?.parameters.id)

manager.onViewAnnotationPositionsUpdate(forPositions: [])

try manager.update(annotationView, options: ViewAnnotationOptions())

XCTAssertTrue(annotationView.isHidden)
}

func testViewAnnotationUpdateObserverNotifiedAboutUpdatedFrames() throws {
let annotationView = addTestAnnotationView()
let id = try XCTUnwrap(mapboxMap.addViewAnnotationStub.invocations.last?.parameters.id)
Expand Down

0 comments on commit 0f4ec47

Please sign in to comment.