File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ import CommonCrypto
12
12
import UIKit
13
13
#endif
14
14
15
+ #if os(watchOS)
16
+ import WatchKit
17
+ #endif
18
+
19
+ #if os(tvOS)
20
+ import TVUIKit
21
+ #endif
22
+
15
23
public typealias TelemetrySignalType = String
16
24
public struct TelemetryManagerConfiguration {
17
25
public let telemetryAppID : String
@@ -135,7 +143,7 @@ private extension TelemetryManager {
135
143
#elseif os(iOS)
136
144
return " \( platform) \( UIDevice . current. systemVersion) "
137
145
#elseif os(watchOS)
138
- return " \( platform) \( UIDevice . current. systemVersion) "
146
+ return " \( platform) \( WKInterfaceDevice . current ( ) . systemVersion) "
139
147
#elseif os(tvOS)
140
148
return " \( platform) \( UIDevice . current. systemVersion) "
141
149
#else
@@ -159,10 +167,16 @@ private extension TelemetryManager {
159
167
/// and build number (in which case it's strongly recommended to supply an email or UUID or similar identifier for
160
168
/// your user yourself.
161
169
var defaultUserIdentifier : String {
162
- #if os(macOS)
163
- return " unknown user \( systemVersion) \( buildNumber) "
164
- #else
170
+ #if os(iOS)
165
171
return UIDevice . current. identifierForVendor? . uuidString ?? " unknown user \( systemVersion) \( buildNumber) "
172
+ #elseif os(watchOS)
173
+ if #available( watchOS 6 . 2 , * ) {
174
+ return WKInterfaceDevice . current ( ) . identifierForVendor? . uuidString ?? " unknown user \( systemVersion) \( buildNumber) "
175
+ } else {
176
+ return " unknown user \( platform) \( systemVersion) \( buildNumber) "
177
+ }
178
+ #else
179
+ return " unknown user \( platform) \( systemVersion) \( buildNumber) "
166
180
#endif
167
181
}
168
182
You can’t perform that action at this time.
0 commit comments