File tree 2 files changed +12
-8
lines changed
Sources/AWSAppSyncApolloExtensions/Utilities
Tests/AWSAppSyncApolloExtensionsTests/Utilities
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
import Foundation
10
+ import Apollo
10
11
#if canImport(WatchKit)
11
12
import WatchKit
12
13
#elseif canImport(UIKit)
@@ -31,8 +32,9 @@ class PackageInfo {
31
32
let device = UIDevice . current
32
33
return ( name: device. systemName, version: device. systemVersion)
33
34
#else
35
+ let osVersion = ProcessInfo . processInfo. operatingSystemVersion
34
36
return ( name: " macOS " ,
35
- version: ProcessInfo . processInfo . operatingSystemVersionString )
37
+ version: " \( osVersion . majorVersion ) . \( osVersion . minorVersion ) . \( osVersion . patchVersion ) " )
36
38
#endif
37
39
} ( )
38
40
@@ -53,11 +55,12 @@ class PackageInfo {
53
55
static var userAgent : String {
54
56
get async {
55
57
let ( name, version) = await Self . os
56
- let compilerInfo = " lang/swift/ \( swiftVersion) "
57
- let osInfo = " os/ \( name) / \( version) "
58
- let libInfo = " lib/aws-appsync-apollo-extensions-swift/ \( Self . version) "
58
+ let compilerInfo = " lang/swift# \( swiftVersion) "
59
+ let osInfo = " os/ \( name) # \( version) "
60
+ let libInfo = " lib/aws-appsync-apollo-extensions-swift# \( Self . version) "
61
+ let dependenciesInfo = " md/apollo# \( Constants . ApolloVersion) "
59
62
60
- return " UA/2.0 \( compilerInfo) \( osInfo) \( libInfo) "
63
+ return " UA/2.0 \( compilerInfo) \( osInfo) \( libInfo) \( dependenciesInfo ) "
61
64
}
62
65
}
63
66
Original file line number Diff line number Diff line change @@ -17,9 +17,10 @@ class PackageInfoTests: XCTestCase {
17
17
func testUserAgentHasCorrectFormat( ) async throws {
18
18
let format = try Regex (
19
19
" ^UA/2 \\ .0 " +
20
- " lang/swift/ \\ d+ \\ . \\ d+(?: \\ . \\ d+)? " +
21
- " os/iOS|macOS|watchOS/ \\ d+ \\ . \\ d+(?: \\ . \\ d+)? " +
22
- " lib/aws-appsync-apollo-extensions-swift/ \\ d+ \\ . \\ d+ \\ . \\ d+$ "
20
+ " lang/swift# \\ d+ \\ . \\ d+(?: \\ . \\ d+)? " +
21
+ " os/(?:iOS|macOS|watchOS)# \\ d+ \\ . \\ d+(?: \\ . \\ d+)? " +
22
+ " lib/aws-appsync-apollo-extensions-swift# \\ d+ \\ . \\ d+ \\ . \\ d+ " +
23
+ " md/apollo# \\ d+ \\ . \\ d+ \\ . \\ d+$ "
23
24
)
24
25
let userAgent = await PackageInfo . userAgent
25
26
let matches = userAgent. ranges ( of: format)
You can’t perform that action at this time.
0 commit comments