Skip to content

Commit 66bc390

Browse files
Merge pull request #1280 from firebase/error-refactor
2 parents 4832ff7 + a55d8dd commit 66bc390

File tree

30 files changed

+736
-676
lines changed

30 files changed

+736
-676
lines changed

FirebaseSwiftUI/FirebaseAppleSwiftUI/Sources/Services/AccountService+Apple.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ class AppleDeleteUserOperation: AuthenticatedOperation,
4444
}
4545
}
4646
}
47-

FirebaseSwiftUI/FirebaseAppleSwiftUI/Sources/Services/AppleProviderAuthUI.swift

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ extension ASAuthorizationAppleIDCredential {
3939

4040
// MARK: - Authenticate With Apple Dialog
4141

42-
private func authenticateWithApple(
43-
scopes: [ASAuthorization.Scope]
44-
) async throws -> (ASAuthorizationAppleIDCredential, String) {
42+
private func authenticateWithApple(scopes: [ASAuthorization.Scope]) async throws -> (
43+
ASAuthorizationAppleIDCredential,
44+
String
45+
) {
4546
return try await AuthenticateWithAppleDialog(scopes: scopes).authenticate()
4647
}
4748

4849
private class AuthenticateWithAppleDialog: NSObject {
4950
private var continuation: CheckedContinuation<(ASAuthorizationAppleIDCredential, String), Error>?
5051
private var currentNonce: String?
5152
private let scopes: [ASAuthorization.Scope]
52-
53+
5354
init(scopes: [ASAuthorization.Scope]) {
5455
self.scopes = scopes
5556
super.init()
@@ -80,10 +81,8 @@ private class AuthenticateWithAppleDialog: NSObject {
8081
}
8182

8283
extension AuthenticateWithAppleDialog: ASAuthorizationControllerDelegate {
83-
func authorizationController(
84-
controller: ASAuthorizationController,
85-
didCompleteWithAuthorization authorization: ASAuthorization
86-
) {
84+
func authorizationController(controller _: ASAuthorizationController,
85+
didCompleteWithAuthorization authorization: ASAuthorization) {
8786
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
8887
if let nonce = currentNonce {
8988
continuation?.resume(returning: (appleIDCredential, nonce))
@@ -106,10 +105,8 @@ extension AuthenticateWithAppleDialog: ASAuthorizationControllerDelegate {
106105
continuation = nil
107106
}
108107

109-
func authorizationController(
110-
controller: ASAuthorizationController,
111-
didCompleteWithError error: Error
112-
) {
108+
func authorizationController(controller _: ASAuthorizationController,
109+
didCompleteWithError error: Error) {
113110
continuation?.resume(throwing: AuthServiceError.signInFailed(underlying: error))
114111
continuation = nil
115112
}
@@ -160,4 +157,3 @@ public class AppleProviderAuthUI: AuthProviderUI {
160157
AnyView(SignInWithAppleButton(provider: provider))
161158
}
162159
}
163-

FirebaseSwiftUI/FirebaseAppleSwiftUI/Sources/Services/AuthService+Apple.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ public extension AuthService {
2929
return self
3030
}
3131
}
32-

FirebaseSwiftUI/FirebaseAppleSwiftUI/Sources/Services/CryptoUtils.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import Foundation
1615
import CryptoKit
16+
import Foundation
1717

1818
/// Set of utility APIs for generating cryptographical artifacts.
1919
enum CryptoUtils {
@@ -50,4 +50,3 @@ enum CryptoUtils {
5050
return hashString
5151
}
5252
}
53-

FirebaseSwiftUI/FirebaseAppleSwiftUI/Sources/Views/SignInWithAppleButton.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension SignInWithAppleButton: View {
2929
public var body: some View {
3030
Button(action: {
3131
Task {
32-
try await authService.signIn(provider)
32+
try? await authService.signIn(provider)
3333
}
3434
}) {
3535
HStack {
@@ -51,4 +51,3 @@ extension SignInWithAppleButton: View {
5151
.accessibilityIdentifier("sign-in-with-apple-button")
5252
}
5353
}
54-

FirebaseSwiftUI/FirebaseAppleSwiftUI/Tests/FirebaseAppleSwiftUITests/FirebaseAppleSwiftUITests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ import Testing
1818
@Test func example() async throws {
1919
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
2020
}
21-

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Auth/MultiFactor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct EnrollmentSession {
5757
public let expiresAt: Date
5858

5959
// Internal handle to finish TOTP
60-
internal let _totpSecret: AnyObject?
60+
let _totpSecret: AnyObject?
6161

6262
public enum EnrollmentStatus {
6363
case initiated
@@ -111,4 +111,4 @@ public struct MFARequired {
111111
public init(hints: [MFAHint]) {
112112
self.hints = hints
113113
}
114-
}
114+
}

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/AuthServiceError.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public enum AuthServiceError: LocalizedError {
3939
case invalidPhoneAuthenticationArguments(String)
4040
case providerNotFound(String)
4141
case multiFactorAuth(String)
42-
4342

4443
public var errorDescription: String? {
4544
switch self {
@@ -62,7 +61,7 @@ public enum AuthServiceError: LocalizedError {
6261
case let .providerNotFound(description):
6362
return description
6463
case let .invalidPhoneAuthenticationArguments(description):
65-
return description
64+
return description
6665
case let .multiFactorAuth(description):
6766
return description
6867
}

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services/AuthConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public struct AuthConfiguration {
2525
public let emailLinkSignInActionCodeSettings: ActionCodeSettings?
2626
public let verifyEmailActionCodeSettings: ActionCodeSettings?
2727

28-
// MARK: - MFA Configuration
28+
// MARK: - MFA Configuration
2929

3030
public let mfaEnabled: Bool
3131
public let allowedSecondFactors: Set<SecondFactorType>

0 commit comments

Comments
 (0)