Updates older ToastView code to use error initializer

This commit is contained in:
Riley Testut
2020-03-30 14:07:18 -07:00
parent 4d75116c2d
commit 162139d52b
5 changed files with 27 additions and 21 deletions

View File

@@ -106,12 +106,14 @@ private extension AuthenticationViewController
self.signInButton.isIndicatingActivity = false
}
case .failure(let error):
case .failure(let error as NSError):
DispatchQueue.main.async {
let toastView = ToastView(text: NSLocalizedString("Failed to Log In", comment: ""), detailText: error.localizedDescription)
let error = error.withLocalizedFailure(NSLocalizedString("Failed to Log In", comment: ""))
let toastView = ToastView(error: error)
toastView.textLabel.textColor = .altPink
toastView.detailTextLabel.textColor = .altPink
toastView.show(in: self.navigationController?.view ?? self.view)
toastView.show(in: self)
self.toastView = toastView
self.signInButton.isIndicatingActivity = false