mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-19 20:26:11 +00:00
ios: remove passwords if app was reinstalled
This commit is contained in:
@@ -16,6 +16,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
application.registerForRemoteNotifications()
|
||||
if #available(iOS 17.0, *) { trackKeyboard() }
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(pasteboardChanged), name: UIPasteboard.changedNotification, object: nil)
|
||||
removePasswordsIfReinstalled()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -127,6 +128,17 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
BGManager.shared.receiveMessages(complete)
|
||||
}
|
||||
|
||||
private func removePasswordsIfReinstalled() {
|
||||
// check for database existence is needed because app password and self destruct password will be saved and restored
|
||||
// by iOS when a user deletes the app and installs it again. In this case database will be deleted but passwords are not.
|
||||
// This check ensures that the user will not stack on "Opening app..." screen
|
||||
if (kcAppPassword.get() != nil || kcSelfDestructPassword.get() != nil) && !UserDefaults.standard.bool(forKey: DEFAULT_PERFORM_LA) && !(hasDatabase() || hasLegacyDatabase()) {
|
||||
_ = kcAppPassword.remove()
|
||||
_ = kcSelfDestructPassword.remove()
|
||||
_ = kcDatabasePassword.remove()
|
||||
}
|
||||
}
|
||||
|
||||
static func keepScreenOn(_ on: Bool) {
|
||||
UIApplication.shared.isIdleTimerDisabled = on
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user