Skip to content

Commit

Permalink
[auth-swift] Fix a few decode runtime analyze issues
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Dec 29, 2023
1 parent 9a7b79d commit 9c6392b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ import Foundation
as? String {
credentialKind = .verification(verificationID, verificationCode)
super.init(provider: PhoneAuthProvider.id)
} else if let temporaryProof = coder.decodeObject(forKey: "temporaryProof") as? String,
let phoneNumber = coder.decodeObject(forKey: "phoneNumber") as? String {
credentialKind = .phoneNumber(phoneNumber, temporaryProof)
} else if let temporaryProof = coder.decodeObject(of: NSString.self, forKey: "temporaryProof"),
let phoneNumber = coder.decodeObject(of: NSString.self, forKey: "phoneNumber") {
credentialKind = .phoneNumber(phoneNumber as String, temporaryProof as String)
super.init(provider: PhoneAuthProvider.id)
} else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ import Foundation
override public class var supportsSecureCoding: Bool { return secureCodingWorkaround }

public required init?(coder: NSCoder) {
guard let phoneNumber = coder.decodeObject(forKey: kPhoneNumberCodingKey) as? NSString else {
guard let phoneNumber = coder.decodeObject(of: NSString.self,
forKey: kPhoneNumberCodingKey) else {
return nil
}
self.phoneNumber = phoneNumber as String
Expand Down

0 comments on commit 9c6392b

Please sign in to comment.