Merge pull request #27 from TouchInstinct/feature/refactoring
Little refactoring
This commit is contained in:
commit
ca8ae59f9a
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "LeadKitAdditions"
|
||||
s.version = "0.0.22"
|
||||
s.version = "0.0.23"
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public typealias VoidBlock = () -> Void
|
|||
public extension Observable {
|
||||
|
||||
/// Handles connection errors during request
|
||||
public func handleConnectionErrors() -> Observable<Observable.E> {
|
||||
func handleConnectionErrors() -> Observable<Observable.E> {
|
||||
return observeOn(CurrentThreadScheduler.instance)
|
||||
|
||||
// handle no internet connection
|
||||
|
|
@ -60,7 +60,7 @@ public extension Observable {
|
|||
- errorTypes: list of error types, which triggers request restart
|
||||
- retryLimit: how many times request can restarts
|
||||
*/
|
||||
public func retryWithinErrors(_ errorTypes: [Error.Type] = [ConnectionError.self],
|
||||
func retryWithinErrors(_ errorTypes: [Error.Type] = [ConnectionError.self],
|
||||
retryLimit: Int = DefaultNetworkService.retryLimit)
|
||||
-> Observable<Observable.E> {
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ public extension Observable {
|
|||
- apiErrorType: type of errors, received frim server
|
||||
- handler: block, that executes, when error occured
|
||||
*/
|
||||
public func handleApiError<T: ApiErrorProtocol>(_ apiErrorType: T,
|
||||
func handleApiError<T: ApiErrorProtocol>(_ apiErrorType: T,
|
||||
handler: @escaping () -> Void) -> Observable<Observable.E>
|
||||
where T.RawValue == Int {
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public extension Observable {
|
|||
|
||||
- parameter isLoading: subject, request state bind to
|
||||
*/
|
||||
public func changeLoadingBehaviour(isLoading: PublishSubject<Bool>) -> Observable<Observable.E> {
|
||||
func changeLoadingBehaviour(isLoading: PublishSubject<Bool>) -> Observable<Observable.E> {
|
||||
return observeOn(CurrentThreadScheduler.instance)
|
||||
.do(onNext: { _ in
|
||||
isLoading.onNext(false)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ private enum Keys {
|
|||
public extension UserDefaults {
|
||||
|
||||
/// Default place to store session id
|
||||
public var sessionId: String? {
|
||||
var sessionId: String? {
|
||||
get {
|
||||
return string(forKey: Keys.sessionId)
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ public extension UserDefaults {
|
|||
}
|
||||
|
||||
/// Default place to store userLogin
|
||||
public var userLogin: String? {
|
||||
var userLogin: String? {
|
||||
get {
|
||||
return string(forKey: Keys.userLogin)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue