Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow visionOS to use identifierForVendor #119

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/TelemetryClient/SignalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}

/// Adds a signal to the process queue
func processSignal(_ signalType: TelemetrySignalType, for clientUser: String? = nil, floatValue: Double? = nil, with additionalPayload: [String: String] = [:], configuration: TelemetryManagerConfiguration) {

Check warning on line 71 in Sources/TelemetryClient/SignalManager.swift

View workflow job for this annotation

GitHub Actions / Lint Code

Line should be 200 characters or less; currently it has 211 characters (line_length)
DispatchQueue.global(qos: .utility).async {
let enrichedMetadata: [String: String] = configuration.metadataEnrichers
.map { $0.enrich(signalType: signalType, for: clientUser, floatValue: floatValue) }
Expand Down Expand Up @@ -179,7 +179,7 @@
urlRequest.httpMethod = "POST"
urlRequest.addValue("application/json", forHTTPHeaderField: "Content-Type")

urlRequest.httpBody = try! JSONEncoder.telemetryEncoder.encode(signalPostBodies)

Check warning on line 182 in Sources/TelemetryClient/SignalManager.swift

View workflow job for this annotation

GitHub Actions / Lint Code

Force tries should be avoided (force_try)
self.configuration.logHandler?.log(.debug, message: String(data: urlRequest.httpBody!, encoding: .utf8)!)

let task = URLSession.shared.dataTask(with: urlRequest, completionHandler: completionHandler)
Expand All @@ -203,7 +203,7 @@
var defaultUserIdentifier: String {
guard configuration.defaultUser == nil else { return configuration.defaultUser! }

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(xrOS)
return UIDevice.current.identifierForVendor?.uuidString ?? "unknown user \(DefaultSignalPayload.systemVersion) \(DefaultSignalPayload.buildNumber)"
#elseif os(watchOS)
if #available(watchOS 6.2, *) {
Expand All @@ -221,7 +221,7 @@
}
#else
#if DEBUG
configuration.logHandler?.log(message: "[Telemetry] On this platform, Telemetry can't generate a unique user identifier. It is recommended you supply one yourself. More info: https://telemetrydeck.com/pages/signal-reference.html")

Check warning on line 224 in Sources/TelemetryClient/SignalManager.swift

View workflow job for this annotation

GitHub Actions / Lint Code

Line should be 200 characters or less; currently it has 246 characters (line_length)
#endif
return "unknown user \(DefaultSignalPayload.platform) \(DefaultSignalPayload.systemVersion) \(DefaultSignalPayload.buildNumber)"
#endif
Expand Down
Loading