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

fix: sets OS versions for os_log #99

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extension RealtimeConnectionProvider: AppSyncWebsocketDelegate {
}

// If limit exceeded is for a particular subscription identifier, throttle using `limitExceededSubject`
if case .limitExceeded(let id) = error, id == nil, #available(iOS 13.0, *) {
if case .limitExceeded(let id) = error, id == nil, #available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) {
self.limitExceededSubject.send(error)
} else {
updateCallback(event: .error(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class RealtimeConnectionProvider: ConnectionProvider {

connectivityMonitor.start(onUpdates: handleConnectivityUpdates(connectivity:))

if #available(iOS 13.0, *) {
if #available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *) {
subscribeToLimitExceededThrottle()
}
}
Expand Down
13 changes: 7 additions & 6 deletions AppSyncRealTimeClient/Support/AppSyncLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ struct AppSyncLogger {
AppSyncRealTimeClient.logLevel
}

// iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *
static func error(_ log: String) {
// Always logged, no conditional check needed
if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .error, log)
} else {
NSLog("%@", log)
}
}

static func error(_ error: Error) {
if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .error, error.localizedDescription)
} else {
NSLog("%@", error.localizedDescription)
Expand All @@ -36,7 +37,7 @@ struct AppSyncLogger {
return
}

if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .info, log)
} else {
NSLog("%@", log)
Expand All @@ -48,7 +49,7 @@ struct AppSyncLogger {
return
}

if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .info, log)
} else {
NSLog("%@", log)
Expand All @@ -60,7 +61,7 @@ struct AppSyncLogger {
return
}

if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .debug, log)
} else {
NSLog("%@", log)
Expand All @@ -72,7 +73,7 @@ struct AppSyncLogger {
return
}

if #available(iOS 10.0, *) {
if #available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *) {
os_log("%@", type: .debug, log)
} else {
NSLog("%@", log)
Expand Down