Skip to content

Commit

Permalink
Navigation UI respects text size preference
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jun 24, 2024
1 parent 0cdc49d commit c26d727
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions MapboxNavigation/StyleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ open class StyleManager: NSObject {
/// Useful for testing
var stubbedDate: Date?

var currentStyle: Style?
var currentStyleAndSize: (Style, UIContentSizeCategory)?

/// The style used from sunrise to sunset.
///
Expand Down Expand Up @@ -119,7 +119,6 @@ open class StyleManager: NSObject {
perform(#selector(self.timeOfDayChanged), with: nil, afterDelay: interval + 1)
}

// FIXME: This won't have an effect since style changes are only applied if `styleType` changes.
@objc func preferredContentSizeChanged(_ notification: Notification) {
self.ensureAppropriateStyle()
}
Expand Down Expand Up @@ -159,10 +158,12 @@ open class StyleManager: NSObject {
}

func ensureStyle(style: Style) {
guard self.currentStyle != style else {
let preferredContentSizeCategory = UIApplication.shared.preferredContentSizeCategory

if let currentStyleAndSize, currentStyleAndSize == (style, preferredContentSizeCategory) {
return
}
self.currentStyle = style
self.currentStyleAndSize = (style, preferredContentSizeCategory)
style.apply()
self.delegate?.styleManager?(self, didApply: style)
self.refreshAppearance()
Expand Down

0 comments on commit c26d727

Please sign in to comment.