Skip to content

Commit

Permalink
Make the type declaration, initializer, toDictionary and all properti…
Browse files Browse the repository at this point in the history
…es of DefaultSignalPayload public. Add doc comment on the type.
  • Loading branch information
nevillco committed Oct 26, 2023
1 parent 98500be commit c4f9a2e
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions Sources/TelemetryClient/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,29 @@ internal struct SignalPostBody: Codable, Equatable {
let isTestMode: String
}

internal struct DefaultSignalPayload: Encodable {
let platform = Self.platform
let systemVersion = Self.systemVersion
let majorSystemVersion = Self.majorSystemVersion
let majorMinorSystemVersion = Self.majorMinorSystemVersion
let appVersion = Self.appVersion
let buildNumber = Self.buildNumber
let isSimulator = "\(Self.isSimulator)"
let isDebug = "\(Self.isDebug)"
let isTestFlight = "\(Self.isTestFlight)"
let isAppStore = "\(Self.isAppStore)"
let modelName = Self.modelName
let architecture = Self.architecture
let operatingSystem = Self.operatingSystem
let targetEnvironment = Self.targetEnvironment
let locale = Self.locale
var extensionIdentifier: String? = Self.extensionIdentifier
let telemetryClientVersion = TelemetryClientVersion

func toDictionary() -> [String: String] {
/// The default payload that is included in payloads processed by TelemetryDeck.
public struct DefaultSignalPayload: Encodable {
public let platform = Self.platform
public let systemVersion = Self.systemVersion
public let majorSystemVersion = Self.majorSystemVersion
public let majorMinorSystemVersion = Self.majorMinorSystemVersion
public let appVersion = Self.appVersion
public let buildNumber = Self.buildNumber
public let isSimulator = "\(Self.isSimulator)"
public let isDebug = "\(Self.isDebug)"
public let isTestFlight = "\(Self.isTestFlight)"
public let isAppStore = "\(Self.isAppStore)"
public let modelName = Self.modelName
public let architecture = Self.architecture
public let operatingSystem = Self.operatingSystem
public let targetEnvironment = Self.targetEnvironment
public let locale = Self.locale
public let extensionIdentifier: String? = Self.extensionIdentifier
public let telemetryClientVersion = TelemetryClientVersion

public init() { }

public func toDictionary() -> [String: String] {
do {
let encoder = JSONEncoder()
let data = try encoder.encode(self)
Expand Down

0 comments on commit c4f9a2e

Please sign in to comment.