Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Fix: TouchID prompt on second install #273

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sa-mao
Copy link
Contributor

@sa-mao sa-mao commented Aug 1, 2019

If merged this will fix this issue #272

@sa-mao sa-mao requested a review from aliak00 as a code owner August 1, 2019 13:06
@@ -8,6 +8,7 @@ import UIKit

private struct Constants {
static let BiometricsSecretsLabel = "com.schibsted.account.biometrics.secrets"
static let HasLoggedInBeforeSettingsKey = "hasLoggedInBefore"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe follow the pattern: "com.schibsted.account.hasLoggedInBefore"

@@ -8,6 +8,7 @@ import UIKit

private struct Constants {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add: private init() { } to avoid possibility to create an instance of Constants

@@ -241,6 +242,11 @@ extension PasswordCoordinator {
// Fallback to passsword login
return nil
}

let hasLoggedInBefore = Settings.value(forKey: Constants.HasLoggedInBeforeSettingsKey) as? Bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guard let hasLoggedInBefore = Settings.value(forKey: Constants.HasLoggedInBeforeSettingsKey) as? Bool else { return nil }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also join with the previous guard
guard #available(iOS 11.3, *) else {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this prevent users from reusing password after app upgrade?

Copy link
Collaborator

@minarikg minarikg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid users to be logged out automatically

@@ -253,6 +258,7 @@ extension PasswordCoordinator {
if status == noErr, let qresult = queryResult as? Data, let password = String(data: qresult as Data, encoding: .utf8) {
return password
} else {
Settings.setValue(false, forKey: Constants.HasLoggedInBeforeSettingsKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to set it to false here? A missing value for the key Constants.HasLoggedInBeforeSettingsKey is treated the same as it having the value false in all cases, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I prefer to be explicit here.

@zamzterz
Copy link
Contributor

Since Apple keeps the data stored in the keychain even if the app is uninstalled, could we just keep using it without prompting for consent again on re-install?
@idanor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants