Skip to content

Commit 73279db

Browse files
authored
Enable async/await APIs for iOS 13, etc. (#9540)
* Enable async/await APIs for iOS 13, etc. This bumps the required compiler version to 5.5.2 which was included in Xcode 13.2, where backporting was first introduced. This breaks less developers and enables developers who aren't using these APIs to still compile using Xcode 13.0 and 13.1. As far as I can tell, the only breakage this includes now is developers who are using Xcode 13.0 or 13.1, targeting iOS 15 and using one of these 7 APIs. It will result in a compiler error and they'll have to either use the completion handler version or upgrade to Xcode 13.2+ to fix the compilation error. * Missed checks, CHANGELOG * Fixed avialability, added watchOS for RTDB * Moved to watchOS 7 for all async/await APIs to match platform support
1 parent 87aff7a commit 73279db

File tree

27 files changed

+171
-165
lines changed

27 files changed

+171
-165
lines changed

FirebaseAppCheck/Tests/Unit/Swift/AppCheckAPITests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ final class AppCheckAPITests {
6565
}
6666

6767
// Get token (async/await)
68-
#if compiler(>=5.5) && canImport(_Concurrency)
69-
if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
68+
#if compiler(>=5.5.2) && canImport(_Concurrency)
69+
if #available(iOS 13.0, macOS 11.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
7070
// async/await is a Swift 5.5+ feature available on iOS 15+
7171
Task {
7272
do {
@@ -76,7 +76,7 @@ final class AppCheckAPITests {
7676
}
7777
}
7878
}
79-
#endif // compiler(>=5.5) && canImport(_Concurrency)
79+
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
8080

8181
// Set `AppCheckProviderFactory`
8282
AppCheck.setAppCheckProviderFactory(DummyAppCheckProviderFactory())
@@ -99,8 +99,8 @@ final class AppCheckAPITests {
9999
}
100100

101101
// Get token (async/await)
102-
#if compiler(>=5.5) && canImport(_Concurrency)
103-
if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
102+
#if compiler(>=5.5.2) && canImport(_Concurrency)
103+
if #available(iOS 13.0, macOS 11.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
104104
// async/await is a Swift 5.5+ feature available on iOS 15+
105105
Task {
106106
do {
@@ -110,7 +110,7 @@ final class AppCheckAPITests {
110110
}
111111
}
112112
}
113-
#endif // compiler(>=5.5) && canImport(_Concurrency)
113+
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
114114

115115
_ = debugProvider.localDebugToken()
116116
_ = debugProvider.currentDebugToken()
@@ -172,8 +172,8 @@ final class AppCheckAPITests {
172172
}
173173
}
174174
// Get token (async/await)
175-
#if compiler(>=5.5) && canImport(_Concurrency)
176-
if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
175+
#if compiler(>=5.5.2) && canImport(_Concurrency)
176+
if #available(iOS 13.0, macOS 11.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
177177
// async/await is a Swift 5.5+ feature available on iOS 15+
178178
Task {
179179
do {
@@ -183,7 +183,7 @@ final class AppCheckAPITests {
183183
}
184184
}
185185
}
186-
#endif // compiler(>=5.5) && canImport(_Concurrency)
186+
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
187187
}
188188
}
189189
#endif // !os(watchOS)

FirebaseAuth/Tests/Sample/SwiftApiTests/AccountInfoTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class AccountInfoTests: TestsBase {
7575
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
7676
}
7777

78-
#if compiler(>=5.5) && canImport(_Concurrency)
79-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
78+
#if compiler(>=5.5.2) && canImport(_Concurrency)
79+
@available(iOS 13, tvOS 13, macOS 10.15, watchOS 7, *)
8080
func testUpdatingUsersEmailAsync() async throws {
8181
let auth = Auth.auth()
8282
do {

FirebaseAuth/Tests/Sample/SwiftApiTests/AnonymousTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class AnonymousTests: TestsBase {
2929
deleteCurrentUser()
3030
}
3131

32-
#if compiler(>=5.5) && canImport(_Concurrency)
33-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
32+
#if compiler(>=5.5.2) && canImport(_Concurrency)
33+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
3434
func testUpdatingUsersEmailAsync() async throws {
3535
try await signInAnonymouslyAsync()
3636
if let isAnonymous = Auth.auth().currentUser?.isAnonymous {

FirebaseAuth/Tests/Sample/SwiftApiTests/EmailPasswordTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class EmailPasswordTests: TestsBase {
3939
deleteCurrentUser()
4040
}
4141

42-
#if compiler(>=5.5) && canImport(_Concurrency)
43-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
42+
#if compiler(>=5.5.2) && canImport(_Concurrency)
43+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
4444
func testCreateAccountWithEmailAndPasswordAsync() async throws {
4545
let auth = Auth.auth()
4646
try await auth.createUser(withEmail: kNewEmailToCreateUser, password: "password")
@@ -63,8 +63,8 @@ class EmailPasswordTests: TestsBase {
6363
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
6464
}
6565

66-
#if compiler(>=5.5) && canImport(_Concurrency)
67-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
66+
#if compiler(>=5.5.2) && canImport(_Concurrency)
67+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
6868
func testSignInExistingUserWithEmailAndPasswordAsync() async throws {
6969
let auth = Auth.auth()
7070
try await auth.signIn(withEmail: kExistingEmailToSignIn, password: "password")

FirebaseAuth/Tests/Sample/SwiftApiTests/FacebookTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class FacebookTests: TestsBase {
4242
deleteFacebookTestingAccountbyID(facebookAccountID)
4343
}
4444

45-
#if compiler(>=5.5) && canImport(_Concurrency)
46-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
45+
#if compiler(>=5.5.2) && canImport(_Concurrency)
46+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
4747
func testSignInWithFacebookAsync() async throws {
4848
let auth = Auth.auth()
4949
let userInfoDict = try await createFacebookTestingAccountAsync()
@@ -88,8 +88,8 @@ class FacebookTests: TestsBase {
8888
deleteFacebookTestingAccountbyID(facebookAccountID)
8989
}
9090

91-
#if compiler(>=5.5) && canImport(_Concurrency)
92-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
91+
#if compiler(>=5.5.2) && canImport(_Concurrency)
92+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
9393
func testLinkAnonymousAccountToFacebookAccountAsync() async throws {
9494
let auth = Auth.auth()
9595
try await signInAnonymouslyAsync()
@@ -150,8 +150,8 @@ class FacebookTests: TestsBase {
150150
return returnValue
151151
}
152152

153-
#if compiler(>=5.5) && canImport(_Concurrency)
154-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
153+
#if compiler(>=5.5.2) && canImport(_Concurrency)
154+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
155155
/// ** Creates a Facebook testing account using Facebook Graph API and return a dictionary that
156156
// * constains "id", "access_token", "login_url", "email" and "password" of the created account.
157157
// */
@@ -194,8 +194,8 @@ class FacebookTests: TestsBase {
194194
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
195195
}
196196

197-
#if compiler(>=5.5) && canImport(_Concurrency)
198-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
197+
#if compiler(>=5.5.2) && canImport(_Concurrency)
198+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
199199
// ** Delete a Facebook testing account by account Id using Facebook Graph API. */
200200
func deleteFacebookTestingAccountbyIDAsync(_ accountID: String) async throws {
201201
let urltoDeleteTestUser = "https://graph.facebook.com/\(accountID)"

FirebaseAuth/Tests/Sample/SwiftApiTests/GoogleTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class GoogleTests: TestsBase {
3737
waitForExpectations(timeout: TestsBase.kExpectationsTimeout)
3838
}
3939

40-
#if compiler(>=5.5) && canImport(_Concurrency)
41-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
40+
#if compiler(>=5.5.2) && canImport(_Concurrency)
41+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
4242
func testSignInWithGoogleAsync() async throws {
4343
let auth = Auth.auth()
4444
let userInfoDict = try await getGoogleAccessTokenAsync()
@@ -84,8 +84,8 @@ class GoogleTests: TestsBase {
8484
return returnValue
8585
}
8686

87-
#if compiler(>=5.5) && canImport(_Concurrency)
88-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
87+
#if compiler(>=5.5.2) && canImport(_Concurrency)
88+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
8989
/// ** Sends http request to Google OAuth2 token server to use refresh token to exchange for Google
9090
// * access token. Returns a dictionary that constains "access_token", "token_type", "expires_in" and
9191
// * sometimes the "id_token". (The id_token is not guaranteed to be returned during a refresh

FirebaseAuth/Tests/Sample/SwiftApiTests/SwiftAPI.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
9090
try auth.getStoredUser(forAccessGroup: "def")
9191
}
9292

93-
#if compiler(>=5.5) && canImport(_Concurrency)
94-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
93+
#if compiler(>=5.5.2) && canImport(_Concurrency)
94+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
9595
func FIRAuth_hAsync() async throws {
9696
let auth = FirebaseAuth.Auth.auth()
9797
let user = auth.currentUser!
@@ -220,8 +220,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
220220
obj.dismiss(animated: false) {}
221221
}
222222

223-
#if compiler(>=5.5) && canImport(_Concurrency)
224-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
223+
#if compiler(>=5.5.2) && canImport(_Concurrency)
224+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
225225
func FIRAuthUIDelegate_hAsync() async {
226226
class AuthUIImpl: NSObject, AuthUIDelegate {
227227
func present(_ viewControllerToPresent: UIViewController, animated flag: Bool) async {}
@@ -253,8 +253,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
253253
}
254254
}
255255

256-
#if compiler(>=5.5) && canImport(_Concurrency)
257-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
256+
#if compiler(>=5.5.2) && canImport(_Concurrency)
257+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
258258
func FIRFedederatedAuthProvider_hAsync() async throws {
259259
class FederatedAuthImplementation: NSObject, FederatedAuthProvider {
260260
func credential(with UIDelegate: AuthUIDelegate?) async throws -> AuthCredential {
@@ -271,8 +271,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
271271
}
272272
}
273273

274-
#if compiler(>=5.5) && canImport(_Concurrency)
275-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
274+
#if compiler(>=5.5.2) && canImport(_Concurrency)
275+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
276276
func FIRGameCenterAuthProvider_hAsync() async throws {
277277
_ = try await GameCenterAuthProvider.getCredential()
278278
}
@@ -298,8 +298,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
298298
}
299299
}
300300

301-
#if compiler(>=5.5) && canImport(_Concurrency)
302-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
301+
#if compiler(>=5.5.2) && canImport(_Concurrency)
302+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
303303
func FIRMultiFactor_hAsync() async throws {
304304
let obj = MultiFactor()
305305
try await obj.session()
@@ -315,8 +315,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
315315
}
316316
}
317317

318-
#if compiler(>=5.5) && canImport(_Concurrency)
319-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
318+
#if compiler(>=5.5.2) && canImport(_Concurrency)
319+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
320320
func FIRMultiFactorResolver_hAsync() async throws {
321321
let obj = MultiFactorResolver()
322322
try await obj.resolveSignIn(with: MultiFactorAssertion())
@@ -351,8 +351,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
351351
provider.credential(withVerificationID: "id", verificationCode: "code")
352352
}
353353

354-
#if compiler(>=5.5) && canImport(_Concurrency)
355-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
354+
#if compiler(>=5.5.2) && canImport(_Concurrency)
355+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
356356
func FIRPhoneAuthProvider_hAsync() async throws {
357357
_ = PhoneAuthProvider.provider()
358358
let provider = PhoneAuthProvider.provider(auth: FirebaseAuth.Auth.auth())
@@ -423,8 +423,8 @@ class AuthAPI_hOnlyTests: XCTestCase {
423423
}
424424
}
425425

426-
#if compiler(>=5.5) && canImport(_Concurrency)
427-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
426+
#if compiler(>=5.5.2) && canImport(_Concurrency)
427+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
428428
func FIRUser_hAsync() async throws {
429429
let auth = FirebaseAuth.Auth.auth()
430430
let user = auth.currentUser!

FirebaseAuth/Tests/Sample/SwiftApiTests/TestsBase.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ import XCTest
2121
class TestsBase: XCTestCase {
2222
static let kExpectationsTimeout = 10.0
2323

24-
#if compiler(>=5.5) && canImport(_Concurrency)
25-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
24+
#if compiler(>=5.5.2) && canImport(_Concurrency)
25+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2626
func signInAnonymouslyAsync() async throws {
2727
let auth = Auth.auth()
2828
try await auth.signInAnonymously()
2929
}
3030

31-
@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
31+
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
3232
func deleteCurrentUserAsync() async throws {
3333
let auth = Auth.auth()
3434
try await auth.currentUser?.delete()

FirebaseCore/Tests/SwiftUnit/CoreAPITests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ final class CoreAPITests {
5151
// ...
5252
}
5353

54-
#if compiler(>=5.5) && canImport(_Concurrency)
55-
if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
54+
#if compiler(>=5.5.2) && canImport(_Concurrency)
55+
if #available(iOS 13.0, macOS 11.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
5656
// async/await is a Swift 5.5+ feature available on iOS 15+
5757
Task {
5858
await app.delete()
5959
}
6060
}
61-
#endif // compiler(>=5.5) && canImport(_Concurrency)
61+
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
6262
}
6363

6464
// Properties

0 commit comments

Comments
 (0)