Skip to content

Commit

Permalink
one more var instead of func
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Dec 28, 2023
1 parent 84c662b commit 556fc5c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private class AuthBackendRPCImplementation: NSObject, AuthBackendImplementation
#if os(iOS)
private class func generateMFAError(response: AuthRPCResponse, auth: Auth) -> Error? {
if let mfaResponse = response as? AuthMFAResponse,
mfaResponse.nilIDToken(),
mfaResponse.idToken == nil,
let enrollments = mfaResponse.mfaInfo {
var info: [MultiFactorInfo] = []
for enrollment in enrollments {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ protocol AuthMFAResponse {
var mfaInfo: [AuthProtoMFAEnrollment]? { get }

/// MFA is only done when the idToken is nil.
func nilIDToken() -> Bool
var idToken: String? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class EmailLinkSignInResponse: NSObject, AuthRPCResponse, AuthMFAResponse {
/** @property IDToken
@brief The ID token in the email link sign-in response.
*/
var idToken: String?
private var _idToken: String?

/** @property email
@brief The email returned by the IdP.
Expand Down Expand Up @@ -51,9 +51,7 @@ class EmailLinkSignInResponse: NSObject, AuthRPCResponse, AuthMFAResponse {

var mfaInfo: [AuthProtoMFAEnrollment]? { return _mfaInfo }

func nilIDToken() -> Bool {
return idToken == nil
}
var idToken: String? { return _idToken }

/** @property MFAPendingCredential
@brief An opaque string that functions as proof that the user has successfully passed the first
Expand All @@ -68,7 +66,7 @@ class EmailLinkSignInResponse: NSObject, AuthRPCResponse, AuthMFAResponse {

func setFields(dictionary: [String: AnyHashable]) throws {
email = dictionary["email"] as? String
idToken = dictionary["idToken"] as? String
_idToken = dictionary["idToken"] as? String
isNewUser = dictionary["isNewUser"] as? Bool ?? false
refreshToken = dictionary["refreshToken"] as? String

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class VerifyAssertionResponse: AuthRPCResponse, AuthMFAResponse {
access token from Secure Token Service, depending on whether @c returnSecureToken is set
on the request.
*/
var idToken: String?
private var _idToken: String?

/** @property approximateExpirationDate
@brief The approximate expiration date of the access token.
Expand Down Expand Up @@ -207,9 +207,7 @@ class VerifyAssertionResponse: AuthRPCResponse, AuthMFAResponse {

var mfaInfo: [AuthProtoMFAEnrollment]? { return _mfaInfo }

func nilIDToken() -> Bool {
return idToken == nil
}
var idToken: String? { return _idToken }

private var _mfaPendingCredential: String?

Expand All @@ -231,7 +229,7 @@ class VerifyAssertionResponse: AuthRPCResponse, AuthMFAResponse {
fullName = dictionary["fullName"] as? String
nickName = dictionary["nickName"] as? String
displayName = dictionary["displayName"] as? String
idToken = dictionary["idToken"] as? String
_idToken = dictionary["idToken"] as? String
if let expiresIn = dictionary["expiresIn"] as? String {
approximateExpirationDate = Date(timeIntervalSinceNow: (expiresIn as NSString)
.doubleValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class VerifyPasswordResponse: AuthRPCResponse, AuthMFAResponse {
access token from Secure Token Service, depending on whether @c returnSecureToken is set
on the request.
*/
var idToken: String?
private var _idToken: String?

/** @property approximateExpirationDate
@brief The approximate expiration date of the access token.
Expand All @@ -68,9 +68,7 @@ class VerifyPasswordResponse: AuthRPCResponse, AuthMFAResponse {

var mfaInfo: [AuthProtoMFAEnrollment]? { return _mfaInfo }

func nilIDToken() -> Bool {
return idToken == nil
}
var idToken: String? { return _idToken }

private var _mfaPendingCredential: String?

Expand All @@ -80,7 +78,7 @@ class VerifyPasswordResponse: AuthRPCResponse, AuthMFAResponse {
localID = dictionary["localId"] as? String
email = dictionary["email"] as? String
displayName = dictionary["displayName"] as? String
idToken = dictionary["idToken"] as? String
_idToken = dictionary["idToken"] as? String
if let expiresIn = dictionary["expiresIn"] as? String {
approximateExpirationDate = Date(timeIntervalSinceNow: (expiresIn as NSString)
.doubleValue)
Expand Down

0 comments on commit 556fc5c

Please sign in to comment.