@@ -2,13 +2,26 @@ import CoreLocation
2
2
import Foundation
3
3
import MapboxNavigationNative
4
4
5
- extension FixLocation {
6
5
6
+ extension FixLocation {
7
7
convenience init ( _ location: CLLocation , isMock: Bool = false ) {
8
8
var bearingAccuracy : NSNumber ? = nil
9
9
if #available( iOS 13 . 4 , * ) {
10
10
bearingAccuracy = location. courseAccuracy >= 0 ? location. courseAccuracy as NSNumber : nil
11
11
}
12
+
13
+ var provider : String ? = nil
14
+ #if compiler(>=5.5)
15
+ if #available( iOS 15 . 0 , * ) {
16
+ if let sourceInformation = location. sourceInformation {
17
+ // in some scenarios we store this information to history files, so to save space there, we use "short" names and 1/0 instead of true/false
18
+ let isSimulated = sourceInformation. isSimulatedBySoftware ? 1 : 0
19
+ let isProducedByAccessory = sourceInformation. isProducedByAccessory ? 1 : 0
20
+
21
+ provider = " sim: \( isSimulated) ,acc: \( isProducedByAccessory) "
22
+ }
23
+ }
24
+ #endif
12
25
13
26
self . init ( coordinate: location. coordinate,
14
27
monotonicTimestampNanoseconds: Int64 ( location. timestamp. nanosecondsSince1970) ,
@@ -17,7 +30,7 @@ extension FixLocation {
17
30
bearing: location. course >= 0 ? location. course as NSNumber : nil ,
18
31
altitude: location. altitude as NSNumber ,
19
32
accuracyHorizontal: location. horizontalAccuracy >= 0 ? location. horizontalAccuracy as NSNumber : nil ,
20
- provider: nil ,
33
+ provider: provider ,
21
34
bearingAccuracy: bearingAccuracy,
22
35
speedAccuracy: location. speedAccuracy >= 0 ? location. speedAccuracy as NSNumber : nil ,
23
36
verticalAccuracy: location. verticalAccuracy >= 0 ? location. verticalAccuracy as NSNumber : nil ,
0 commit comments