File tree 2 files changed +5
-7
lines changed
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import Foundation
3
3
public struct TelemetryEnricher {
4
4
private let deviceID : String
5
5
private let version : String ?
6
-
6
+
7
7
public init ( ) {
8
8
version = Bundle . main. infoDictionary ? [ " CFBundleShortVersionString " ] as? String
9
-
9
+
10
10
let userDefaults = UserDefaults . standard
11
11
let key = " deviceID "
12
-
12
+
13
13
if let existingID = userDefaults. string ( forKey: key) {
14
14
deviceID = existingID
15
15
} else {
@@ -18,7 +18,7 @@ public struct TelemetryEnricher {
18
18
deviceID = newID
19
19
}
20
20
}
21
-
21
+
22
22
public func enrich( _ original: Vpn_StartRequest ) -> Vpn_StartRequest {
23
23
var req = original
24
24
req. deviceOs = " macOS "
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import Testing
3
3
4
4
@Suite ( . timeLimit( . minutes( 1 ) ) )
5
5
struct TelemetryEnricherTests {
6
-
7
6
@Test func testEnrichStartRequest( ) throws {
8
7
let enricher0 = TelemetryEnricher ( )
9
8
let original = Vpn_StartRequest . with { req in
@@ -14,7 +13,7 @@ struct TelemetryEnricherTests {
14
13
#expect( enriched. coderURL == " https://example.com " )
15
14
#expect( enriched. tunnelFileDescriptor == 123 )
16
15
#expect( enriched. deviceOs == " macOS " )
17
- #expect( enriched. coderDesktopVersion. contains ( try Regex ( #"^\d+\.\d+\.\d+$"# ) ) )
16
+ #expect( try enriched. coderDesktopVersion. contains ( Regex ( #"^\d+\.\d+\.\d+$"# ) ) )
18
17
let deviceID = enriched. deviceID
19
18
#expect( !deviceID. isEmpty)
20
19
@@ -23,5 +22,4 @@ struct TelemetryEnricherTests {
23
22
enriched = enricher1. enrich ( original)
24
23
#expect( enriched. deviceID == deviceID)
25
24
}
26
-
27
25
}
You can’t perform that action at this time.
0 commit comments