modify clear data modal with error

pull/1023/head
Ryan ZHAO 7 months ago
parent ca8344db06
commit c3b5925f78

@ -205,33 +205,33 @@ final class NukeDataModal: Modal {
case .failure(let error): case .failure(let error):
self?.dismiss(animated: true, completion: nil) // Dismiss the loader self?.dismiss(animated: true, completion: nil) // Dismiss the loader
switch error { switch error {
case NetworkError.timeout, NetworkError.gatewayTimeout: case NetworkError.timeout, NetworkError.gatewayTimeout:
let modal: ConfirmationModal = ConfirmationModal( let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view, targetView: self?.view,
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "clearDataAll".localized(), title: "clearDataError".localized(),
body: .text("clearDataErrorDescriptionGeneric".localized()), body: .text("clearDataErrorDescriptionGeneric".localized()),
confirmTitle: "clear".localized(), confirmTitle: "clearDeviceOnly".localized(),
confirmStyle: .danger, confirmStyle: .danger,
cancelStyle: .alert_text cancelStyle: .alert_text
) { [weak self] _ in ) { [weak self] _ in
self?.clearDeviceOnly() 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)
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)
} }
} }
}, },
@ -249,21 +249,17 @@ final class NukeDataModal: Modal {
return return
} }
// Otherwise we should warn the user that one or more service node
// failed to delete the data
let message: String = "clearDataErrorDescription"
.putNumber(potentiallyMaliciousSnodes.count)
.put(key: "service_node_id", value: potentiallyMaliciousSnodes.joined(separator: ", "))
.localized()
let modal: ConfirmationModal = ConfirmationModal( let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view, targetView: self?.view,
info: ConfirmationModal.Info( info: ConfirmationModal.Info(
title: "clearDataError".localized(), title: "clearDataError".localized(),
body: .text(message), body: .text("clearDataErrorDescriptionGeneric".localized()),
cancelTitle: "okay".localized(), confirmTitle: "clearDeviceOnly".localized(),
confirmStyle: .danger,
cancelStyle: .alert_text cancelStyle: .alert_text
) ) { [weak self] _ in
self?.clearDeviceOnly()
}
) )
self?.present(modal, animated: true) self?.present(modal, animated: true)
} }

Loading…
Cancel
Save