Merge pull request #3 from scoreyou/fix/dateFormatter
Fix/date formatter
This commit is contained in:
commit
3e904e30fe
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ open class BaseUserService {
|
|||
open class func clearData() {
|
||||
UserDefaults.standard.sessionId = nil
|
||||
UserDefaults.standard.userLogin = nil
|
||||
UserDefaults.standard.synchronize()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ import RxAlamofire
|
|||
|
||||
open class SimpleNetworkService: DefaultNetworkService {
|
||||
|
||||
// Singleton
|
||||
static let shared = SimpleNetworkService()
|
||||
|
||||
public convenience init() {
|
||||
self.init(sessionManager: SimpleNetworkService.sessionManager)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public class TouchIDService {
|
|||
return LAContext()
|
||||
}()
|
||||
|
||||
public init() {}
|
||||
|
||||
public var canAuthenticateByTouchId: Bool {
|
||||
return laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue