Device Verification: Display the "The other party cancelled the verification." modal

This commit is contained in:
manuroe
2019-04-11 19:38:46 +02:00
parent 8e770cdb67
commit 69dcd25c8d
8 changed files with 38 additions and 10 deletions
@@ -175,7 +175,11 @@ final class DeviceVerificationVerifyViewController: UIViewController {
}
private func renderCancelled(reason: MXTransactionCancelCode) {
// TODO
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
self.errorPresenter.presentError(from: self, title: "", message: VectorL10n.deviceVerificationCancelled, animated: true) {
self.viewModel.process(viewAction: .cancel)
}
}
private func renderCancelledByMe(reason: MXTransactionCancelCode) {
@@ -66,21 +66,26 @@ final class DeviceVerificationVerifyViewModel: DeviceVerificationVerifyViewModel
func process(viewAction: DeviceVerificationVerifyViewAction) {
switch viewAction {
case .confirm:
self.confirm()
self.confirmTransaction()
case .complete:
self.coordinatorDelegate?.deviceVerificationVerifyViewModelDidComplete(self)
case .cancel:
self.cancelTransaction()
self.coordinatorDelegate?.deviceVerificationVerifyViewModelDidCancel(self)
}
}
// MARK: - Private
private func confirm() {
private func confirmTransaction() {
self.update(viewState: .loading)
self.transaction.confirmSASMatch()
}
private func cancelTransaction() {
self.transaction.cancel(with: MXTransactionCancelCode.user())
}
private func update(viewState: DeviceVerificationVerifyViewState) {
self.viewDelegate?.deviceVerificationVerifyViewModel(self, didUpdateViewState: viewState)