diff --git a/Package.swift b/Package.swift index d6661c75..5536e3bc 100644 --- a/Package.swift +++ b/Package.swift @@ -47,7 +47,7 @@ let package = Package( // MARK: - Networking .target(name: "TINetworking", dependencies: ["TISwiftUtils", "Alamofire"], path: "TINetworking/Sources"), - .target(name: "TIMoyaNetworking", dependencies: ["TINetworking", "Moya"], path: "TIMoyaNetworking"), + .target(name: "TIMoyaNetworking", dependencies: ["TINetworking", "TIFoundationUtils", "Moya"], path: "TIMoyaNetworking"), // MARK: - Elements diff --git a/TIMoyaNetworking/Sources/NetworkService/Cancellables/BaseCancellable.swift b/TIMoyaNetworking/Sources/NetworkService/Cancellables/BaseCancellable.swift index 883d0db3..05e2e690 100644 --- a/TIMoyaNetworking/Sources/NetworkService/Cancellables/BaseCancellable.swift +++ b/TIMoyaNetworking/Sources/NetworkService/Cancellables/BaseCancellable.swift @@ -21,8 +21,9 @@ // import Moya +import TIFoundationUtils -open class BaseCancellable: Cancellable { +open class BaseCancellable: Cancellable, CancellableTask { private(set) public var isCancelled = false open func cancel() { diff --git a/TIMoyaNetworking/Sources/NetworkService/Cancellables/Cancellables.swift b/TIMoyaNetworking/Sources/NetworkService/Cancellables/Cancellables.swift index a9f65d2b..87955661 100644 --- a/TIMoyaNetworking/Sources/NetworkService/Cancellables/Cancellables.swift +++ b/TIMoyaNetworking/Sources/NetworkService/Cancellables/Cancellables.swift @@ -22,6 +22,7 @@ import Moya import TISwiftUtils +import TIFoundationUtils public struct Cancellables { public static func nonCancellable() -> Cancellable { @@ -31,4 +32,8 @@ public struct Cancellables { public static func scoped(scopeCancellableClosure: ScopeCancellable.ScopeCancellableClosure) -> Cancellable { ScopeCancellable(scopeCancellableClosure: scopeCancellableClosure) } + + public static func nonCancellableTask() -> CancellableTask { + NonCancellable() + } } diff --git a/TIMoyaNetworking/Sources/NetworkService/Cancellables/NonCancellable.swift b/TIMoyaNetworking/Sources/NetworkService/Cancellables/NonCancellable.swift index 7af2d062..aa200f3e 100644 --- a/TIMoyaNetworking/Sources/NetworkService/Cancellables/NonCancellable.swift +++ b/TIMoyaNetworking/Sources/NetworkService/Cancellables/NonCancellable.swift @@ -21,8 +21,9 @@ // import Moya +import TIFoundationUtils -public struct NonCancellable: Cancellable { +public struct NonCancellable: Cancellable, CancellableTask { public let isCancelled = true public init() {} diff --git a/TIMoyaNetworking/TIMoyaNetworking.podspec b/TIMoyaNetworking/TIMoyaNetworking.podspec index a7c25ff3..bb755b15 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -13,6 +13,7 @@ Pod::Spec.new do |s| s.source_files = s.name + '/**/Sources/**/*' s.dependency 'TINetworking', s.version.to_s + s.dependency 'TIFoundationUtils', s.version.to_s s.dependency 'Moya', "~> 15.0" end