diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e4cae5..fcc96c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 0.2.6 + +- **Update**: `DefaultNetworkService` supported `NetworkServiceConfiguration` + ### 0.2.5 - **Add**: Methods to notify when biometrics auth begins and ends. diff --git a/LeadKitAdditions.podspec b/LeadKitAdditions.podspec index 4a7ae53..bb6f768 100644 --- a/LeadKitAdditions.podspec +++ b/LeadKitAdditions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKitAdditions" - s.version = "0.2.5" + s.version = "0.2.6" 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" diff --git a/Podfile.lock b/Podfile.lock index 04ef9d2..74c0731 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -6,9 +6,9 @@ PODS: - IDZSwiftCommonCrypto (0.10.0) - InputMask (3.0.0) - KeychainAccess (3.1.0) - - LeadKit (0.7.5): - - LeadKit/Core (= 0.7.5) - - LeadKit/Core (0.7.5): + - LeadKit (0.7.6): + - LeadKit/Core (= 0.7.6) + - LeadKit/Core (0.7.6): - CocoaLumberjack/Swift (~> 3.4) - ObjectMapper (~> 3.0) - RxAlamofire (~> 4.1) @@ -17,7 +17,7 @@ PODS: - SwiftDate (~> 4.5) - TableKit (~> 2.6) - UIScrollView-InfiniteScroll (~> 1.0.0) - - LeadKit/Core-iOS-Extension (0.7.5): + - LeadKit/Core-iOS-Extension (0.7.6): - CocoaLumberjack/Swift (~> 3.4) - ObjectMapper (~> 3.0) - RxAlamofire (~> 4.1) @@ -56,7 +56,7 @@ SPEC CHECKSUMS: IDZSwiftCommonCrypto: 4eef2c46e262dfbcbc1fd76365e066336680ad7d InputMask: 8b5c42acac19cd48fe664b739f30995103b75e75 KeychainAccess: 94c5540b32eabf7bc32bfb976a268e8ea05fd6da - LeadKit: 1295888d8ef6c9f58cbdb5cd7ba316362b111e19 + LeadKit: 9e0a27cea8171a38b72bef7605ade92cd8a48217 ObjectMapper: 20505058f54e5c3ca69e1d6de9897d152a5369a6 PinLayout: a2bbe9057d49a1e326b13dc4fe8c14751f8c8844 RxAlamofire: 87a9c588541210cc3e4a1f843ccc3ecf3eb98b31 diff --git a/Sources/Services/Network/DefaultNetworkService.swift b/Sources/Services/Network/DefaultNetworkService.swift index c135272..7940ec3 100644 --- a/Sources/Services/Network/DefaultNetworkService.swift +++ b/Sources/Services/Network/DefaultNetworkService.swift @@ -25,7 +25,7 @@ import LeadKit import RxSwift /// Default implementation of network service, which trust any server and use default timeout interval -@available(*, deprecated, message: "Use ConfigurableNetworkService protocol from LeadKit.") +@available(*, deprecated, message: "Use NetworkService from LeadKit.") open class DefaultNetworkService: NetworkService { open class var retryLimit: UInt { @@ -34,23 +34,8 @@ open class DefaultNetworkService: NetworkService { private let disposeBag = DisposeBag() - /// Override to set base server url - open class var baseUrl: String { - fatalError("You should override this var: baseUrl") - } - - /// Override to change timeout interval default value - open class var defaultTimeoutInterval: TimeInterval { - return 20.0 - } - - /// The default acceptable range 200…299 - open class var acceptableStatusCodes: [Int] { - return Alamofire.SessionManager.defaultAcceptableStatusCodes - } - - public init(sessionManager: SessionManager) { - super.init(sessionManager: sessionManager, acceptableStatusCodes: DefaultNetworkService.acceptableStatusCodes) + public override init(configuration: NetworkServiceConfiguration) { + super.init(configuration: configuration) // Fatal error: `drive*` family of methods can be only called from `MainThread` DispatchQueue.main.async { @@ -58,28 +43,4 @@ open class DefaultNetworkService: NetworkService { } } - // MARK: - Default Values - - /// Override to change server trust policies - open class var serverTrustPolicies: [String: ServerTrustPolicy] { - return [ - baseUrl: .disableEvaluation - ] - } - - /// Override to change default urlSession configuration - open class var configuration: URLSessionConfiguration { - let configuration = URLSessionConfiguration.default - configuration.timeoutIntervalForRequest = defaultTimeoutInterval - - return configuration - } - - /// Override to configure alamofire session manager - open class var sessionManager: SessionManager { - let sessionManager = SessionManager(configuration: configuration, - serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)) - return sessionManager - } - }