Skip to content

Commit

Permalink
Obvious Fix: Change minimum iOS version from 15 to 13 where possible (#…
Browse files Browse the repository at this point in the history
…145)

* Change minimum iOS version from 15 to 13 where possible

* Update availability of async functions for macOS, watchOS and tvOS
  • Loading branch information
sebastiangrail authored Aug 1, 2023
1 parent e88011c commit f391358
Show file tree
Hide file tree
Showing 25 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Sources/AuthFoundation/Network/APIRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public protocol APIRequest {
/// - client: ``APIClient`` the request is being sent to.
/// - context: Optional context to use when parsing the response.
/// - Returns: ``APIResponse`` result of the request.
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func send(to client: APIClient, parsing context: APIParsingContext?) async throws -> APIResponse<ResponseType>
#endif
}
Expand Down Expand Up @@ -243,7 +243,7 @@ extension APIRequest {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
public func send(to client: APIClient, parsing context: APIParsingContext? = nil) async throws -> APIResponse<ResponseType> {
try await withCheckedThrowingContinuation { continuation in
send(to: client, parsing: context) { result in
Expand Down
2 changes: 1 addition & 1 deletion Sources/AuthFoundation/OAuth2/OAuth2Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public final class OAuth2Client {
// swiftlint:enable type_body_length

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension OAuth2Client {
/// Asynchronously retrieves the org's OpenID configuration.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/AuthFoundation/Token Management/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public final class Token: Codable, Equatable, Hashable, Expires {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension Token {
/// Creates a new Token from a refresh token.
/// - Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension Notification.Name {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension Credential {
/// Attempt to refresh the token.
public func refresh() async throws {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OktaDirectAuth/DirectAuthFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public class DirectAuthenticationFlow: AuthenticationFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension DirectAuthenticationFlow {
/// Start user authentication, with the given username login hint and primary factor.
/// - Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public class AuthorizationCodeFlow: AuthenticationFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension AuthorizationCodeFlow {
/// Asynchronously initiates an authentication flow, with an optional ``Context-swift.struct``, using Swift Concurrency.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public class DeviceAuthorizationFlow: AuthenticationFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension DeviceAuthorizationFlow {
/// Asynchronously initiates a device authentication flow.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Authentication/ResourceOwnerFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class ResourceOwnerFlow: AuthenticationFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension ResourceOwnerFlow {
/// Asynchronously authenticates with the Resource Owner flow.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Authentication/SessionTokenFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public class SessionTokenFlow: AuthenticationFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension SessionTokenFlow {
/// Asynchronously authenticates with the given session token.
public func start(with sessionToken: String,
Expand Down
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Authentication/TokenExchangeFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ extension TokenExchangeFlow: OAuth2ClientDelegate {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension TokenExchangeFlow {
/// Asynchronously initiates a token exchange flow.
/// - Parameter tokens: Tokens to exchange. If empty, the method throws an error.
Expand Down
2 changes: 1 addition & 1 deletion Sources/OktaOAuth2/Logout/SessionLogoutFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public class SessionLogoutFlow: LogoutFlow {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension SessionLogoutFlow {
/// Asynchronously initiates a logout flow, with a required ID Token.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ extension WebAuthentication {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension WebAuthentication {
@available(*, deprecated, renamed: "signIn(from:options:)")
public final func signIn(from window: WindowAnchor?,
Expand Down
2 changes: 1 addition & 1 deletion Sources/WebAuthenticationUI/WebAuthentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public class WebAuthentication {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
extension WebAuthentication {
/// Asynchronously initiates authentication from the given window.
/// - Parameters:
Expand Down
8 changes: 4 additions & 4 deletions Tests/AuthFoundationTests/CredentialRefreshTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,26 +312,26 @@ final class CredentialRefreshTests: XCTestCase, OAuth2ClientDelegate {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRefreshAsync() async throws {
let credential = try credential(for: Token.simpleMockToken)
try await credential.refresh()
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRefreshIfNeededExpiredAsync() async throws {
let credential = try credential(for: Token.mockToken(issuedOffset: 6000))
try await credential.refreshIfNeeded(graceInterval: 300)
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRefreshIfNeededWithinGraceIntervalAsync() async throws {
let credential = try credential(for: Token.mockToken(issuedOffset: 0),
expectAPICalls: .none)
try await credential.refreshIfNeeded(graceInterval: 300)
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRefreshIfNeededOutsideGraceIntervalAsync() async throws {
let credential = try credential(for: Token.mockToken(issuedOffset: 3500))
try await credential.refreshIfNeeded(graceInterval: 300)
Expand Down
4 changes: 2 additions & 2 deletions Tests/AuthFoundationTests/OAuth2ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ final class OAuth2ClientTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRefreshAsync() async throws {
urlSession.expect("https://example.com/.well-known/openid-configuration",
data: try data(from: .module, for: "openid-configuration", in: "MockResponses"),
Expand All @@ -544,7 +544,7 @@ final class OAuth2ClientTests: XCTestCase {
XCTAssertNotNil(token)
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testRevokeAsync() async throws {
urlSession.expect("https://example.com/.well-known/openid-configuration",
data: try data(from: .module, for: "openid-configuration", in: "MockResponses"),
Expand Down
2 changes: 1 addition & 1 deletion Tests/AuthFoundationTests/TokenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ final class TokenTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testTokenFromRefreshTokenAsync() async throws {
let client = try mockClient()
let token = try await Token.from(refreshToken: "the_refresh_token", using: client)
Expand Down
6 changes: 3 additions & 3 deletions Tests/OktaDirectAuthTests/DirectAuth1FATests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class DirectAuth1FATests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testUserAndPassword() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand All @@ -60,7 +60,7 @@ final class DirectAuth1FATests: XCTestCase {
}
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testUserAndOTP() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand All @@ -78,7 +78,7 @@ final class DirectAuth1FATests: XCTestCase {
}
}

@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testUserAndOOBPush() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OktaDirectAuthTests/DirectAuth2FATests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class DirectAuth2FATests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testUserPasswordAndOOB() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ final class AuthorizationCodeFlowSuccessTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testWithAsync() async throws {
// Ensure the initial state
XCTAssertNil(flow.context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ final class DeviceAuthorizationFlowSuccessTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testWithAsync() async throws {
// Ensure the initial state
XCTAssertNil(flow.context)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OktaOAuth2Tests/ResourceOwnerFlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ final class ResourceOwnerFlowSuccessTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testWithAsync() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OktaOAuth2Tests/SessionLogoutFlowSuccessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ final class SessionLogoutFlowSuccessTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testWithAsync() async throws {
XCTAssertNil(flow.context)
XCTAssertFalse(flow.inProgress)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OktaOAuth2Tests/SessionTokenFlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ final class SessionTokenFlowSuccessTests: XCTestCase {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testWithAsync() async throws {
// Ensure the initial state
XCTAssertFalse(flow.isAuthenticating)
Expand Down
2 changes: 1 addition & 1 deletion Tests/OktaOAuth2Tests/TokenExchangeFlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ final class TokenExchangeFlowTests: XCTestCase {
}

#if swift(>=5.5.1) && !os(Linux)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func testAsyncAuthenticationSucceeded() async throws {
XCTAssertFalse(flow.isAuthenticating)

Expand Down
2 changes: 1 addition & 1 deletion Tests/TestCommon/URLSessionMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class URLSessionMock: URLSessionProtocol {
}

#if swift(>=5.5.1)
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8, *)
@available(iOS 13.0, tvOS 13.0, macOS 10.15, watchOS 6, *)
func data(for request: URLRequest, delegate: URLSessionTaskDelegate?) async throws -> (Data, URLResponse) {
requests.append(request)

Expand Down

0 comments on commit f391358

Please sign in to comment.