Merge pull request #3 from scoreyou/fix/dateFormatter

Fix/date formatter
This commit is contained in:
Nikolai Ashanin 2017-04-26 20:19:14 +03:00 committed by GitHub
commit 3e904e30fe
7 changed files with 21 additions and 17 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LeadKitAdditions"
s.version = "0.0.5"
s.version = "0.0.6"
s.summary = "iOS framework with a bunch of tools for rapid development"
s.homepage = "https://github.com/NikAshanin/LeadKitAdditions"
s.license = "Apache License, Version 2.0"

View File

@ -33,40 +33,44 @@ open class BaseDateFormatter {
private static let apiFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale.current
dateFormatter.locale = usedLocale
dateFormatter.dateFormat = BaseDateFormatter.apiDateTimeFormat
return dateFormatter
}()
private static let apiDateWithoutTimeFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale.current
dateFormatter.locale = usedLocale
dateFormatter.dateFormat = BaseDateFormatter.apiDateWithoutTimeFormat
return dateFormatter
}()
private static let hourAndMinuteFormatter: DateFormatter = {
let dateFormater = DateFormatter()
dateFormater.locale = Locale.current
dateFormater.locale = usedLocale
dateFormater.dateFormat = BaseDateFormatter.hourAndMinuteDateTimeFormat
return dateFormater
}()
private static let dayAndMonthFormatter: DateFormatter = {
let dateFormater = DateFormatter()
dateFormater.locale = Locale.current
dateFormater.locale = usedLocale
dateFormater.dateFormat = BaseDateFormatter.dayAndMonthDateTimeFormat
return dateFormater
}()
private static let dayMonthYearFormatter: DateFormatter = {
let dateFormater = DateFormatter()
dateFormater.locale = Locale.current
dateFormater.locale = usedLocale
dateFormater.dateFormat = BaseDateFormatter.dayMonthYearDateTimeFormat
return dateFormater
}()
// MARK: Internal functions
// MARK: Public interface
open class var usedLocale: Locale {
return .current
}
public static func backendDate(fromStrDate strDate: String) -> Date? {
return BaseDateFormatter.apiFormatter.date(from: strDate)

View File

@ -50,7 +50,7 @@ open class BasePassCodeViewController: UIViewController {
@IBOutlet public weak var errorLabel: UILabel?
@IBOutlet public weak var dotStackView: UIStackView!
let disposeBag = DisposeBag()
public let disposeBag = DisposeBag()
fileprivate lazy var fakeTextField: UITextField = {
let fakeTextField = UITextField()
@ -159,19 +159,19 @@ open class BasePassCodeViewController: UIViewController {
}
// override to change Images
func imageFor(type: PinImageType) -> UIImage {
open func imageFor(type: PinImageType) -> UIImage {
assertionFailure("You should override this method: imageFor(type: PinImageType)")
return UIImage()
}
// override to change error text
func errorDescription(for error: PassCodeError) -> String {
open func errorDescription(for error: PassCodeError) -> String {
assertionFailure("You should override this method: errorDescription(for error: PassCodeError)")
return ""
}
// override to change action title text
func actionTitle(for passCodeControllerState: PassCodeControllerState) -> String {
open func actionTitle(for passCodeControllerState: PassCodeControllerState) -> String {
assertionFailure("You should override this method: actionTitle(for passCodeControllerState: PassCodeControllerState)")
return ""
}

View File

@ -56,9 +56,9 @@ open class BasePassCodeViewModel: BaseViewModel {
return PassCodeHolderBuilder.build(with: self.controllerType)
}()
init(controllerType: PassCodeControllerType,
passCodeConfiguration: PassCodeConfiguration,
touchIdService: TouchIDService? = nil) {
public init(controllerType: PassCodeControllerType,
passCodeConfiguration: PassCodeConfiguration,
touchIdService: TouchIDService? = nil) {
self.controllerType = controllerType
self.passCodeConfiguration = passCodeConfiguration

View File

@ -53,6 +53,7 @@ open class BaseUserService {
open class func clearData() {
UserDefaults.standard.sessionId = nil
UserDefaults.standard.userLogin = nil
UserDefaults.standard.synchronize()
}
}

View File

@ -29,9 +29,6 @@ import RxAlamofire
open class SimpleNetworkService: DefaultNetworkService {
// Singleton
static let shared = SimpleNetworkService()
public convenience init() {
self.init(sessionManager: SimpleNetworkService.sessionManager)
}

View File

@ -30,6 +30,8 @@ public class TouchIDService {
return LAContext()
}()
public init() {}
public var canAuthenticateByTouchId: Bool {
return laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
}