Skip to content

Commit

Permalink
chore: os version in useragent for foundation based OS (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
wooj2 authored Jan 6, 2022
1 parent 6d07a94 commit d23a558
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

#if os(iOS) || os (watchOS) || os(macOS) || os(tvOS)
import Foundation.NSProcessInfo

public struct PlatformOperationSystemVersion {
static public func operatingSystemVersion() -> String? {
let osVersion = ProcessInfo.processInfo.operatingSystemVersion
return "\(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion)"
}
}
#else
// TODO: Implement for Linux & Windows
public struct PlatformOperationSystemVersion {
static public func operatingSystemVersion() -> String? {
return nil
}
}
#endif

0 comments on commit d23a558

Please sign in to comment.