diff --git a/Tusker/Views/Poll/StatusPollView.swift b/Tusker/Views/Poll/StatusPollView.swift index c991e35a..484d7754 100644 --- a/Tusker/Views/Poll/StatusPollView.swift +++ b/Tusker/Views/Poll/StatusPollView.swift @@ -21,6 +21,7 @@ class StatusPollView: UIView { }() weak var mastodonController: MastodonController! + weak var toastableViewController: ToastableViewController? private var statusID: String! private(set) var poll: Poll? @@ -151,7 +152,14 @@ class StatusPollView: UIView { mastodonController.run(request) { (response) in switch response { case let .failure(error): - fatalError("error voting in poll: \(error)") + DispatchQueue.main.async { + self.updateUI(status: self.mastodonController.persistentContainer.status(for: self.statusID)!, poll: self.poll) + + if let toastable = self.toastableViewController { + let config = ToastConfiguration(from: error, with: "Error Voting", in: toastable, retryAction: nil) + toastable.showToast(configuration: config, animated: true) + } + } case let .success(poll, _): let container = self.mastodonController.persistentContainer diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index 5a8d8ce4..f25841e5 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -211,6 +211,7 @@ class BaseStatusTableViewCell: UITableViewCell { pollView.isHidden = status.poll == nil pollView.mastodonController = mastodonController + pollView.toastableViewController = delegate?.toastableViewController pollView.updateUI(status: status, poll: status.poll) }