Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add localized interval string
  • Loading branch information
iamStephenFang committed Jul 16, 2022
commit f8e580607af611fb26fa2c7873e9464f8b4949ea
8 changes: 7 additions & 1 deletion PasscodeKit/Sources/PasscodeKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,16 @@ extension PasscodeKit {
}

//-------------------------------------------------------------------------------------------------------------------------------------------
public class func verifiedTimeInterval() -> TimeInterval {
public class func passcodeLocalizedInterval() -> String {
return PasscodeInterval.allCases.first(where: { $0.rawValue == PasscodeKit.passcodeInterval()})?.localizedDescription ?? PasscodeKit.vefifyPasscodeImmediately
}

//-------------------------------------------------------------------------------------------------------------------------------------------
public class func verifiedTimeInterval() -> Double {
return UserDefaults.standard.double(forKey: "PasscodeVerifiedInterval")
}


//-------------------------------------------------------------------------------------------------------------------------------------------
public class func verifiedTimeInterval(_ date: Date) {
UserDefaults.standard.set(date.timeIntervalSince1970, forKey: "PasscodeVerifiedInterval")
Expand Down
2 changes: 1 addition & 1 deletion PasscodeKit/app/PasscodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class PasscodeView: UIViewController {
cellInterval.textLabel?.textColor = UIColor.lightGray
}

cellInterval.detailTextLabel?.text = PasscodeInterval.allCases.first(where: { $0.rawValue == PasscodeKit.passcodeInterval()})?.localizedDescription
cellInterval.detailTextLabel?.text = PasscodeKit.passcodeLocalizedInterval()

switchBiometric.isOn = PasscodeKit.biometric()

Expand Down