add timeout error modal for clearing data from network

pull/1023/head
Ryan ZHAO 8 months ago
parent 3a509d942e
commit 1b73f74fb7

@ -204,17 +204,35 @@ final class NukeDataModal: Modal {
case .finished: break
case .failure(let error):
self?.dismiss(animated: true, completion: nil) // Dismiss the loader
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "clearDataError".localized(),
body: .text("\(error)"),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
switch error {
case NetworkError.timeout, NetworkError.gatewayTimeout:
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "clearDataAll".localized(),
body: .text("clearDataErrorDescriptionGeneric".localized()),
confirmTitle: "clear".localized(),
confirmStyle: .danger,
cancelStyle: .alert_text
) { [weak self] _ in
self?.clearDeviceOnly()
}
)
self?.present(modal, animated: true)
default:
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "clearDataError".localized(),
body: .text("\(error)"),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)
)
)
self?.present(modal, animated: true)
self?.present(modal, animated: true)
}
}
},
receiveValue: { confirmations in

Loading…
Cancel
Save