Skip to content

Commit 03dbacc

Browse files
committed
fix sessions tests and run style
1 parent f696b71 commit 03dbacc

File tree

58 files changed

+260
-209
lines changed

Some content is hidden

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

58 files changed

+260
-209
lines changed

FirebaseAuth/Interop/Public/FirebaseAuthInterop/FIRAuthInterop.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ NS_SWIFT_NAME(AuthInterop)
3333

3434
/// Retrieves the Firebase authentication token, possibly refreshing it if it has expired.
3535
- (void)getTokenForcingRefresh:(BOOL)forceRefresh
36-
withCallback:
37-
(void (^NS_SWIFT_UI_ACTOR)(NSString *_Nullable_result token, NSError *_Nullable error))callback NS_SWIFT_NAME(getToken(forcingRefresh:completion:));
36+
withCallback:(void (^NS_SWIFT_UI_ACTOR)(NSString *_Nullable_result token,
37+
NSError *_Nullable error))callback
38+
NS_SWIFT_NAME(getToken(forcingRefresh:completion:));
3839

3940
/// Get the current Auth user's UID. Returns nil if there is no user signed in.
4041
- (nullable NSString *)getUserID;

FirebaseAuth/Sources/Swift/ActionCode/ActionCodeInfo.swift

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

1717
/// Manages information regarding action codes.
18-
@objc(FIRActionCodeInfo) final public class ActionCodeInfo: NSObject, Sendable {
18+
@objc(FIRActionCodeInfo) public final class ActionCodeInfo: NSObject, Sendable {
1919
/// The operation being performed.
2020
@objc public let operation: ActionCodeOperation
2121

FirebaseAuth/Sources/Swift/ActionCode/ActionCodeSettings.swift

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

1717
/// Used to set and retrieve settings related to handling action codes.
18-
@objc(FIRActionCodeSettings) open class ActionCodeSettings: NSObject, @unchecked Sendable /* TODO: sendable */ {
18+
@objc(FIRActionCodeSettings) open class ActionCodeSettings: NSObject,
19+
@unchecked Sendable /* TODO: sendable */ {
1920
/// This URL represents the state/Continue URL in the form of a universal link.
2021
///
2122
/// This URL can should be constructed as a universal link that would either directly open

FirebaseAuth/Sources/Swift/Auth/Auth.swift

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import Foundation
1717
import FirebaseAppCheckInterop
1818
import FirebaseAuthInterop
1919
import FirebaseCore
20-
import FirebaseCoreInternal
2120
import FirebaseCoreExtension
21+
import FirebaseCoreInternal
2222
#if COCOAPODS
2323
@_implementationOnly import GoogleUtilities
2424
#else
@@ -82,7 +82,8 @@ extension Auth: AuthInterop {
8282
/// This method is not for public use. It is for Firebase clients of AuthInterop.
8383
@objc(getTokenForcingRefresh:withCallback:)
8484
public func getToken(forcingRefresh forceRefresh: Bool,
85-
completion callback: @escaping @MainActor @Sendable (String?, Error?) -> Void) {
85+
completion callback: @escaping @MainActor @Sendable (String?, Error?)
86+
-> Void) {
8687
kAuthGlobalWorkQueue.async { [weak self] in
8788
if let strongSelf = self {
8889
// Enable token auto-refresh if not already enabled.
@@ -227,7 +228,8 @@ extension Auth: AuthInterop {
227228
/// - user: The user object to be set as the current user of the calling Auth instance.
228229
/// - completion: Optionally; a block invoked after the user of the calling Auth instance has
229230
/// been updated or an error was encountered.
230-
@objc open func updateCurrentUser(_ user: User?, completion: (@MainActor (Error?) -> Void)? = nil) {
231+
@objc open func updateCurrentUser(_ user: User?,
232+
completion: (@MainActor (Error?) -> Void)? = nil) {
231233
kAuthGlobalWorkQueue.async {
232234
guard let user else {
233235
let error = AuthErrorUtils.nullUserError(message: nil)
@@ -707,9 +709,8 @@ extension Auth: AuthInterop {
707709
/// not enabled. Enable them in the Auth section of the Firebase console.
708710
/// - Parameter completion: Optionally; a block which is invoked when the sign in finishes, or is
709711
/// canceled. Invoked asynchronously on the main thread in the future.
710-
@objc open func signInAnonymously(
711-
completion: (@MainActor (AuthDataResult?, Error?) -> Void)? = nil
712-
) {
712+
@objc open func signInAnonymously(completion: (@MainActor (AuthDataResult?, Error?) -> Void)? =
713+
nil) {
713714
kAuthGlobalWorkQueue.async {
714715
let decoratedCallback = self.signInFlowAuthDataResultCallback(byDecorating: completion)
715716
if let currentUser = self._currentUser, currentUser.isAnonymous {
@@ -1000,7 +1001,8 @@ extension Auth: AuthInterop {
10001001
/// Invoked
10011002
/// asynchronously on the main thread in the future.
10021003
@objc open func checkActionCode(_ code: String,
1003-
completion: @MainActor @escaping (ActionCodeInfo?, Error?) -> Void) {
1004+
completion: @MainActor @escaping (ActionCodeInfo?, Error?)
1005+
-> Void) {
10041006
kAuthGlobalWorkQueue.async {
10051007
let request = ResetPasswordRequest(oobCode: code,
10061008
newPassword: nil,
@@ -1045,7 +1047,8 @@ extension Auth: AuthInterop {
10451047
/// - Parameter completion: Optionally; a block which is invoked when the request finishes.
10461048
/// Invoked asynchronously on the main thread in the future.
10471049
@objc open func verifyPasswordResetCode(_ code: String,
1048-
completion: @escaping @MainActor (String?, Error?) -> Void) {
1050+
completion: @escaping @MainActor (String?, Error?)
1051+
-> Void) {
10491052
checkActionCode(code) { info, error in
10501053
if let error {
10511054
completion(nil, error)
@@ -1078,10 +1081,8 @@ extension Auth: AuthInterop {
10781081
/// - Parameter code: The out of band code to be applied.
10791082
/// - Parameter completion: Optionally; a block which is invoked when the request finishes.
10801083
/// Invoked asynchronously on the main thread in the future.
1081-
@objc open func applyActionCode(
1082-
_ code: String,
1083-
completion: @escaping @MainActor (Error?) -> Void
1084-
) {
1084+
@objc open func applyActionCode(_ code: String,
1085+
completion: @escaping @MainActor (Error?) -> Void) {
10851086
kAuthGlobalWorkQueue.async {
10861087
let request = SetAccountInfoRequest(requestConfiguration: self.requestConfiguration)
10871088
request.oobCode = code
@@ -1393,9 +1394,9 @@ extension Auth: AuthInterop {
13931394
/// - Parameter listener: The block to be invoked. The block is always invoked asynchronously on
13941395
/// the main thread, even for it's initial invocation after having been added as a listener.
13951396
/// - Returns: A handle useful for manually unregistering the block as a listener.
1396-
@objc open func addIDTokenDidChangeListener(_ listener: @MainActor @escaping (Auth, User?) -> Void)
1397+
@objc open func addIDTokenDidChangeListener(_ listener: @MainActor @escaping (Auth, User?)
1398+
-> Void)
13971399
-> NSObjectProtocol {
1398-
13991400
let handle = NotificationCenter.default.addObserver(
14001401
forName: Auth.authStateDidChangeNotification,
14011402
object: self,
@@ -1616,7 +1617,7 @@ extension Auth: AuthInterop {
16161617
/// the URL is for the app (or another library) so the caller should continue handling
16171618
/// this URL as usual.
16181619
@MainActor @objc(canHandleURL:) open func canHandle(_ url: URL) -> Bool {
1619-
guard let authURLPresenter = self.authURLPresenter as? AuthURLPresenter else {
1620+
guard let authURLPresenter = authURLPresenter as? AuthURLPresenter else {
16201621
return false
16211622
}
16221623
return authURLPresenter.canHandle(url: url)
@@ -1889,7 +1890,8 @@ extension Auth: AuthInterop {
18891890
if let token, token.count > 0 {
18901891
internalNotificationParameters[FIRAuthStateDidChangeInternalNotificationTokenKey] = token
18911892
}
1892-
internalNotificationParameters[FIRAuthStateDidChangeInternalNotificationUIDKey] = self._currentUser?
1893+
internalNotificationParameters[FIRAuthStateDidChangeInternalNotificationUIDKey] = self
1894+
._currentUser?
18931895
.uid
18941896
let notifications = NotificationCenter.default
18951897
notifications.post(name: NSNotification.Name.FIRAuthStateDidChangeInternal,
@@ -2251,7 +2253,8 @@ extension Auth: AuthInterop {
22512253
/// Invoked asynchronously on the main thread in the future.
22522254
/// - Returns: Returns a block that updates the current user.
22532255
func signInFlowAuthDataResultCallback(byDecorating callback:
2254-
(@MainActor (AuthDataResult?, Error?) -> Void)?) -> @Sendable (Result<AuthDataResult, Error>) -> Void {
2256+
(@MainActor (AuthDataResult?, Error?) -> Void)?)
2257+
-> @Sendable (Result<AuthDataResult, Error>) -> Void {
22552258
return { result in
22562259
switch result {
22572260
case let .success(authResult):
@@ -2267,10 +2270,8 @@ extension Auth: AuthInterop {
22672270
}
22682271
}
22692272

2270-
private func wrapAsyncRPCTask(
2271-
_ request: any AuthRPCRequest,
2272-
_ callback: (@MainActor (Error?) -> Void)?
2273-
) {
2273+
private func wrapAsyncRPCTask(_ request: any AuthRPCRequest,
2274+
_ callback: (@MainActor (Error?) -> Void)?) {
22742275
Task {
22752276
do {
22762277
let _ = try await self.backend.call(with: request)
@@ -2290,7 +2291,7 @@ extension Auth: AuthInterop {
22902291
}
22912292

22922293
class func wrapMainAsync<T: Sendable>(callback: (@MainActor (T?, Error?) -> Void)?,
2293-
with result: Result<T, Error>) -> Void {
2294+
with result: Result<T, Error>) -> Void {
22942295
guard let callback else { return }
22952296
DispatchQueue.main.async {
22962297
switch result {

FirebaseAuth/Sources/Swift/Auth/AuthDataResult.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ extension AuthDataResult: NSSecureCoding {}
2222
///
2323
/// It contains references to a `User` instance and an `AdditionalUserInfo` instance.
2424
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
25-
@objc(FIRAuthDataResult) open class AuthDataResult: NSObject, @unchecked Sendable /* TODO: sendable */ {
25+
@objc(FIRAuthDataResult) open class AuthDataResult: NSObject,
26+
@unchecked Sendable /* TODO: sendable */ {
2627
/// The signed in user.
2728
@objc public let user: User
2829

FirebaseAuth/Sources/Swift/Auth/AuthTokenResult.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ extension AuthTokenResult: NSSecureCoding {}
2020
/// A data class containing the ID token JWT string and other properties associated with the
2121
/// token including the decoded payload claims.
2222
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
23-
@objc(FIRAuthTokenResult) open class AuthTokenResult: NSObject, @unchecked Sendable /* TODO: sendable */ {
23+
@objc(FIRAuthTokenResult) open class AuthTokenResult: NSObject,
24+
@unchecked Sendable /* TODO: sendable */ {
2425
/// Stores the JWT string of the ID token.
2526
@objc open var token: String
2627

FirebaseAuth/Sources/Swift/AuthProvider/OAuthProvider.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Foundation
1717

1818
/// Utility class for constructing OAuth Sign In credentials.
1919
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
20-
@objc(FIROAuthProvider) open class OAuthProvider: NSObject, FederatedAuthProvider, @unchecked Sendable /* TODO: sendable */ {
20+
@objc(FIROAuthProvider) open class OAuthProvider: NSObject, FederatedAuthProvider,
21+
@unchecked Sendable /* TODO: sendable */ {
2122
@objc public static let id = "OAuth"
2223

2324
/// Array used to configure the OAuth scopes.
@@ -281,11 +282,12 @@ import Foundation
281282
let eventID = AuthWebUtils.randomString(withLength: 10)
282283
let sessionID = AuthWebUtils.randomString(withLength: 10)
283284

284-
let callbackOnMainThread: (@MainActor (AuthCredential?, Error?) -> Void) = { credential, error in
285-
if let completion {
286-
completion(credential, error)
285+
let callbackOnMainThread: (@MainActor (AuthCredential?, Error?) -> Void) =
286+
{ credential, error in
287+
if let completion {
288+
completion(credential, error)
289+
}
287290
}
288-
}
289291
Task {
290292
do {
291293
guard let headfulLiteURL = try await self.getHeadfulLiteUrl(eventID: eventID,
@@ -301,8 +303,8 @@ import Foundation
301303
callbackScheme: self.callbackScheme)
302304
}
303305
await self.auth.authURLPresenter.present(headfulLiteURL,
304-
uiDelegate: uiDelegate,
305-
callbackMatcher: callbackMatcher) { callbackURL, error in
306+
uiDelegate: uiDelegate,
307+
callbackMatcher: callbackMatcher) { callbackURL, error in
306308
if let error {
307309
callbackOnMainThread(nil, error)
308310
return

FirebaseAuth/Sources/Swift/AuthProvider/PhoneAuthProvider.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import Foundation
1919
///
2020
/// This class is available on iOS only.
2121
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
22-
@objc(FIRPhoneAuthProvider) open class PhoneAuthProvider: NSObject, @unchecked Sendable /* TODO: sendable */ {
22+
@objc(FIRPhoneAuthProvider) open class PhoneAuthProvider: NSObject,
23+
@unchecked Sendable /* TODO: sendable */ {
2324
/// A string constant identifying the phone identity provider.
2425
@objc public static let id = "phone"
2526
private static let recaptchaVersion = "RECAPTCHA_ENTERPRISE"

FirebaseAuth/Sources/Swift/Backend/RPC/CreateAuthURIRequest.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ private let kTenantIDKey = "tenantId"
4444
/// Represents the parameters for the createAuthUri endpoint.
4545
/// See https://developers.google.com/identity/toolkit/web/reference/relyingparty/createAuthUri
4646
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
47-
class CreateAuthURIRequest: IdentityToolkitRequest, AuthRPCRequest, @unchecked Sendable /* TODO: sendable */ {
47+
class CreateAuthURIRequest: IdentityToolkitRequest, AuthRPCRequest,
48+
@unchecked Sendable /* TODO: sendable */ {
4849
typealias Response = CreateAuthURIResponse
4950

5051
/// The email or federated ID of the user.

FirebaseAuth/Sources/Swift/Backend/RPC/DeleteAccountRequest.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ private let kIDTokenKey = "idToken"
2626
private let kLocalIDKey = "localId"
2727

2828
@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
29-
class DeleteAccountRequest: IdentityToolkitRequest, AuthRPCRequest, @unchecked Sendable /* TODO: sendable */ {
29+
class DeleteAccountRequest: IdentityToolkitRequest, AuthRPCRequest,
30+
@unchecked Sendable /* TODO: sendable */ {
3031
typealias Response = DeleteAccountResponse
3132

3233
/// The STS Access Token of the authenticated user.

0 commit comments

Comments
 (0)