Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set locale for top and bottom banner views #4595

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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