Self-maintained passcode lock

- No cancel button anywhere in the passcode lock yet
- Poor UI
This commit is contained in:
Yishi Lin 2018-01-29 03:23:34 +08:00
parent 30ae08bed5
commit da3c4f0bc0
10 changed files with 298 additions and 210 deletions

View file

@ -1,28 +1,24 @@
//
// PasscodeRepository.swift
// pass
// PasscodeLock.swift
// PassKit
//
// Created by Mingshen Sun on 7/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
// Created by Yishi Lin on 28/1/2018.
// Copyright © 2017 Yishi Lin. All rights reserved.
//
import Foundation
import PasscodeLock
import LocalAuthentication
public class PasscodeLockRepository: PasscodeRepositoryType {
private let passcodeKey = "passcode.lock.passcode"
open class PasscodeLock {
public static let shared = PasscodeLock()
public var hasPasscode: Bool {
if passcode != nil {
return true
}
return false
fileprivate let passcodeKey = "passcode.lock.passcode"
fileprivate var passcode: String? {
return SharedDefaults[.passcodeKey]
}
private var passcode: String? {
return SharedDefaults[.passcodeKey]
public var hasPasscode: Bool {
return passcode != nil
}
public func save(passcode: String) {

View file

@ -1,26 +0,0 @@
//
// PasscodeLockConfiguration.swift
// pass
//
// Created by Mingshen Sun on 7/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import Foundation
import PasscodeLock
public class PasscodeLockConfiguration: PasscodeLockConfigurationType {
public static let shared = PasscodeLockConfiguration()
public let repository: PasscodeRepositoryType
public let passcodeLength = 4
public var isTouchIDAllowed = SharedDefaults[.isTouchIDOn]
public let shouldRequestTouchIDImmediately = true
public let maximumInccorectPasscodeAttempts = 3
init() {
self.repository = PasscodeLockRepository()
}
}