-
Notifications
You must be signed in to change notification settings - Fork 319
/
Copy pathCoreConstants.swift
550 lines (414 loc) · 29.2 KB
/
CoreConstants.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
import Foundation
import CoreLocation
import MapboxDirections
// MARK: RouteController Rerouting logic
/**
Maximum number of meters the user can travel away from step before `RouteControllerShouldReroute` is emitted.
*/
public var RouteControllerMaximumDistanceBeforeRecalculating: CLLocationDistance = 50
/**
When calculating whether or not the user is on the route, we look where the user will be given their speed and this variable.
*/
public var RouteControllerDeadReckoningTimeInterval: TimeInterval = 1.0
/**
The minimum distance in the opposite direction of travel that triggers rerouting.
*/
public var RouteControllerMinimumBacktrackingDistanceForRerouting: CLLocationDistance = 50
/**
Minimum number of consecutive location updates moving backwards before the user is rerouted.
*/
public var RouteControllerMinimumNumberLocationUpdatesBackwards = 3
/**
Number of seconds reroute feedback sections are shown in the feedback view after the user is rerouted.
*/
public var RouteControllerNumberOfSecondsForRerouteFeedback: TimeInterval = 10
/**
Minimum duration remaining in seconds for proactive rerouting to be active.
*/
public var RouteControllerMinimumDurationRemainingForProactiveRerouting: TimeInterval = 600
/**
The number of seconds between attempts to automatically calculate a more optimal route while traveling.
In addition to calculating a more optimal route, `RouteController` also refreshes time-dependent statistics about the route, such as traffic congestion and the remaining duration, as long as `DirectionsOptions.profileIdentifier` is set to `DirectionsProfileIdentifier.automobileAvoidingTraffic` and `RouteOptions.refreshingEnabled` is set to `true`.
*/
public var RouteControllerProactiveReroutingInterval: TimeInterval = 120
/**
Minimum number of consecutive incorrect course updates before rerouting occurs.
*/
public var RouteControllerMinNumberOfInCorrectCourses: Int = 4
/**
Given a location update, the `horizontalAccuracy` is used to figure out how many consective location updates to wait before rerouting due to consecutive incorrect course updates.
*/
public var RouteControllerIncorrectCourseMultiplier: Int = 4
let FasterRouteFoundEvent = "navigation.fasterRoute"
// MARK: Tracking RouteController Step Progress
/**
Threshold user must be in within to count as completing a step. One of two heuristics used to know when a user completes a step, see `RouteControllerManeuverZoneRadius`.
The users `heading` and the `finalHeading` are compared. If this number is within `RouteControllerMaximumAllowedDegreeOffsetForTurnCompletion`, the user has completed the step.
*/
public var RouteControllerMaximumAllowedDegreeOffsetForTurnCompletion: Double = 30
/**
Radius in meters the user must enter to count as completing a step. One of two heuristics used to know when a user completes a step, see `RouteControllerMaximumAllowedDegreeOffsetForTurnCompletion`.
*/
public var RouteControllerManeuverZoneRadius: CLLocationDistance = 40
// MARK: RouteController Notifications Alerting
/**
Number of seconds left on step when a `AlertLevel.medium` alert is emitted.
*/
public var RouteControllerMediumAlertInterval: TimeInterval = 70
/**
Number of seconds left on step when a `AlertLevel.high` alert is emitted.
*/
public var RouteControllerHighAlertInterval: TimeInterval = 15
/**
For shorter upcoming steps, we link the `AlertLevel.high` instruction. If the upcoming step duration is near the duration of `RouteControllerHighAlertInterval`, we need to apply a bit of a buffer to prevent back to back notifications.
A multiplier of `1.2` gives us a buffer of 3 seconds, enough time insert a new instruction.
*/
public let RouteControllerLinkedInstructionBufferMultiplier: Double = 1.2
/**
The minimum distance threshold used for giving a "Continue" type instructions.
*/
public var RouteControllerMinimumDistanceForContinueInstruction: CLLocationDistance = 2_000
// MARK: Configuring Route Snapping (CLLocation) for RouteController
/**
The minimum speed value before the user's actual location can be considered over the snapped location.
*/
public var RouteSnappingMinimumSpeed: CLLocationSpeed = 3
/**
Accepted deviation excluding horizontal accuracy before the user is considered to be off route.
*/
public var RouteControllerUserLocationSnappingDistance: CLLocationDistance = 15
/**
Maximum angle the user puck will be rotated when snapping the user's course to the route line.
*/
public var RouteSnappingMaxManipulatedCourseAngle: CLLocationDirection = 45
/**
Minimum Accuracy (maximum deviation, in meters) that the route snapping engine will accept before it stops snapping.
*/
public var RouteSnappingMinimumHorizontalAccuracy: CLLocationAccuracy = 20.0
/**
When calculating the user's snapped location, this constant will be used for deciding upon which step coordinates to include in the calculation.
*/
public var RouteControllerMaximumSpeedForUsingCurrentStep: CLLocationSpeed = 1
//MARK: - Congestion Level Default Ranges
/**
Default range that matches `NumericCongestionLevel` values into `CongestionLevel.low` bucket.
*/
public let CongestionRangeLow: CongestionRange = 0..<40
/**
Default range that matches `NumericCongestionLevel` values into `CongestionLevel.moderate` bucket.
*/
public let CongestionRangeModerate: CongestionRange = 40..<60
/**
Default range that matches `NumericCongestionLevel` values into `CongestionLevel.heavy` bucket.
*/
public let CongestionRangeHeavy: CongestionRange = 60..<80
/**
Default range that matches `NumericCongestionLevel` values into `CongestionLevel.severe` bucket.
*/
public let CongestionRangeSevere: CongestionRange = 80..<101
public extension Notification.Name {
// MARK: PassiveLocationManager Events
/**
Posted when `PassiveLocationManager` receives a user location update representing movement along the expected route.
The user info dictionary contains the keys `PassiveLocationManager.NotificationUserInfoKey.locationKey`, `PassiveLocationManager.NotificationUserInfoKey.rawLocationKey`, `PassiveLocationManager.NotificationUserInfoKey.matchesKey`, `PassiveLocationManager.NotificationUserInfoKey.roadNameKey`, `PassiveLocationManager.NotificationUserInfoKey.mapMatchingResultKey` and `PassiveLocationManager.NotificationUserInfoKey.routeShieldRepresentationKey`.
- seealso: `routeControllerProgressDidUpdate`
*/
static let passiveLocationManagerDidUpdate: Notification.Name = .init(rawValue: "PassiveLocationManagerDidUpdate")
// MARK: RouteController Events
/**
Posted when `RouteController` receives a user location update representing movement along the expected route.
The user info dictionary contains the keys `RouteController.NotificationUserInfoKey.routeProgressKey`, `RouteController.NotificationUserInfoKey.locationKey`, `RouteController.NotificationUserInfoKey.rawLocationKey`, `RouteController.NotificationUserInfoKey.headingKey` and `RouteController.NotificationUserInfoKey.mapMatchingResultKey`.
- note: Notification emitted by `LegacyRouteController` will not contain `RouteController.NotificationUserInfoKey.headingKey` and `RouteController.NotificationUserInfoKey.mapMatchingResultKey`.
- seealso: `passiveLocationManagerDidUpdate`
*/
static let routeControllerProgressDidChange: Notification.Name = .init(rawValue: "RouteControllerProgressDidChange")
/**
Posted when `RouteController` receives updated information about the current route.
The user info dictionary contains the key `RouteController.NotificationUserInfoKey.routeProgressKey`.
*/
static let routeControllerDidRefreshRoute: Notification.Name = .init(rawValue: "RouteControllerDidRefreshRoute")
/**
Posted after the user diverges from the expected route, just before `RouteController` attempts to calculate a new route.
The user info dictionary contains the keys `RouteController.NotificationUserInfoKey.locationKey` and `RouteController.NotificationUserInfoKey.headingKey`.
*/
static let routeControllerWillReroute: Notification.Name = .init(rawValue: "RouteControllerWillReroute")
/**
Posted when `RouteController` obtains a new route in response to the user diverging from a previous route.
The user info dictionary contains the keys `RouteController.NotificationUserInfoKey.locationKey`, `RouteController.NotificationUserInfoKey.isProactiveKey`, and `RouteController.NotificationUserInfoKey.headingKey`.
*/
static let routeControllerDidReroute: Notification.Name = .init(rawValue: "RouteControllerDidReroute")
/**
Posted when `RouteController` fails to reroute the user after the user diverges from the expected route.
The user info dictionary contains the key `RouteController.NotificationUserInfoKey.routingErrorKey`.
*/
static let routeControllerDidFailToReroute: Notification.Name = .init(rawValue: "RouteControllerDidFailToReroute")
/**
Posted when `RouteController` detects that the user has passed an ideal point for saying an instruction aloud.
The user info dictionary contains the keys `RouteController.NotificationUserInfoKey.routeProgressKey` and `RouteController.NotificationUserInfoKey.spokenInstructionKey`.
*/
static let routeControllerDidPassSpokenInstructionPoint: Notification.Name = .init(rawValue: "RouteControllerDidPassSpokenInstructionPoint")
/**
Posted when `RouteController` detects that the user has passed an ideal point for display an instruction visually.
The user info dictionary contains the keys `RouteController.NotificationUserInfoKey.routeProgressKey` and `RouteController.NotificationUserInfoKey.visualInstructionKey`.
*/
static let routeControllerDidPassVisualInstructionPoint: Notification.Name = .init(rawValue: "RouteControllerDidPassVisualInstructionPoint")
/**
Posted when `RouteController` detects the road name.
The user info dictionary contains the key `RouteController.NotificationUserInfoKey.roadNameKey` and `RouteController.NotificationUserInfoKey.routeShieldRepresentationKey`.
*/
static let currentRoadNameDidChange: Notification.Name = .init(rawValue: "CurrentRoadNameDidChange")
/**
Posted when `RouteController` detects the arrival at waypoint.
The user info dictionary contains the key `RouteController.NotificationUserInfoKey.waypointKey`.
*/
static let didArriveAtWaypoint: Notification.Name = .init(rawValue: "DidArriveAtWaypoint")
// MARK: Settings and Permissions Updates
/**
Posted when something changes in the shared `NavigationSettings` object.
The user info dictionary indicates which keys and values changed.
*/
static let navigationSettingsDidChange: Notification.Name = .init(rawValue: "NavigationSettingsDidChange")
/**
Posted when user changes location authorization settings.
The user info dictionary contains the key `MapboxNavigationService.NotificationUserInfoKey.locationAuthorizationKey`.
*/
static let locationAuthorizationDidChange: Notification.Name = .init(rawValue: "LocationAuthorizationDidChange")
/**
Posted when `NavigationService` update the simulating status.
The user info dictionary contains the key `MapboxNavigationService.NotificationUserInfoKey.simulationStateKey` and `MapboxNavigationService.NotificationUserInfoKey.simulatedSpeedMultiplierKey`.
*/
static let navigationServiceSimulationDidChange: Notification.Name = .init(rawValue: "NavigationServiceSimulationDidChange")
}
extension RouteController {
/**
Keys in the user info dictionaries of various notifications posted by instances of `RouteController`.
*/
public struct NotificationUserInfoKey: Hashable, Equatable, RawRepresentable {
public typealias RawValue = String
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
// MARK: Route Traversal and Positioning Data
/**
A key in the user info dictionary of a `Notification.Name.routeControllerProgressDidChange`, `Notification.Name.routeControllerDidPassVisualInstructionPoint`, or `Notification.Name.routeControllerDidPassSpokenInstructionPoint` notification. The corresponding value is a `RouteProgress` object representing the current route progress.
*/
public static let routeProgressKey: NotificationUserInfoKey = .init(rawValue: "progress")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerProgressDidChange`, `Notification.Name.routeControllerWillReroute`, or `Notification.Name.routeControllerDidReroute` notification. The corresponding value is a `CLLocation` object representing the current idealized user location.
*/
public static let locationKey: NotificationUserInfoKey = .init(rawValue: "location")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerProgressDidChange` notification. The corresponding value is a `CLLocation` object representing the current raw user location.
*/
public static let rawLocationKey: NotificationUserInfoKey = .init(rawValue: "rawLocation")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerProgressDidChange` notification. The corresponding value is a `CLHeading` object representing the current user heading.
*/
public static let headingKey: NotificationUserInfoKey = .init(rawValue: "heading")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerProgressDidChange` notification. The corresponding value is a `MapMatchingResult` object representing the map matching state.
*/
public static let mapMatchingResultKey: NotificationUserInfoKey = .init(rawValue: "mapMatchingResult")
/**
A key in the user info dictionary of a `Notification.Name.currentRoadNameDidChange` notification. The corresponding value is a `NSString` object representing the current road name.
*/
public static let roadNameKey: NotificationUserInfoKey = .init(rawValue: "roadName")
/**
A key in the user info dictionary of a `Notification.Name.currentRoadNameDidChange` notification. The corresponding value is a `MapboxDirections.VisualInstruction.Component.ImageRepresentation` object representing the road shield the user is currently traveling on.
*/
public static let routeShieldRepresentationKey: NotificationUserInfoKey = .init(rawValue: "routeShieldRepresentation")
/**
A key in the user info dictionary of a `Notification.Name.didArriveAtWaypoint` notification. The corresponding value is a `MapboxDirections.Waypoint` object representing the current destination waypoint.
*/
public static let waypointKey: NotificationUserInfoKey = .init(rawValue: "waypoint")
// MARK: Monitoring Rerouting
/**
A key in the user info dictionary of a `Notification.Name.routeControllerDidReroute` notification. The corresponding value is an `NSNumber` instance containing a Boolean value indicating whether `RouteController` proactively rerouted the user onto a faster route.
*/
public static let isProactiveKey: NotificationUserInfoKey = .init(rawValue: "RouteControllerDidFindFasterRoute")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerDidFailToReroute` notification. The corresponding value is an `NSError` object indicating why `RouteController` was unable to calculate a new route.
*/
public static let routingErrorKey: NotificationUserInfoKey = .init(rawValue: "error")
// MARK: Monitoring Instructions
/**
A key in the user info dictionary of an `Notification.Name.routeControllerDidPassVisualInstructionPoint`. The corresponding value is an `VisualInstruction` object representing the current visual instruction.
*/
public static let visualInstructionKey: NotificationUserInfoKey = .init(rawValue: "visualInstruction")
/**
A key in the user info dictionary of a `Notification.Name.routeControllerDidPassSpokenInstructionPoint` notification. The corresponding value is an `SpokenInstruction` object representing the current visual instruction.
*/
public static let spokenInstructionKey: NotificationUserInfoKey = .init(rawValue: "spokenInstruction")
}
}
extension PassiveLocationManager {
/**
Keys in the user info dictionaries of various notifications posted by instances of `PassiveLocationManager`.
*/
public struct NotificationUserInfoKey: Hashable, Equatable, RawRepresentable {
public typealias RawValue = String
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
// MARK: Positioning Data
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `CLLocation` object representing the current idealized user location.
*/
public static let locationKey: NotificationUserInfoKey = .init(rawValue: "location")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `CLLocation` object representing the current raw user location.
*/
public static let rawLocationKey: NotificationUserInfoKey = .init(rawValue: "rawLocation")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is an array of `Match` objects representing possible matches against the road network.
*/
public static let matchesKey: NotificationUserInfoKey = .init(rawValue: "matches")
// MARK: Road Data
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a string representing the name of the road the user is currently traveling on.
- seealso: `WayNameView`
*/
public static let roadNameKey: NotificationUserInfoKey = .init(rawValue: "roadName")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `MapboxDirections.VisualInstruction.Component.ImageRepresentation` object representing the road shield the user is currently traveling on.
*/
public static let routeShieldRepresentationKey: NotificationUserInfoKey = .init(rawValue: "routeShieldRepresentation")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `Measurement<UnitSpeed>` representing the maximum speed limit of the current road.
*/
public static let speedLimitKey: NotificationUserInfoKey = .init(rawValue: "speedLimit")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `SignStandard` representing the sign standard used for speed limit signs along the current road.
*/
public static let signStandardKey: NotificationUserInfoKey = .init(rawValue: "signStandard")
/**
A key in the user info dictionary of a `Notification.Name.passiveLocationManagerDidUpdate` notification. The corresponding value is a `MapMatchingResult` object representing the map matching state.
*/
public static let mapMatchingResultKey: NotificationUserInfoKey = .init(rawValue: "mapMatchingResult")
}
}
extension MapboxNavigationService {
/**
Keys in the user info dictionaries of various notifications posted by instances of `NavigationService`.
*/
public struct NotificationUserInfoKey: Hashable, Equatable, RawRepresentable {
public typealias RawValue = String
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
/**
A key in the user info dictionary of a `Notification.Name.locationAuthorizationDidChange` notification. The corresponding value is a `CLAccuracyAuthorization` indicating the current location authorization setting. */
public static let locationAuthorizationKey: NotificationUserInfoKey = .init(rawValue: "locationAuthorization")
/**
A key in the user info dictionary of a `Notification.Name.navigationServiceSimulationDidChange` notification. The corresponding value is a `SimulationState` indicating the current simulation status. */
public static let simulationStateKey: NotificationUserInfoKey = .init(rawValue: "simulationState")
/**
A key in the user info dictionary of a `Notification.Name.navigationServiceSimulatingDidChange` notification. The corresponding value is a `Double` indicating the current simulated speed multiplier. */
public static let simulatedSpeedMultiplierKey: NotificationUserInfoKey = .init(rawValue: "simulatedSpeedMultiplier")
}
}
public extension Notification.Name {
// MARK: Electronic Horizon Notifications
/**
Posted when the user’s position in the electronic horizon changes. This notification may be posted multiple times after `electronicHorizonDidEnterRoadObject` until the user transitions to a new electronic horizon.
The user info dictionary contains the keys `RoadGraph.NotificationUserInfoKey.positionKey`, `RoadGraph.NotificationUserInfoKey.treeKey`, `RoadGraph.NotificationUserInfoKey.updatesMostProbablePathKey`, and `RoadGraph.NotificationUserInfoKey.distancesByRoadObjectKey`.
*/
static let electronicHorizonDidUpdatePosition: Notification.Name = .init(rawValue: "ElectronicHorizonDidUpdatePosition")
/**
Posted when the user enters a linear road object.
The user info dictionary contains the keys `RoadGraph.NotificationUserInfoKey.roadObjectIdentifierKey` and `RoadGraph.NotificationUserInfoKey.didTransitionAtEndpointKey`.
*/
static let electronicHorizonDidEnterRoadObject: Notification.Name = .init(rawValue: "ElectronicHorizonDidEnterRoadObject")
/**
Posted when the user exits a linear road object.
The user info dictionary contains the keys `RoadGraph.NotificationUserInfoKey.roadObjectIdentifierKey` and `RoadGraph.NotificationUserInfoKey.transitionKey`.
*/
static let electronicHorizonDidExitRoadObject: Notification.Name = .init(rawValue: "ElectronicHorizonDidExitRoadObject")
/**
Posted when user has passed point-like object.
The user info dictionary contains the key `ElectronicHorizon.NotificationUserInfoKey.roadObjectIdentifierKey`.
*/
static let electronicHorizonDidPassRoadObject: Notification.Name = .init(rawValue: "ElectronicHorizonDidPassRoadObject")
}
extension RoadGraph {
/**
Keys in the user info dictionaries of various notifications posted by instances of `RouteController` or `PassiveLocationManager` about `RoadGraph`s.
*/
public struct NotificationUserInfoKey: Hashable, Equatable, RawRepresentable {
public typealias RawValue = String
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidUpdatePosition` notification. The corresponding value is a `RoadGraph.Position` indicating the current position in the road graph. */
public static let positionKey: NotificationUserInfoKey = .init(rawValue: "position")
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidUpdatePosition` notification. The corresponding value is an `RoadGraph.Edge` at the root of a tree of edges in the routing graph. This graph represents a probable path (or paths) of a vehicle within the routing graph for a certain distance in front of the vehicle, thus extending the user’s perspective beyond the “visible” horizon as the vehicle’s position and trajectory change.
*/
public static let treeKey: NotificationUserInfoKey = .init(rawValue: "tree")
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidUpdatePosition` notification. The corresponding value is a Boolean value of `true` if the position update indicates a new most probable path (MPP) or `false` if it updates an existing MPP that the user has continued to follow.
An electronic horizon can represent a new MPP in three scenarios:
- An electronic horizon is detected for the very first time.
- A user location tracking error leads to an MPP completely distinct from the previous MPP.
- The user has departed from the previous MPP, for example by driving to a side path of the previous MPP.
*/
public static let updatesMostProbablePathKey: NotificationUserInfoKey = .init(rawValue: "updatesMostProbablePath")
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidUpdatePosition` notification. The corresponding value is an array of upcoming road object distances from the user’s current location as `DistancedRoadObject` values. */
public static let distancesByRoadObjectKey: NotificationUserInfoKey = .init(rawValue: "distancesByRoadObject")
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidEnterRoadObject` or `Notification.Name.electronicHorizonDidExitRoadObject` notification. The corresponding value is a `RoadObject.Identifier` identifying the road object that the user entered or exited. */
public static let roadObjectIdentifierKey: NotificationUserInfoKey = .init(rawValue: "roadObjectIdentifier")
public static let roadGraphIdentifierKey: NotificationUserInfoKey = .init(rawValue: "roadGraph")
/**
A key in the user info dictionary of a `Notification.Name.electronicHorizonDidEnterRoadObject` or `Notification.Name.electronicHorizonDidExitRoadObject` notification. The corresponding value is an `NSNumber` containing a Boolean value set to `true` if the user entered at the beginning or exited at the end of the road object, or `false` if they entered or exited somewhere along the road object. */
public static let didTransitionAtEndpointKey: NotificationUserInfoKey = .init(rawValue: "didTransitionAtEndpoint")
}
}
public extension Notification.Name {
// MARK: Switching Navigation Tile Versions
/**
:nodoc:
Posted when Navigator has not enough tiles for map matching on current tiles version, but there are suitable older versions inside underlying Offline Regions. Navigator has restarted when this notification is issued.
Such action invalidates all existing matched `RoadObject`s which should be re-applied manually.
The user info dictionary contains the key `Navigator.NotificationUserInfoKey.tilesVersionKey`
*/
static let navigationDidSwitchToFallbackVersion: Notification.Name = .init(rawValue: "NavigatorDidFallbackToOfflineVersion")
/**
:nodoc:
Posted when Navigator was switched to a fallback offline tiles version, but latest tiles became available again. Navigator has restarted when this notification is issued.
Such action invalidates all existing matched `RoadObject`s which should be re-applied manually.
The user info dictionary contains the key `Navigator.NotificationUserInfoKey.tilesVersionKey`
*/
static let navigationDidSwitchToTargetVersion: Notification.Name = .init(rawValue: "NavigatorDidRestoreToOnlineVersion")
/**
Posted when NavNative sends updated navigation status.
The user info dictionary contains the keys `Navigator.NotificationUserInfoKey.originKey` and `Navigator.NotificationUserInfoKey.statusKey`.
*/
internal static let navigationStatusDidChange: Notification.Name = .init(rawValue: "NavigationStatusDidChange")
}
extension Navigator {
/**
Keys in the user info dictionaries of various notifications posted by instances of `Navigator`.
*/
public struct NotificationUserInfoKey: Hashable, Equatable, RawRepresentable {
public typealias RawValue = String
public var rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}
/**
:nodoc:
A key in the user info dictionary of a `Notification.Name.navigationDidSwitchToFallbackVersion` or `Notification.Name.navigationDidSwitchToTargetVersion` notification. The corresponding value is a string representation of selected tiles version.
For internal use only.
*/
public static let tilesVersionKey: NotificationUserInfoKey = .init(rawValue: "tilesVersion")
static let originKey: NotificationUserInfoKey = .init(rawValue: "origin")
static let statusKey: NotificationUserInfoKey = .init(rawValue: "status")
}
}