Skip to content

Commit

Permalink
Add the ability to set locale for top and bottom banner views (#4595)
Browse files Browse the repository at this point in the history
  • Loading branch information
kried authored Feb 16, 2024
1 parent fb0a314 commit c09a4b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
### User interface

* `SpeedLimitView` now shows a special "Limits no longer apply" sign on roads where speed limit is known to not exist. ([#4584](https://github.com/mapbox/mapbox-navigation-ios/pull/4584))
* `TopBannerViewController.delegate` and `TopBannerViewController.instructionsBannerView` are now public. ([#4595](https://github.com/mapbox/mapbox-navigation-ios/pull/4595))
* `BottomBannerViewController.dateFormatter`, `BottomBannerViewController.dateComponentsFormatter`, `BottomBannerViewController.distanceFormatter` and `InstructionsBannerView.distanceFormatter` are now public. ([#4595](https://github.com/mapbox/mapbox-navigation-ios/pull/4595))

### Other changes

Expand Down
13 changes: 9 additions & 4 deletions Sources/MapboxNavigation/BottomBannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ open class BottomBannerViewController: UIViewController, NavigationComponent {
var previousProgress: RouteProgress?
var timer: DispatchTimer?

let dateFormatter = DateFormatter()
let dateComponentsFormatter = DateComponentsFormatter()
let distanceFormatter = DistanceFormatter()

/// Arrival date formatter for banner view.
public let dateFormatter = DateFormatter()

/// Date components formatter for banner view.
public let dateComponentsFormatter = DateComponentsFormatter()

/// Distance formatter for banner view.
public let distanceFormatter = DistanceFormatter()

var verticalCompactConstraints = [NSLayoutConstraint]()
var verticalRegularConstraints = [NSLayoutConstraint]()

Expand Down
5 changes: 3 additions & 2 deletions Sources/MapboxNavigation/InstructionsBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ open class BaseInstructionsBannerView: UIControl {
var centerYConstraints = [NSLayoutConstraint]()
var baselineConstraints = [NSLayoutConstraint]()

let distanceFormatter = DistanceFormatter()

/// Distance formatter for banner view.
public let distanceFormatter = DistanceFormatter()

/**
The remaining distance of current step in meters.
*/
Expand Down
9 changes: 6 additions & 3 deletions Sources/MapboxNavigation/TopBannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ open class TopBannerViewController: UIViewController {

// MARK: Displaying Instructions

weak var delegate: TopBannerViewControllerDelegate? = nil

/// The delegate for the view controller.
/// - seealso: TopBannerViewControllerDelegate
public weak var delegate: TopBannerViewControllerDelegate? = nil

lazy var topPaddingView: TopBannerView = .forAutoLayout()

var routeProgress: RouteProgress?
Expand All @@ -25,7 +27,8 @@ open class TopBannerViewController: UIViewController {

lazy var informationStackView = UIStackView(orientation: .vertical, autoLayout: true)

lazy var instructionsBannerView: InstructionsBannerView = {
/// A banner view that contains the current step instructions and responds to tap and swipe gestures.
public private(set) lazy var instructionsBannerView: InstructionsBannerView = {
let banner: InstructionsBannerView = .forAutoLayout()
banner.heightAnchor.constraint(equalToConstant: instructionsBannerHeight).isActive = true
banner.delegate = self
Expand Down

0 comments on commit c09a4b8

Please sign in to comment.