Skip to content

Commit dc18b7f

Browse files
refactor(global): cleanup redundant availability checks and update sample apps audit (#16143)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent ee41ce8 commit dc18b7f

182 files changed

Lines changed: 28 additions & 303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

FirebaseAnalytics/Sources/Analytics+SwiftUI.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import SwiftUI
1818

1919
/// Custom view modifier to allow for easily logging screen view events.
20-
@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, *)
2120
@available(watchOS, unavailable)
2221
struct LoggedAnalyticsModifier: ViewModifier {
2322
/// The name of the view to log in the `AnalyticsParameterScreenName` parameter.
@@ -42,7 +41,6 @@
4241
}
4342
}
4443

45-
@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, *)
4644
@available(watchOS, unavailable)
4745
public extension View {
4846
/// Logs `screen_view` events in Google Analytics for Firebase when this view appears on screen.

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import FirebaseCoreExtension
7474
}
7575
#endif
7676

77-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
7877
extension Auth: AuthInterop {
7978
/// Retrieves the Firebase authentication token, possibly refreshing it if it has expired.
8079
///
@@ -144,7 +143,6 @@ extension Auth: AuthInterop {
144143
/// Manages authentication for Firebase apps.
145144
///
146145
/// This class is thread-safe.
147-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
148146
@preconcurrency
149147
@objc(FIRAuth) open class Auth: NSObject {
150148
/// Gets the auth object for the default Firebase app.
@@ -261,7 +259,6 @@ extension Auth: AuthInterop {
261259

262260
/// Sets the `currentUser` on the receiver to the provided user object.
263261
/// - Parameter user: The user object to be set as the current user of the calling Auth instance.
264-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
265262
open func updateCurrentUser(_ user: User) async throws {
266263
return try await withCheckedThrowingContinuation { continuation in
267264
self.updateCurrentUser(user) { error in
@@ -427,7 +424,6 @@ extension Auth: AuthInterop {
427424
/// - Parameter email: The user's email address.
428425
/// - Parameter password: The user's password.
429426
/// - Returns: The `AuthDataResult` after a successful signin.
430-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
431427
@discardableResult
432428
open func signIn(withEmail email: String, password: String) async throws -> AuthDataResult {
433429
return try await withCheckedThrowingContinuation { continuation in
@@ -485,7 +481,6 @@ extension Auth: AuthInterop {
485481
/// - Parameter email: The user's email address.
486482
/// - Parameter link: The email sign-in link.
487483
/// - Returns: The `AuthDataResult` after a successful signin.
488-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
489484
open func signIn(withEmail email: String, link: String) async throws -> AuthDataResult {
490485
return try await withCheckedThrowingContinuation { continuation in
491486
self.signIn(withEmail: email, link: link) { result, error in
@@ -584,7 +579,6 @@ extension Auth: AuthInterop {
584579
/// protocol, this is used for presenting the web context. If nil, a default AuthUIDelegate
585580
/// will be used.
586581
/// - Returns: The `AuthDataResult` after the successful signin.
587-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
588582
@available(tvOS, unavailable)
589583
@available(macOS, unavailable)
590584
@available(watchOS, unavailable)
@@ -683,7 +677,6 @@ extension Auth: AuthInterop {
683677
/// * `AuthErrorCodeSessionExpired` - Indicates that the SMS code has expired.
684678
/// - Parameter credential: The credential supplied by the IdP.
685679
/// - Returns: The `AuthDataResult` after the successful signin.
686-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
687680
@discardableResult
688681
open func signIn(with credential: AuthCredential) async throws -> AuthDataResult {
689682
return try await withCheckedThrowingContinuation { continuation in
@@ -749,7 +742,6 @@ extension Auth: AuthInterop {
749742
/// * `AuthErrorCodeOperationNotAllowed` - Indicates that anonymous accounts are
750743
/// not enabled. Enable them in the Auth section of the Firebase console.
751744
/// - Returns: The `AuthDataResult` after the successful signin.
752-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
753745
@discardableResult
754746
@objc open func signInAnonymously() async throws -> AuthDataResult {
755747
return try await withCheckedThrowingContinuation { continuation in
@@ -812,7 +804,6 @@ extension Auth: AuthInterop {
812804
/// belong to different projects.
813805
/// - Parameter token: A self-signed custom auth token.
814806
/// - Returns: The `AuthDataResult` after the successful signin.
815-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
816807
@discardableResult
817808
open func signIn(withCustomToken token: String) async throws -> AuthDataResult {
818809
return try await withCheckedThrowingContinuation { continuation in
@@ -941,7 +932,6 @@ extension Auth: AuthInterop {
941932
/// - Parameter email: The user's email address.
942933
/// - Parameter password: The user's desired password.
943934
/// - Returns: The `AuthDataResult` after the successful signin.
944-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
945935
@discardableResult
946936
open func createUser(withEmail email: String, password: String) async throws -> AuthDataResult {
947937
return try await withCheckedThrowingContinuation { continuation in
@@ -991,7 +981,6 @@ extension Auth: AuthInterop {
991981
/// * `AuthErrorCodeInvalidActionCode` - Indicates the OOB code is invalid.
992982
/// - Parameter code: The reset code.
993983
/// - Parameter newPassword: The new password.
994-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
995984
open func confirmPasswordReset(withCode code: String, newPassword: String) async throws {
996985
return try await withCheckedThrowingContinuation { continuation in
997986
self.confirmPasswordReset(withCode: code, newPassword: newPassword) { error in
@@ -1037,7 +1026,6 @@ extension Auth: AuthInterop {
10371026
/// Checks the validity of an out of band code.
10381027
/// - Parameter code: The out of band code to check validity.
10391028
/// - Returns: An `ActionCodeInfo`.
1040-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
10411029
open func checkActionCode(_ code: String) async throws -> ActionCodeInfo {
10421030
return try await withCheckedThrowingContinuation { continuation in
10431031
self.checkActionCode(code) { info, error in
@@ -1068,7 +1056,6 @@ extension Auth: AuthInterop {
10681056
/// Checks the validity of a verify password reset code.
10691057
/// - Parameter code: The password reset code to be verified.
10701058
/// - Returns: An email.
1071-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
10721059
open func verifyPasswordResetCode(_ code: String) async throws -> String {
10731060
return try await withCheckedThrowingContinuation { continuation in
10741061
self.verifyPasswordResetCode(code) { code, error in
@@ -1101,7 +1088,6 @@ extension Auth: AuthInterop {
11011088
/// This method will not work for out of band codes which require an additional parameter,
11021089
/// such as password reset code.
11031090
/// - Parameter code: The out of band code to be applied.
1104-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
11051091
open func applyActionCode(_ code: String) async throws {
11061092
return try await withCheckedThrowingContinuation { continuation in
11071093
self.applyActionCode(code) { error in
@@ -1216,7 +1202,6 @@ extension Auth: AuthInterop {
12161202
/// - Parameter email: The email address of the user.
12171203
/// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to
12181204
/// handling action codes.
1219-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
12201205
open func sendPasswordReset(withEmail email: String,
12211206
actionCodeSettings: ActionCodeSettings? = nil) async throws {
12221207
return try await withCheckedThrowingContinuation { continuation in
@@ -1271,7 +1256,6 @@ extension Auth: AuthInterop {
12711256
/// - Parameter email: The email address of the user.
12721257
/// - Parameter actionCodeSettings: An `ActionCodeSettings` object containing settings related to
12731258
/// handling action codes.
1274-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
12751259
open func sendSignInLink(toEmail email: String,
12761260
actionCodeSettings: ActionCodeSettings) async throws {
12771261
return try await withCheckedThrowingContinuation { continuation in
@@ -1480,7 +1464,6 @@ extension Auth: AuthInterop {
14801464

14811465
/// Revoke the users token with authorization code.
14821466
/// - Parameter authorizationCode: The authorization code used to perform the revocation.
1483-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
14841467
open func revokeToken(withAuthorizationCode authorizationCode: String) async throws {
14851468
return try await withCheckedThrowingContinuation { continuation in
14861469
self.revokeToken(withAuthorizationCode: authorizationCode) { error in

FirebaseAuth/Sources/Swift/Auth/AuthComponent.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import FirebaseAuthInterop
1919
import FirebaseCore
2020
import FirebaseCoreExtension
2121

22-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2322
@objc(FIRAuthComponent)
2423
class AuthComponent: NSObject, Library, ComponentLifecycleMaintainer {
2524
// MARK: - Private Variables

FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414

1515
import Foundation
1616

17-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1817
extension AuthDataResult: NSSecureCoding {}
1918

2019
/// Helper object that contains the result of a successful sign-in, link and reauthenticate
2120
/// action.
2221
///
2322
/// It contains references to a `User` instance and an `AdditionalUserInfo` instance.
24-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2523
@objc(FIRAuthDataResult) open class AuthDataResult: NSObject {
2624
/// The signed in user.
2725
@objc public let user: User

FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
import Foundation
1616

17-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1817
extension AuthTokenResult: NSSecureCoding {}
1918

2019
/// A data class containing the ID token JWT string and other properties associated with the
2120
/// token including the decoded payload claims.
22-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2321
@objc(FIRAuthTokenResult) open class AuthTokenResult: NSObject {
2422
/// Stores the JWT string of the ID token.
2523
@objc open var token: String

FirebaseAuth/Sources/Swift/AuthProvider/AuthCredential.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import Foundation
1616

1717
/// Public representation of a credential.
18-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1918
@objc(FIRAuthCredential) open class AuthCredential: NSObject, @unchecked Sendable {
2019
/// The name of the identity provider for the credential.
2120
@objc public let provider: String

FirebaseAuth/Sources/Swift/AuthProvider/EmailAuthProvider.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import Foundation
1616

1717
/// A concrete implementation of `AuthProvider` for Email & Password Sign In.
18-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1918
@objc(FIREmailAuthProvider) open class EmailAuthProvider: NSObject {
2019
/// A string constant identifying the email & password identity provider.
2120
@objc public static let id = "password"
@@ -37,7 +36,6 @@ import Foundation
3736
}
3837
}
3938

40-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
4139
@objc(FIREmailPasswordAuthCredential) class EmailAuthCredential: AuthCredential, NSSecureCoding,
4240
@unchecked Sendable {
4341
let email: String

FirebaseAuth/Sources/Swift/AuthProvider/FacebookAuthProvider.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import Foundation
1616

1717
/// Utility class for constructing Facebook Sign In credentials.
18-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1918
@objc(FIRFacebookAuthProvider) open class FacebookAuthProvider: NSObject {
2019
/// A string constant identifying the Facebook identity provider.
2120
@objc public static let id = "facebook.com"
@@ -33,7 +32,6 @@ import Foundation
3332
}
3433
}
3534

36-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
3735
@objc(FIRFacebookAuthCredential) class FacebookAuthCredential: AuthCredential, NSSecureCoding,
3836
@unchecked Sendable {
3937
let accessToken: String?

FirebaseAuth/Sources/Swift/AuthProvider/FederatedAuthProvider.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import Foundation
1616

1717
/// Utility type for constructing federated auth provider credentials.
18-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
1918
@objc(FIRFederatedAuthProvider) public protocol FederatedAuthProvider: NSObjectProtocol {
2019
#if os(iOS)
2120

FirebaseAuth/Sources/Swift/AuthProvider/GameCenterAuthProvider.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919
// TODO: Delete this when minimum iOS version passes 13.5.
2020
/// WarningWorkaround is needed because playerID is deprecated in iOS 13.0 but still needed until
2121
/// 13.5 when the fetchItems API was introduced.
22-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2322
private protocol WarningWorkaround {
2423
static func pre135Credential(localPlayer: GKLocalPlayer,
2524
completion: @escaping (AuthCredential?, Error?) -> Void)
2625
}
2726

28-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
2927
extension GameCenterAuthProvider: WarningWorkaround {}
3028

3129
/// A concrete implementation of `AuthProvider` for Game Center Sign In. Not available on watchOS.
32-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
3330
@objc(FIRGameCenterAuthProvider) open class GameCenterAuthProvider: NSObject {
3431
/// A string constant identifying the Game Center identity provider.
3532
@objc public static let id = "gc.apple.com"
@@ -127,7 +124,6 @@
127124
}
128125
}
129126

130-
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
131127
@objc(FIRGameCenterAuthCredential)
132128
class GameCenterAuthCredential: AuthCredential, NSSecureCoding, @unchecked Sendable {
133129
let playerID: String?

0 commit comments

Comments
 (0)