Skip to content

Commit

Permalink
Update Configuration.swift
Browse files Browse the repository at this point in the history
lint
  • Loading branch information
LucasCoderT committed Aug 25, 2024
1 parent 15f4e27 commit 0f92110
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions OctoKit/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public struct OAuthConfiguration: Configuration {
task.resume()
}
}

#if compiler(>=5.5.2) && canImport(_Concurrency)
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
public func authorize(code: String) async throws -> TokenConfiguration? {
public func authorize(code: String) async throws -> TokenConfiguration? {
let request = OAuthRouter.accessToken(self, code).URLRequest
if let request = request {
let (data, response) = try await session.data(for: request, delegate: nil)
Expand All @@ -114,9 +114,9 @@ public struct OAuthConfiguration: Configuration {
return nil
} else {
if let string = String(data: data, encoding: .utf8) {
let accessToken = self.accessTokenFromResponse(string)
let accessToken = accessTokenFromResponse(string)
if let accessToken = accessToken {
return TokenConfiguration(accessToken, url: self.apiEndpoint)
return TokenConfiguration(accessToken, url: apiEndpoint)
}
}
}
Expand All @@ -125,7 +125,6 @@ public struct OAuthConfiguration: Configuration {
return nil
}
#endif


public func handleOpenURL(url: URL, completion: @escaping (_ config: TokenConfiguration) -> Void) {
if let code = url.URLParameters["code"] {
Expand All @@ -134,7 +133,7 @@ public struct OAuthConfiguration: Configuration {
}
}
}

#if compiler(>=5.5.2) && canImport(_Concurrency)
@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)
public func handleOpenURL(url: URL) async throws -> TokenConfiguration? {
Expand Down

0 comments on commit 0f92110

Please sign in to comment.