Skip to content

Commit 2b5c1e4

Browse files
committed
Fix issues with ExitView and GenericRouteShield styling on iOS and CarPlay.
1 parent a9d54a3 commit 2b5c1e4

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Sources/MapboxNavigation/ExitView.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,19 @@ public class ExitView: StylableView {
148148
styleID: String?,
149149
dataSource: DataSource,
150150
traitCollection: UITraitCollection) -> String {
151-
var appearance = ExitView.appearance()
151+
var appearance = ExitView.appearance(for: UITraitCollection(userInterfaceIdiom: .phone))
152152
if traitCollection.userInterfaceIdiom == .carPlay {
153+
let carPlayTraitCollection = UITraitCollection(userInterfaceIdiom: .carPlay)
154+
153155
if #available(iOS 12.0, *) {
154-
let carPlayTraitCollection = UITraitCollection(traitsFrom: [
155-
UITraitCollection(userInterfaceIdiom: .carPlay),
156+
let traitCollection = UITraitCollection(traitsFrom: [
157+
carPlayTraitCollection,
156158
UITraitCollection(userInterfaceStyle: traitCollection.userInterfaceStyle)
157159
])
158160

159-
appearance = ExitView.appearance(for: carPlayTraitCollection)
161+
appearance = ExitView.appearance(for: traitCollection)
160162
} else {
161-
appearance = ExitView.appearance(for: UITraitCollection(userInterfaceIdiom: .carPlay))
163+
appearance = ExitView.appearance(for: carPlayTraitCollection)
162164
}
163165
}
164166

Sources/MapboxNavigation/GenericRouteShield.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class GenericRouteShield: StylableView {
9595
This generates the cache key needed to hold the `GenericRouteShield`'s `imageRepresentation` in the `ImageCache` caching engine.
9696
*/
9797
static func criticalHash(styleID: String?, dataSource: DataSource, traitCollection: UITraitCollection) -> String {
98-
var appearance = GenericRouteShield.appearance()
98+
var appearance = GenericRouteShield.appearance(for: UITraitCollection(userInterfaceIdiom: .phone))
9999
if traitCollection.userInterfaceIdiom == .carPlay {
100100
if #available(iOS 12.0, *) {
101101
let carPlayTraitCollection = UITraitCollection(traitsFrom: [

Sources/MapboxNavigation/InstructionPresenter.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ class InstructionPresenter {
243243
let genericRouteShield = GenericRouteShield(pointSize: dataSource.font.pointSize,
244244
text: text)
245245

246-
var appearance = GenericRouteShield.appearance()
246+
var appearance = GenericRouteShield.appearance(for: UITraitCollection(userInterfaceIdiom: .phone))
247247
if traitCollection.userInterfaceIdiom == .carPlay {
248248
let carPlayTraitCollection = UITraitCollection(userInterfaceIdiom: .carPlay)
249249

250250
if #available(iOS 12.0, *) {
251251
let traitCollection = UITraitCollection(traitsFrom: [
252252
carPlayTraitCollection,
253-
UITraitCollection(userInterfaceStyle: self.traitCollection.userInterfaceStyle)
253+
UITraitCollection(userInterfaceStyle: traitCollection.userInterfaceStyle)
254254
])
255255

256256
appearance = GenericRouteShield.appearance(for: traitCollection)
@@ -292,14 +292,14 @@ class InstructionPresenter {
292292
side: side,
293293
text: text)
294294

295-
var appearance = ExitView.appearance()
295+
var appearance = ExitView.appearance(for: UITraitCollection(userInterfaceIdiom: .phone))
296296
if traitCollection.userInterfaceIdiom == .carPlay {
297297
let carPlayTraitCollection = UITraitCollection(userInterfaceIdiom: .carPlay)
298298

299299
if #available(iOS 12.0, *) {
300300
let traitCollection = UITraitCollection(traitsFrom: [
301301
carPlayTraitCollection,
302-
UITraitCollection(userInterfaceStyle: self.traitCollection.userInterfaceStyle)
302+
UITraitCollection(userInterfaceStyle: traitCollection.userInterfaceStyle)
303303
])
304304

305305
appearance = ExitView.appearance(for: traitCollection)

0 commit comments

Comments
 (0)