do not dismiss views when application is resumed (#605)

* do not dismiss views when application is resumed

* prevents the PasswordNavigationViewController and PasswordDetailTableViewController from being dismissed when the app is put to the background and then brought back to the foreground
* Instead, the PasswordEntities are re-fetched from the context by their path to handle the re-creation of the entities during an update process that could have run in the background

* update SwiftLint to version 0.50.*

* update SwiftFormat to 0.51.*

---------

Co-authored-by: Mingshen Sun <bob@mssun.me>
This commit is contained in:
Dominik Johs 2023-03-10 06:33:19 +01:00 committed by GitHub
parent 83c6ae33dc
commit f2a0c4ccf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 26 deletions

View file

@ -191,8 +191,8 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
let myContext = LAContext()
// If the device passcode is not set, reset the app.
guard myContext.canEvaluatePolicy(.deviceOwnerAuthentication, error: nil) else {
self.passwordStore.erase()
self.passcodeLockDidSucceed()
passwordStore.erase()
passcodeLockDidSucceed()
return
}
// If the device passcode is set, authentication is required.

View file

@ -77,14 +77,14 @@ public struct GitCredential {
private func createCredentialProvider(_ passwordProvider: @escaping PasswordProvider) -> GTCredentialProvider {
var attempts = 1
return GTCredentialProvider { _, _, _ -> GTCredential? in
if attempts > self.credentialType.allowedAttempts {
if attempts > credentialType.allowedAttempts {
return nil
}
guard let password = self.getPassword(attempts: attempts, passwordProvider: passwordProvider) else {
guard let password = getPassword(attempts: attempts, passwordProvider: passwordProvider) else {
return nil
}
attempts += 1
return try? self.credentialType.createGTCredential(password: password)
return try? credentialType.createGTCredential(password: password)
}
}