File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
# 11.1.0
2
+ - [ fixed] Fixed ` Swift.error ` conformance for ` AuthErrorCode ` . (#13430 )
2
3
- [ added] Added custom provider support to ` AuthProviderID ` . Note that this change will be breaking
3
4
to any code that implemented an exhaustive ` switch ` on ` AuthProviderID ` in 11.0.0 - the ` switch `
4
5
will need expansion. (#13429 )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ import Foundation
48
48
}
49
49
50
50
/// Error codes used by Firebase Auth.
51
- @objc ( FIRAuthErrorCode) public enum AuthErrorCode : Int {
51
+ @objc ( FIRAuthErrorCode) public enum AuthErrorCode : Int , Error {
52
52
/// Indicates a validation error with the custom token.
53
53
case invalidCustomToken = 17000
54
54
@@ -537,6 +537,12 @@ import Foundation
537
537
}
538
538
}
539
539
540
+ /// The error code. It's redundant but implemented for compatibility with the Objective-C
541
+ /// implementation.
542
+ public var code : Self {
543
+ return self
544
+ }
545
+
540
546
var errorCodeString : String {
541
547
switch self {
542
548
case . invalidCustomToken:
Original file line number Diff line number Diff line change @@ -725,4 +725,22 @@ class AuthAPI_hOnlyTests: XCTestCase {
725
725
return 9
726
726
}
727
727
}
728
+
729
+ func regression13430( error: NSError ) -> Int {
730
+ if let firebaseError = error as? AuthErrorCode , firebaseError == . networkError {
731
+ return 1
732
+ }
733
+
734
+ if let firebaseError = error as? AuthErrorCode , firebaseError. code == . invalidPhoneNumber {
735
+ switch firebaseError. localizedDescription {
736
+ case " TOO_SHORT " :
737
+ return 1
738
+ case " TOO_LONG " :
739
+ return 1
740
+ default :
741
+ return 1
742
+ }
743
+ }
744
+ return 2
745
+ }
728
746
}
You can’t perform that action at this time.
0 commit comments