Add Session ID change notice
This commit is contained in:
parent
efe8f1c8bb
commit
5b240da619
|
@ -20,4 +20,9 @@ enum KeyPairUtilities {
|
|||
dbConnection.setObject(ed25519KeyPair.publicKey.toHexString(), forKey: LKED25519PublicKey, inCollection: collection)
|
||||
dbConnection.setObject(x25519KeyPair, forKey: OWSPrimaryStorageIdentityKeyStoreIdentityKey, inCollection: collection)
|
||||
}
|
||||
|
||||
static func hasV2KeyPair() -> Bool {
|
||||
let dbConnection = OWSIdentityManager.shared().dbConnection
|
||||
return (dbConnection.object(forKey: LKED25519SecretKey, inCollection: OWSPrimaryStorageIdentityKeyStoreCollection) != nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,19 @@ final class NukeDataModal : Modal {
|
|||
|
||||
// MARK: Interaction
|
||||
@objc private func nuke() {
|
||||
func proceed() {
|
||||
UserDefaults.removeAll() // Not done in the nuke data implementation as unlinking requires this to happen later
|
||||
NotificationCenter.default.post(name: .dataNukeRequested, object: nil)
|
||||
}
|
||||
if KeyPairUtilities.hasV2KeyPair() {
|
||||
proceed()
|
||||
} else {
|
||||
presentingViewController?.dismiss(animated: true, completion: nil)
|
||||
let message = "We've upgraded the way Session IDs are generated, so your Session ID will be different if you choose to restore your account."
|
||||
let alert = UIAlertController(title: "Are You Sure?", message: message, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "Yes", style: .destructive) { _ in proceed() })
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: nil))
|
||||
presentingViewController?.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue