update swiftlint lint rules, podspec and changelog
This commit is contained in:
parent
3d17f139c3
commit
0c2acda3c6
|
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
### 0.3.11
|
||||
- **Add**: Carthage support.
|
||||
- **[Breaking change]**: Remove `BaseDateFormatter`. Use `NumberFormattingService` from LeadKit instead.
|
||||
|
||||
### 0.3.10
|
||||
|
||||
- **[Breaking change]**: Remove `isTouchIdSupported` and `isFaceIdSupported`.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "LeadKitAdditions"
|
||||
s.version = "0.3.10"
|
||||
s.version = "0.3.11"
|
||||
s.summary = "iOS framework with a bunch of tools for rapid development"
|
||||
s.homepage = "https://github.com/TouchInstinct/LeadKitAdditions"
|
||||
s.license = "Apache License, Version 2.0"
|
||||
|
|
@ -12,10 +12,6 @@ Pod::Spec.new do |s|
|
|||
ss.ios.deployment_target = '9.0'
|
||||
ss.source_files = "Sources/**/*.swift"
|
||||
|
||||
ss.exclude_files = [
|
||||
"Sources/Services/Network/DefaultNetworkService+ActivityIndicator+Extension.swift",
|
||||
]
|
||||
|
||||
ss.dependency "LeadKit", '~> 0.9.0'
|
||||
ss.dependency "KeychainAccess", '3.1.0'
|
||||
ss.dependency "CryptoSwift", '~> 0.9.0'
|
||||
|
|
@ -23,24 +19,6 @@ Pod::Spec.new do |s|
|
|||
ss.dependency "PinLayout", '~> 1.6'
|
||||
end
|
||||
|
||||
s.subspec 'Core-iOS-Extension' do |ss|
|
||||
ss.platform = :ios, '9.0'
|
||||
ss.source_files = "Sources/**/*.swift"
|
||||
|
||||
ss.exclude_files = [
|
||||
"Sources/Classes/Cells/LabelTableViewCell/*.swift",
|
||||
"Sources/Services/Network/DefaultNetworkService+ActivityIndicator.swift",
|
||||
"Sources/Extensions/Cells/**/*.swift",
|
||||
"Sources/Controllers/Passcode/**/*.swift"
|
||||
]
|
||||
|
||||
ss.dependency "LeadKit/Core-iOS-Extension", '~> 0.9.0'
|
||||
ss.dependency "KeychainAccess", '3.1.0'
|
||||
ss.dependency "CryptoSwift", '~> 0.9.0'
|
||||
ss.dependency "SwiftValidator", '4.0.2'
|
||||
ss.dependency "PinLayout", '~> 1.6'
|
||||
end
|
||||
|
||||
s.default_subspec = 'Core'
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
786CBB3B220DD7A70017587F /* PinLayout.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 786CBB2E220DD7A70017587F /* PinLayout.framework */; };
|
||||
A6CFB8D91F5024A500A42CC2 /* Error+NetworkingExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */; };
|
||||
CAE698E81E968820000394B0 /* LeadKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE698E61E968820000394B0 /* LeadKitAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
ED0C34051F2906EC00FAE9FD /* BaseDateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */; };
|
||||
ED0C34071F2906EC00FAE9FD /* LoadingBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */; };
|
||||
ED0C34091F2906EC00FAE9FD /* PassCodeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33D91F2906EC00FAE9FD /* PassCodeConfiguration.swift */; };
|
||||
ED0C340B1F2906EC00FAE9FD /* PassCodeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C33DA1F2906EC00FAE9FD /* PassCodeError.swift */; };
|
||||
|
|
@ -85,7 +84,6 @@
|
|||
A6CFB8D81F5024A500A42CC2 /* Error+NetworkingExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Error+NetworkingExtensions.swift"; sourceTree = "<group>"; };
|
||||
CAE698E31E968820000394B0 /* LeadKitAdditions.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LeadKitAdditions.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
CAE698E61E968820000394B0 /* LeadKitAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LeadKitAdditions.h; sourceTree = "<group>"; };
|
||||
ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseDateFormatter.swift; sourceTree = "<group>"; };
|
||||
ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingBarButton.swift; sourceTree = "<group>"; };
|
||||
ED0C33D91F2906EC00FAE9FD /* PassCodeConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassCodeConfiguration.swift; sourceTree = "<group>"; };
|
||||
ED0C33DA1F2906EC00FAE9FD /* PassCodeError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassCodeError.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -240,7 +238,6 @@
|
|||
children = (
|
||||
67528BCB206E3C12009F2525 /* Cells */,
|
||||
67B4E6F0206945D200E233EA /* BaseTextFieldViewModel */,
|
||||
ED0C33D41F2906EC00FAE9FD /* BaseDateFormatter.swift */,
|
||||
ED0C33D51F2906EC00FAE9FD /* LoadingBarButton.swift */,
|
||||
);
|
||||
path = Classes;
|
||||
|
|
@ -426,7 +423,7 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "swiftlint autocorrect --path Sources --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml && swiftlint --path Sources --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml\n";
|
||||
shellScript = "CONFIG_PATH=${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml\n\nif which swiftlint >/dev/null; then\nswiftlint autocorrect --path Sources --config ${CONFIG_PATH} && swiftlint --path Sources --config ${CONFIG_PATH}\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
|
@ -460,7 +457,6 @@
|
|||
6760AF1A207268EC00C2BB7E /* PinLayoutCell+DefaultImplementation.swift in Sources */,
|
||||
ED0C34211F2906EC00FAE9FD /* UserDefaults+UserService.swift in Sources */,
|
||||
ED0C34111F2906EC00FAE9FD /* PassCodeValidationResult.swift in Sources */,
|
||||
ED0C34051F2906EC00FAE9FD /* BaseDateFormatter.swift in Sources */,
|
||||
ED0C34431F2906EC00FAE9FD /* ValidationService.swift in Sources */,
|
||||
ED0C340B1F2906EC00FAE9FD /* PassCodeError.swift in Sources */,
|
||||
67B4E6F6206945DD00E233EA /* OnlineValidationResult.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -1,107 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Base date formatter class, contains most frequently used formats, including RFC3339
|
||||
open class BaseDateFormatter {
|
||||
|
||||
private static let apiDateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
|
||||
private static let apiDateWithoutTimeFormat = "yyyy-MM-dd'T'Z"
|
||||
private static let hourAndMinuteDateTimeFormat = "HH:mm"
|
||||
private static let dayAndMonthDateTimeFormat = "dd MMM"
|
||||
private static let dayMonthYearDateTimeFormat = "dd.MM.yyyy"
|
||||
|
||||
private static let apiFormatter: DateFormatter = {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = apiDateTimeFormat
|
||||
return dateFormatter
|
||||
}()
|
||||
|
||||
private static let apiDateWithoutTimeFormatter: DateFormatter = {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = apiDateWithoutTimeFormat
|
||||
return dateFormatter
|
||||
}()
|
||||
|
||||
private static let hourAndMinuteFormatter: DateFormatter = {
|
||||
let dateFormater = DateFormatter()
|
||||
dateFormater.dateFormat = hourAndMinuteDateTimeFormat
|
||||
return dateFormater
|
||||
}()
|
||||
|
||||
private static let dayAndMonthFormatter: DateFormatter = {
|
||||
let dateFormater = DateFormatter()
|
||||
dateFormater.dateFormat = dayAndMonthDateTimeFormat
|
||||
return dateFormater
|
||||
}()
|
||||
|
||||
private static let dayMonthYearFormatter: DateFormatter = {
|
||||
let dateFormater = DateFormatter()
|
||||
dateFormater.dateFormat = dayMonthYearDateTimeFormat
|
||||
return dateFormater
|
||||
}()
|
||||
|
||||
// MARK: - Public interface
|
||||
|
||||
/// DateFormatter's locale can be overriden
|
||||
open class var usedLocale: Locale {
|
||||
return .current
|
||||
}
|
||||
|
||||
/// Parse date from string with format: yyyy-MM-dd'T'HH:mm:ssZ
|
||||
public static func backendDate(fromStrDate strDate: String) -> Date? {
|
||||
apiFormatter.locale = usedLocale
|
||||
return apiFormatter.date(from: strDate)
|
||||
}
|
||||
|
||||
/// Serialize date into string with format: yyyy-MM-dd'T'HH:mm:ssZ
|
||||
public static func backendStrDate(withDate date: Date) -> String {
|
||||
apiFormatter.locale = usedLocale
|
||||
return apiFormatter.string(from: date)
|
||||
}
|
||||
|
||||
/// Serialize date into string with format: yyyy-MM-dd'T'Z
|
||||
public static func backendDateWithoutTime(withDate date: Date) -> String {
|
||||
apiDateWithoutTimeFormatter.locale = usedLocale
|
||||
return apiDateWithoutTimeFormatter.string(from: date)
|
||||
}
|
||||
|
||||
/// Serialize date into string with format: HH:mm
|
||||
public static func hourAndMinuteStrDate(withDate date: Date) -> String {
|
||||
hourAndMinuteFormatter.locale = usedLocale
|
||||
return hourAndMinuteFormatter.string(from: date)
|
||||
}
|
||||
|
||||
/// Serialize date into string with format: dd MMM
|
||||
public static func dayAndMonthStrDate(withDate date: Date) -> String {
|
||||
hourAndMinuteFormatter.locale = usedLocale
|
||||
return dayAndMonthFormatter.string(from: date)
|
||||
}
|
||||
|
||||
/// Serialize date into string with format: dd.MM.yyyy
|
||||
public static func dayMonthYearStrDate(withDate date: Date) -> String {
|
||||
hourAndMinuteFormatter.locale = usedLocale
|
||||
return dayMonthYearFormatter.string(from: date)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -36,7 +36,6 @@ open class BaseTextFieldViewEvents: TextFieldViewEvents {
|
|||
public init(textChangedDriver: Driver<String?>) {
|
||||
self.textChangedDriver = textChangedDriver
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Base implementation of text field view model events.
|
||||
|
|
@ -60,7 +59,6 @@ open class BaseTextFieldViewModelEvents: TextFieldViewModelEvents {
|
|||
self.changeValidationStateDriver = changeValidationStateDriver
|
||||
self.changeOnlineValidationStateDriver = changeOnlineValidationStateDriver
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension BaseTextFieldViewModelEvents {
|
||||
|
|
@ -164,5 +162,4 @@ public extension BaseTextFieldViewModelEvents {
|
|||
changeValidationStateDriver: offlineValidationDriver,
|
||||
changeOnlineValidationStateDriver: onlineValidationDriver)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,4 @@ open class LabelCellViewModel {
|
|||
self.labelInsets = labelInsets
|
||||
self.separatorType = separatorType
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ open class LabelTableViewCell: SeparatorTableViewCell {
|
|||
override open func addViews() {
|
||||
super.addViews()
|
||||
|
||||
contentContainerView.addSubview(backgroundImageView)
|
||||
contentContainerView.addSubview(label)
|
||||
contentContainerView.addSubviews(backgroundImageView, label)
|
||||
|
||||
contentView.addSubview(contentContainerView)
|
||||
}
|
||||
|
|
@ -137,5 +136,4 @@ open class LabelTableViewCell: SeparatorTableViewCell {
|
|||
public func configureLabelText(with viewText: ViewText) {
|
||||
label.configure(with: viewText)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ open class PinLayoutTableViewCell: UITableViewCell, PinLayoutCell {
|
|||
open var contentHeight: CGFloat {
|
||||
return contentView.subviewsMaxY
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension UIView {
|
||||
|
|
@ -100,5 +99,4 @@ private extension UIView {
|
|||
.map { $0.frame.maxY }
|
||||
.max() ?? frame.maxY
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ open class SeparatorTableViewCell: PinLayoutTableViewCell {
|
|||
override open func addViews() {
|
||||
super.addViews()
|
||||
|
||||
contentView.addSubview(topSeparator)
|
||||
contentView.addSubview(bottomSeparator)
|
||||
contentView.addSubviews(topSeparator, bottomSeparator)
|
||||
}
|
||||
|
||||
override open func layout() {
|
||||
|
|
@ -100,5 +99,4 @@ open class SeparatorTableViewCell: PinLayoutTableViewCell {
|
|||
|
||||
configureSeparator(with: .none)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class LoadingBarButton {
|
|||
switch side {
|
||||
case .left:
|
||||
return navigationItem?.leftBarButtonItem
|
||||
|
||||
case .right:
|
||||
return navigationItem?.rightBarButtonItem
|
||||
}
|
||||
|
|
@ -50,6 +51,7 @@ public class LoadingBarButton {
|
|||
switch side {
|
||||
case .left:
|
||||
navigationItem?.leftBarButtonItem = newValue
|
||||
|
||||
case .right:
|
||||
navigationItem?.rightBarButtonItem = newValue
|
||||
}
|
||||
|
|
@ -71,14 +73,13 @@ public class LoadingBarButton {
|
|||
|
||||
fileprivate func setState(waiting: Bool = false) {
|
||||
if waiting {
|
||||
let activityIndicatorItem = UIBarButtonItem.activityIndicator
|
||||
let activityIndicatorItem = UIBarButtonItem.activityIndicator
|
||||
barButtonItem = activityIndicatorItem.barButton
|
||||
activityIndicatorItem.activityIndicator.startAnimating()
|
||||
} else {
|
||||
barButtonItem = initialBarButton
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension Observable {
|
||||
|
|
@ -100,5 +101,4 @@ public extension Observable {
|
|||
barButton.setState(waiting: false)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,5 +32,4 @@ public struct PassCodeDelayedDescription {
|
|||
self.description = description
|
||||
self.delay = delay
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public extension PassCodeError {
|
|||
switch self {
|
||||
case .tooManyAttempts:
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,10 @@ public class PassCodeHolderCreate: PassCodeHolderProtocol {
|
|||
switch enterStep {
|
||||
case .enter:
|
||||
firstPassCode = passCode
|
||||
|
||||
case .repeatEnter:
|
||||
secondPassCode = passCode
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -86,10 +88,9 @@ public class PassCodeHolderCreate: PassCodeHolderProtocol {
|
|||
}
|
||||
|
||||
public func reset() {
|
||||
firstPassCode = nil
|
||||
firstPassCode = nil
|
||||
secondPassCode = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Holds information about pass code during pass code entering process
|
||||
|
|
@ -119,7 +120,6 @@ public class PassCodeHolderEnter: PassCodeHolderProtocol {
|
|||
public func reset() {
|
||||
passCode = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Holds information about pass codes during pass code changing process
|
||||
|
|
@ -155,10 +155,13 @@ public class PassCodeHolderChange: PassCodeHolderProtocol {
|
|||
switch (oldPassCode, newFirstPassCode, newSecondPassCode) {
|
||||
case (let oldPassCode?, nil, nil):
|
||||
return oldPassCode
|
||||
|
||||
case (_, _?, nil):
|
||||
return nil
|
||||
case (_, let newFirstPassCode?, let newSecondPassCode?) where newFirstPassCode == newSecondPassCode:
|
||||
|
||||
case let (_, newFirstPassCode?, newSecondPassCode?) where newFirstPassCode == newSecondPassCode:
|
||||
return newFirstPassCode
|
||||
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
|
@ -190,5 +193,4 @@ public class PassCodeHolderChange: PassCodeHolderProtocol {
|
|||
newSecondPassCode = nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ public protocol PassCodeHolderProtocol {
|
|||
|
||||
/// Returns passCode or error if pass code is invalid
|
||||
func validate() -> PassCodeValidationResult
|
||||
|
||||
}
|
||||
|
||||
public class PassCodeHolderBuilder {
|
||||
|
|
@ -58,11 +57,12 @@ public class PassCodeHolderBuilder {
|
|||
switch type {
|
||||
case .create:
|
||||
return PassCodeHolderCreate()
|
||||
|
||||
case .enter:
|
||||
return PassCodeHolderEnter()
|
||||
|
||||
case .change:
|
||||
return PassCodeHolderChange()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ public enum PassCodeValidationResult {
|
|||
|
||||
case valid(String)
|
||||
case invalid(PassCodeError?)
|
||||
|
||||
}
|
||||
|
||||
public extension PassCodeValidationResult {
|
||||
|
|
@ -33,6 +32,7 @@ public extension PassCodeValidationResult {
|
|||
switch self {
|
||||
case .valid:
|
||||
return true
|
||||
|
||||
case .invalid:
|
||||
return false
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ public extension PassCodeValidationResult {
|
|||
switch self {
|
||||
case let .valid(passCode):
|
||||
return passCode
|
||||
|
||||
case .invalid:
|
||||
return nil
|
||||
}
|
||||
|
|
@ -51,6 +52,7 @@ public extension PassCodeValidationResult {
|
|||
switch self {
|
||||
case let .invalid(error):
|
||||
return error
|
||||
|
||||
case .valid:
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public enum PassCodeControllerState {
|
|||
/// Base view controller that operates with pass code
|
||||
open class BasePassCodeViewController: UIViewController, LegacyConfigurableController {
|
||||
|
||||
public var viewModel: BasePassCodeViewModel!
|
||||
public var viewModel: BasePassCodeViewModel! // swiftlint:disable:this implicitly_unwrapped_optional
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
|
|
@ -294,7 +294,6 @@ open class BasePassCodeViewController: UIViewController, LegacyConfigurableContr
|
|||
open func configureBarButtons() {}
|
||||
|
||||
open func localize() {}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - UITextFieldDelegate
|
||||
|
|
@ -308,5 +307,4 @@ extension BasePassCodeViewController: UITextFieldDelegate {
|
|||
let invalid = CharacterSet(charactersIn: "0123456789").inverted
|
||||
return string.rangeOfCharacter(from: invalid, options: [], range: string.startIndex..<string.endIndex) == nil
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,6 @@ open class BasePassCodeViewModel: BaseViewModel {
|
|||
|
||||
/// Notify after system alert with biometrics
|
||||
open func biometricsAuthEnds() {}
|
||||
|
||||
}
|
||||
|
||||
private extension BasePassCodeViewModel {
|
||||
|
|
@ -200,10 +199,13 @@ extension BasePassCodeViewModel {
|
|||
switch passCodeHolder.type {
|
||||
case .create where passCodeHolder.enterStep == .repeatEnter:
|
||||
attemptsNumber += 1
|
||||
|
||||
case .change where passCodeHolder.enterStep == .repeatEnter:
|
||||
attemptsNumber += 1
|
||||
|
||||
case .enter:
|
||||
attemptsNumber += 1
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -231,5 +233,4 @@ extension BasePassCodeViewModel {
|
|||
|
||||
validationResultHolder.value = validationResult
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,4 @@ public extension BaseTextFieldViewEvents {
|
|||
|
||||
self.init(textChangedDriver: textChangedDriver)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,5 +27,4 @@ extension LabelTableViewCell: ConfigurableCell {
|
|||
public func configure(with viewModel: LabelCellViewModel) {
|
||||
configureLabelCell(with: viewModel)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,4 @@ public extension PinLayoutCell {
|
|||
configureAppearance()
|
||||
configureLayout()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,4 @@ public extension Error {
|
|||
var isResponseSerializationError: Bool {
|
||||
return (self as? AFError)?.isResponseSerializationError ?? false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,4 @@ public extension UIBarButtonItem {
|
|||
let indicatorBar = UIBarButtonItem(customView: indicatorView)
|
||||
return (indicatorBar, indicatorView)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,4 @@ public extension UserDefaults {
|
|||
set(newValue, forKey: Keys.userLogin)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,5 +56,4 @@ public protocol PinLayoutCell {
|
|||
|
||||
/// Current content height.
|
||||
var contentHeight: CGFloat { get }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@ public protocol LegacyConfigurableController: InitializableView {
|
|||
|
||||
associatedtype ViewModelT
|
||||
|
||||
var viewModel: ViewModelT! { get }
|
||||
var viewModel: ViewModelT! { get } // swiftlint:disable:this implicitly_unwrapped_optional
|
||||
|
||||
func configureBarButtons()
|
||||
|
||||
func initialLoadView()
|
||||
|
||||
}
|
||||
|
||||
public extension LegacyConfigurableController where Self: UIViewController {
|
||||
|
|
@ -49,5 +48,4 @@ public extension LegacyConfigurableController where Self: UIViewController {
|
|||
localize()
|
||||
bindViews()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,4 @@ public protocol OnlineValidateable {
|
|||
|
||||
/// May contain an error if validation did failed.
|
||||
var error: Error? { get }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ open class BasePassCodeService {
|
|||
private var passCodeHash: String? {
|
||||
return keychain[Keys.passCodeHash]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public extension BasePassCodeService {
|
||||
|
|
@ -96,5 +95,4 @@ public extension BasePassCodeService {
|
|||
save(passCode: nil)
|
||||
isBiometricsAuthorizationEnabled = false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,5 +59,4 @@ open class BaseUserService {
|
|||
UserDefaults.standard.sessionId = nil
|
||||
UserDefaults.standard.userLogin = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ public typealias BiometricsAuthHandler = (Bool, Error?) -> Void
|
|||
|
||||
/// Service that provide access to authentication via biometric
|
||||
public final class BiometricsService {
|
||||
|
||||
|
||||
public enum BiometryType {
|
||||
|
||||
|
||||
case faceID
|
||||
|
||||
|
||||
case touchID
|
||||
|
||||
|
||||
case none
|
||||
}
|
||||
|
||||
|
|
@ -55,18 +55,20 @@ public final class BiometricsService {
|
|||
/// Returns BiometryType supporting by device: TouchID, FaceID or none
|
||||
public var biometryType: BiometryType {
|
||||
let canEvaluate = canAuthenticateWithBiometrics
|
||||
|
||||
|
||||
if #available(iOS 11.0, *) {
|
||||
switch laContext.biometryType {
|
||||
case .touchID:
|
||||
return .touchID
|
||||
|
||||
case .faceID:
|
||||
return .faceID
|
||||
|
||||
case .none:
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return canEvaluate ? .touchID : .none
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,5 +32,4 @@ public enum OnlineValidationState {
|
|||
case processing
|
||||
case valid
|
||||
case invalid(error: Error?)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,4 @@ public struct ValidationError: Error {
|
|||
self.errorMessage = errorMessage
|
||||
self.errorHint = errorHint
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ public extension ValidationItemState {
|
|||
switch self {
|
||||
case .initial:
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
@ -24,11 +25,11 @@ public extension ValidationItemState {
|
|||
switch self {
|
||||
case .valid:
|
||||
return true
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final class ValidationItem {
|
||||
|
|
@ -58,7 +59,8 @@ public final class ValidationItem {
|
|||
.drive(text)
|
||||
.disposed(by: disposeBag)
|
||||
|
||||
textDriver.asObservable().withLatestFrom(validationStateHolder.asObservable()) { (text: $0, validationState: $1) }
|
||||
textDriver.asObservable()
|
||||
.withLatestFrom(validationStateHolder.asObservable()) { (text: $0, validationState: $1) }
|
||||
.filter { !$0.validationState.isInitial }
|
||||
.map { $0.text }
|
||||
.subscribe(onNext: { [weak self] text in
|
||||
|
|
@ -89,6 +91,7 @@ public final class ValidationItem {
|
|||
.valid where !isManual:
|
||||
|
||||
validationStateHolder.value = .correction(validationError)
|
||||
|
||||
default:
|
||||
validationStateHolder.value = .error(validationError)
|
||||
}
|
||||
|
|
@ -96,5 +99,4 @@ public final class ValidationItem {
|
|||
validationStateHolder.value = .valid
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ public extension ValidationServiceState {
|
|||
var isValid: Bool {
|
||||
return self == .valid
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final class ValidationService {
|
||||
|
|
@ -103,5 +102,4 @@ public final class ValidationService {
|
|||
.disposed(by: disposeBag)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ea127636275ceea8abcf3ec9aa62ffe6d13f0b72
|
||||
Subproject commit 54935bbe26063cdf04e72b8cb76d61c727ff99a7
|
||||
Loading…
Reference in New Issue