Skip to content

Commit 9fa0e14

Browse files
authored
Fix import statements for other platforms (#256)
1 parent 1c4be09 commit 9fa0e14

38 files changed

Lines changed: 51 additions & 45 deletions

Samples/DirectAuthSignIn/UITests/Pages/SignInScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class SignInScreen: Screen {
9595
if let fieldValue = field.value as? String,
9696
!fieldValue.isEmpty
9797
{
98-
usleep(useconds_t(1000)) // Wait for the field to be selected
98+
Thread.sleep(forTimeInterval: 0.1) // Wait for the field to be selected
9999
field.tap(withNumberOfTaps: 3, numberOfTouches: 1)
100100
}
101101

Samples/Shared/Common/Testing/Screen+Extensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ extension WebLogin where Self: Screen {
7171
_ = app.keyboards.firstMatch.waitForExistence(timeout: .standard)
7272

7373
if !fieldValue.isEmpty {
74-
usleep(useconds_t(1000)) // Wait for the field to be selected
74+
Thread.sleep(forTimeInterval: 0.1) // Wait for the field to be selected
7575
field.tap(withNumberOfTaps: 3, numberOfTouches: 1)
7676
field.typeText("")
77-
usleep(useconds_t(500))
77+
Thread.sleep(forTimeInterval: 0.05)
7878
}
7979

8080
field.typeText(username)
@@ -143,7 +143,7 @@ extension WebLogin where Self: Screen {
143143
// Dismiss the password save reminder keyboard view in iOS 18+
144144
if app.otherElements["SFAutoFillInputView"].buttons["Not Now"].exists {
145145
app.otherElements["SFAutoFillInputView"].buttons["Not Now"].tap()
146-
usleep(useconds_t(500)) // Wait for the keyboard animation, since XCTest won't
146+
Thread.sleep(forTimeInterval: 0.1) // Wait for the keyboard animation, since XCTest won't
147147
field.tap()
148148
_ = app.keyboards.firstMatch.waitForExistence(timeout: .standard)
149149
}

Sources/AuthFoundation/JWT/Protocols/JWKValidator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if os(Linux) || os(Android)
1616
public typealias OSStatus = Int32
1717
#endif
1818

Sources/AuthFoundation/Migration/SDKVersion.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import UIKit
2020
import WatchKit
2121
#endif
2222

23+
#if canImport(Android)
24+
import Android
25+
#endif
26+
2327
private let deviceModel: String = {
2428
var system = utsname()
2529
uname(&system)
@@ -42,6 +46,8 @@ private let systemName: String = {
4246
return "macOS"
4347
#elseif os(Linux)
4448
return "linux"
49+
#elseif os(Android)
50+
return "android"
4551
#endif
4652
}()
4753

Sources/AuthFoundation/Network/APIClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

Sources/AuthFoundation/Network/APIClientError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

Sources/AuthFoundation/Network/APIRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

Sources/AuthFoundation/Network/Internal/FormDataExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

Sources/AuthFoundation/Network/URLSessionProtocol.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

@@ -25,7 +25,7 @@ public protocol URLSessionProtocol: Sendable {
2525

2626
@_documentation(visibility: internal)
2727
extension URLSession: URLSessionProtocol {
28-
#if os(Linux)
28+
#if canImport(FoundationNetworking)
2929
public func data(for request: URLRequest) async throws -> (Data, URLResponse) {
3030
return try await withCheckedThrowingContinuation { continuation in
3131
let task = self.dataTask(with: request) { data, response, error in

Sources/AuthFoundation/OAuth2/OAuth2Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
#if os(Linux)
15+
#if canImport(FoundationNetworking)
1616
import FoundationNetworking
1717
#endif
1818

0 commit comments

Comments
 (0)