Skip to content

Commit

Permalink
Merge pull request #40 from ddaddy/main
Browse files Browse the repository at this point in the history
Reverted watchOS back to 4.0
  • Loading branch information
winsmith authored Sep 7, 2021
2 parents 3a2ba59 + 542dafb commit 8e81c19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
platforms: [
.macOS(.v10_13),
.iOS(.v12),
.watchOS(.v7),
.watchOS(.v4),
.tvOS(.v11)
],
products: [
Expand Down
2 changes: 1 addition & 1 deletion Sources/TelemetryClient/Signal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ extension SignalPayload {

/// The modelname as reported by systemInfo.machine
static var modelName: String {
if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
if #available(iOS 14.0, watchOS 7.0, *), ProcessInfo.processInfo.isiOSAppOnMac {
var size = 0
sysctlbyname("hw.model", nil, &size, nil, 0)
var machine = [CChar](repeating: 0, count: size)
Expand Down
4 changes: 4 additions & 0 deletions Sources/TelemetryClient/TelemetryClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ public final class TelemetryManagerConfiguration {
#if os(iOS)
NotificationCenter.default.addObserver(self, selector: #selector(didEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
#elseif os(watchOS)
if #available(watchOS 7.0, *) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
NotificationCenter.default.addObserver(self, selector: #selector(self.didEnterForeground), name: WKExtension.applicationWillEnterForegroundNotification, object: nil)
}
} else {
// Pre watchOS 7.0, this library will not use multiple sessions after backgrounding since there are no notifications we can observe.
}
#elseif os(tvOS)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
NotificationCenter.default.addObserver(self, selector: #selector(self.didEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
Expand Down

0 comments on commit 8e81c19

Please sign in to comment.