mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-25 07:42:15 +00:00
ios: remove passcodes if app was reinstalled (#3841)
* ios: remove passwords if app was reinstalled
* change instead of delete
* Revert "change instead of delete"
This reverts commit 1195ee5b30.
* update name and comments
---------
Co-authored-by: Avently <avently@local>
Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
committed by
GitHub
parent
7213913d51
commit
8ac7677648
@@ -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)
|
||||
removePasscodesIfReinstalled()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -127,6 +128,19 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
||||
BGManager.shared.receiveMessages(complete)
|
||||
}
|
||||
|
||||
private func removePasscodesIfReinstalled() {
|
||||
// Check for the database existence, because app and self destruct passcodes
|
||||
// will be saved and restored by iOS when a user deletes and re-installs the app.
|
||||
// In this case the database and settings will be deleted, but the passcodes won't be.
|
||||
// Deleting passcodes ensures that the user will not get stuck on "Opening app..." screen.
|
||||
if (kcAppPassword.get() != nil || kcSelfDestructPassword.get() != nil) &&
|
||||
!UserDefaults.standard.bool(forKey: DEFAULT_PERFORM_LA) && !hasDatabase() {
|
||||
_ = kcAppPassword.remove()
|
||||
_ = kcSelfDestructPassword.remove()
|
||||
_ = kcDatabasePassword.remove()
|
||||
}
|
||||
}
|
||||
|
||||
static func keepScreenOn(_ on: Bool) {
|
||||
UIApplication.shared.isIdleTimerDisabled = on
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user