fix a clear data modal

pull/1023/head
Ryan ZHAO 7 months ago
parent 39efcc4d2b
commit ce8c6bd971

@ -7764,6 +7764,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 479;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -7835,6 +7836,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 479;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",

@ -164,22 +164,6 @@ final class NukeDataModal: Modal {
}
}
private func unknownErrorOccured() {
let modal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info(
title: "clearDataAll".localized(),
body: .text("clearDataErrorDescriptionGeneric".localized()),
confirmTitle: "clear".localized(),
confirmStyle: .danger,
cancelStyle: .alert_text,
dismissOnConfirm: false
) { [weak self] confirmationModal in
self?.clearDeviceOnly()
}
)
present(modal, animated: true)
}
private func clearEntireAccount(presentedViewController: UIViewController) {
let dependencies: Dependencies = Dependencies()
@ -239,26 +223,37 @@ final class NukeDataModal: Modal {
let potentiallyMaliciousSnodes = confirmations
.compactMap { ($0.value == false ? $0.key : nil) }
guard !potentiallyMaliciousSnodes.isEmpty else {
self?.unknownErrorOccured()
return
}
let message: String = "clearDataErrorDescription"
.putNumber(potentiallyMaliciousSnodes.count)
.put(key: "service_node_id", value: potentiallyMaliciousSnodes.joined(separator: ", "))
.localized()
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "clearDataError".localized(),
body: .text(message),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
if potentiallyMaliciousSnodes.isEmpty {
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)
} else {
let message: String = "clearDataErrorDescription"
.putNumber(potentiallyMaliciousSnodes.count)
.put(key: "service_node_id", value: potentiallyMaliciousSnodes.joined(separator: ", "))
.localized()
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "clearDataError".localized(),
body: .text(message),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)
)
)
self?.present(modal, animated: true)
self?.present(modal, animated: true)
}
}
)
}

Loading…
Cancel
Save