Skip to content

Commit

Permalink
Merge branch 'development' into feature/alamofire_5
Browse files Browse the repository at this point in the history
# Conflicts:
#	Moya.podspec
#	Sources/Moya/MoyaProvider+Internal.swift
  • Loading branch information
sunshinejr committed May 30, 2019
2 parents dd14a56 + cf9ee28 commit 651c21f
Show file tree
Hide file tree
Showing 19 changed files with 18 additions and 47 deletions.
1 change: 0 additions & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
github "Alamofire/Alamofire" "5.0.0-beta.6"
github "ReactiveCocoa/ReactiveSwift" ~> 6.0
github "ReactiveX/RxSwift" ~> 5.0
github "antitypical/Result" ~> 4.1
1 change: 0 additions & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.1.0"
github "ReactiveCocoa/ReactiveSwift" "6.0.0"
github "ReactiveX/RxSwift" "5.0.1"
github "antitypical/Result" "4.1.0"
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Next

### Changed
- **Breaking Change** Removed `Result` depndency in favor of `Result` introduced in Swift 5. [#1858](https://github.com/Moya/Moya/pull/1858) by [@larryonoff](https://github.com/larryonoff).

# [14.0.0-alpha.1] - 2019-05-14

### Changed
- **Breaking Change** Minimum version of `RxSwift` is now 5.0. [#1846](https://github.com/Moya/Moya/pull/1846) by [@LucianoPAlmeida](https://github.com/LucianoPAlmeida).
- **Breaking Change** Minimum version of `ReactiveSwift` is now 6.0. [#1849](https://github.com/Moya/Moya/pull/1849) by [@sunshinejr](https://github.com/sunshinejr).
Expand Down
3 changes: 1 addition & 2 deletions Moya.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Moya"
s.version = "13.0.1"
s.version = "14.0.0-alpha.1"
s.summary = "Network abstraction layer written in Swift"
s.description = <<-EOS
Moya abstracts network commands using Swift Generics to provide developers
Expand All @@ -25,7 +25,6 @@ Pod::Spec.new do |s|
s.subspec "Core" do |ss|
ss.source_files = "Sources/Moya/", "Sources/Moya/Plugins/"
ss.dependency "Alamofire", "5.0.0-beta.6"
ss.dependency "Result", "~> 4.1"
ss.framework = "Foundation"
end

Expand Down
15 changes: 2 additions & 13 deletions Moya.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@
1446FBB31F214C5200C1EFF2 /* URL+Moya.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1446FBB21F214C5200C1EFF2 /* URL+Moya.swift */; };
1463B87B1F8A8A79002D9C4F /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8731F8A8A5B002D9C4F /* Alamofire.framework */; };
1463B87C1F8A8A79002D9C4F /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8731F8A8A5B002D9C4F /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1463B87D1F8A8A79002D9C4F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8721F8A8A5A002D9C4F /* Result.framework */; };
1463B87E1F8A8A79002D9C4F /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8721F8A8A5A002D9C4F /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1463B8801F8A8A7F002D9C4F /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8731F8A8A5B002D9C4F /* Alamofire.framework */; };
1463B8811F8A8A7F002D9C4F /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8731F8A8A5B002D9C4F /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1463B8821F8A8A7F002D9C4F /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8721F8A8A5A002D9C4F /* Result.framework */; };
1463B8831F8A8A7F002D9C4F /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1463B8721F8A8A5A002D9C4F /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
147E26EC1F5B14B300C1F513 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 147E26EB1F5B14B300C1F513 /* Task.swift */; };
148FAF0DFB395B4A64314803 /* ReactiveMoya.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62A8C06CC9BA491AE62A431B /* ReactiveMoya.framework */; };
149675EB1F8133B00085EDEE /* Moya.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 559D567FD0DA37D6CC98FF92 /* Moya.framework */; };
149675EC1F81340B0085EDEE /* GitHubAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 469A06B01F705DDE001153A0 /* GitHubAPI.swift */; };
149675ED1F81340D0085EDEE /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 469A06AE1F705DDD001153A0 /* GiphyAPI.swift */; };
149675EE1F81340F0085EDEE /* GitHubUserContentAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 469A06AD1F705DDD001153A0 /* GitHubUserContentAPI.swift */; };
Expand Down Expand Up @@ -82,6 +77,7 @@
BAFB3C28D3BF17C52FDA8FE4 /* testImage.png in Resources */ = {isa = PBXBuildFile; fileRef = CA93F1BAD55FF95EDE17EE61 /* testImage.png */; };
BEAA605B30BE7651BA5C61A4 /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61A693AF0E88E83E91A47A99 /* Plugin.swift */; };
C1B5E2325B210232599B0D1A /* ErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F112022D8F42844A7D5CB5C /* ErrorTests.swift */; };
CCB85FCA228B3D1800AAB253 /* Moya.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 559D567FD0DA37D6CC98FF92 /* Moya.framework */; };
D00AA2514CD6B1276B845BA7 /* ReactiveMoya.h in Headers */ = {isa = PBXBuildFile; fileRef = 019BF5A88BB928EBDFD944FE /* ReactiveMoya.h */; settings = {ATTRIBUTES = (Public, ); }; };
D6A04B657A83CA2FF80ABCF4 /* Moya.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 559D567FD0DA37D6CC98FF92 /* Moya.framework */; };
DA631A5B37F36DA17E135F14 /* SignalProducer+MoyaSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1AFAFEA29CDFABC559F0BE2 /* SignalProducer+MoyaSpec.swift */; };
Expand Down Expand Up @@ -124,7 +120,6 @@
dstSubfolderSpec = 10;
files = (
1463B87C1F8A8A79002D9C4F /* Alamofire.framework in Embed Frameworks */,
1463B87E1F8A8A79002D9C4F /* Result.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -136,7 +131,6 @@
dstSubfolderSpec = 10;
files = (
1463B8811F8A8A7F002D9C4F /* Alamofire.framework in Embed Frameworks */,
1463B8831F8A8A7F002D9C4F /* Result.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -146,7 +140,6 @@
/* Begin PBXFileReference section */
019BF5A88BB928EBDFD944FE /* ReactiveMoya.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = ReactiveMoya.h; sourceTree = "<group>"; };
1446FBB21F214C5200C1EFF2 /* URL+Moya.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "URL+Moya.swift"; sourceTree = "<group>"; };
1463B8721F8A8A5A002D9C4F /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = "<group>"; };
1463B8731F8A8A5B002D9C4F /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
147E26EB1F5B14B300C1F513 /* Task.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Task.swift; sourceTree = "<group>"; };
149749421F8923EC00FA4900 /* AnyEncodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyEncodable.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -232,8 +225,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1463B8821F8A8A7F002D9C4F /* Result.framework in Frameworks */,
149675EB1F8133B00085EDEE /* Moya.framework in Frameworks */,
CCB85FCA228B3D1800AAB253 /* Moya.framework in Frameworks */,
1463B8801F8A8A7F002D9C4F /* Alamofire.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -242,7 +234,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1463B87D1F8A8A79002D9C4F /* Result.framework in Frameworks */,
469A06B21F705ECF001153A0 /* Moya.framework in Frameworks */,
1463B87B1F8A8A79002D9C4F /* Alamofire.framework in Frameworks */,
);
Expand Down Expand Up @@ -280,7 +271,6 @@
isa = PBXGroup;
children = (
1463B8731F8A8A5B002D9C4F /* Alamofire.framework */,
1463B8721F8A8A5A002D9C4F /* Result.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -810,7 +800,6 @@
Nimble.framework,
Quick.framework,
OHHTTPStubs.framework,
Result.framework,
Alamofire.framework,
ReactiveSwift.framework,
RxSwift.framework,
Expand Down
9 changes: 0 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@
"version": "6.0.0"
}
},
{
"package": "Result",
"repositoryURL": "https://github.com/antitypical/Result.git",
"state": {
"branch": null,
"revision": "2ca499ba456795616fbc471561ff1d963e6ae160",
"version": "4.1.0"
}
},
{
"package": "RxSwift",
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
Expand Down
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "4.1.0")),
.package(url: "https://github.com/antitypical/Result.git", .upToNextMajor(from: "4.1.0")),
.package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", .upToNextMajor(from: ("6.0.0"))),
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.0.0"))
],
targets: [
.target(
name: "Moya",
dependencies: [
"Alamofire",
"Result"],
"Alamofire"],
exclude: [
"Tests",
"Sources/Supporting Files",
Expand Down
10 changes: 5 additions & 5 deletions Sources/Moya/MoyaProvider+Internal.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

// MARK: - Method

Expand Down Expand Up @@ -240,15 +239,16 @@ private extension MoyaProvider {
// Inform all plugins about the response
plugins.forEach { $0.didReceive(result, target: target) }
if let progressCompletion = progressCompletion {
let value = try? result.get()
switch progressAlamoRequest {
case let downloadRequest as DownloadRequest:
progressCompletion(ProgressResponse(progress: downloadRequest.downloadProgress, response: result.value))
progressCompletion(ProgressResponse(progress: downloadRequest.downloadProgress, response: value))
case let uploadRequest as UploadRequest:
progressCompletion(ProgressResponse(progress: uploadRequest.uploadProgress, response: result.value))
progressCompletion(ProgressResponse(progress: uploadRequest.uploadProgress, response: value))
case let dataRequest as DataRequest:
progressCompletion(ProgressResponse(progress: dataRequest.downloadProgress, response: result.value))
progressCompletion(ProgressResponse(progress: dataRequest.downloadProgress, response: value))
default:
progressCompletion(ProgressResponse(response: result.value))
progressCompletion(ProgressResponse(response: value))
}
}
completion(result)
Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/MoyaProvider.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

/// Closure to be executed when a request has completed.
public typealias Completion = (_ result: Result<Moya.Response, MoyaError>) -> Void
Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/Plugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

/// A Moya Plugin receives callbacks to perform side effects wherever a request is sent or received.
///
Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/Plugins/AccessTokenPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

// MARK: - AccessTokenAuthorizable

Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/Plugins/CredentialsPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

/// Provides each request with optional URLCredentials.
public final class CredentialsPlugin: PluginType {
Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/Plugins/NetworkActivityPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

/// Network activity change notification type.
public enum NetworkActivityChangeType {
Expand Down
1 change: 0 additions & 1 deletion Sources/Moya/Plugins/NetworkLoggerPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

/// Logs network activity (outgoing requests and incoming responses).
public final class NetworkLoggerPlugin: PluginType {
Expand Down
1 change: 0 additions & 1 deletion Tests/AccessTokenPluginSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Quick
import Nimble
import Moya
import Result

final class AccessTokenPluginSpec: QuickSpec {
struct TestTarget: TargetType, AccessTokenAuthorizable {
Expand Down
1 change: 0 additions & 1 deletion Tests/NetworkLoggerPluginSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Quick
import Nimble
import Moya
import Result
import enum Alamofire.AFError

final class NetworkLoggerPluginSpec: QuickSpec {
Expand Down
1 change: 0 additions & 1 deletion Tests/TestPlugin.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import enum Result.Result
@testable import Moya

final class TestingPlugin: PluginType {
Expand Down
4 changes: 2 additions & 2 deletions docs/Threading.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
By default, all of your requests will be put onto a background thread by `Alamofire`, and the
response will be called on the main thread. If you want your response called on a different thread, you can initialize your `Provider` with a specified `callbackQueue`:
```swift
provider = MoyaProvider<GitHub>(callbackQueue: DispatchQueue.global(.utility))
provider = MoyaProvider<GitHub>(callbackQueue: DispatchQueue.global(qos: .utility))
provider.request(.userProfile("ashfurrow")) {
/* this is called on a utility thread */
}
Expand All @@ -27,4 +27,4 @@ provider.reactive.request(.userProfile("ashfurrow"))
.map { /* this is called on the current thread */ }
.observe(on: QueueScheduler(qos: .utility))
.map { /* this is called on a utility thread */ }
```
```
4 changes: 2 additions & 2 deletions docs_CN/Threading.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
默认,您所有的请求将会被`Alamofire`放入background线程中, 响应将会在主线程中调用。如果您希望您的响应在不同的线程中调用 , 您可以用一个指定的 `callbackQueue`来初始化您的provider:

```swift
provider = MoyaProvider<GitHub>(callbackQueue: DispatchQueue.global(.utility))
provider = MoyaProvider<GitHub>(callbackQueue: DispatchQueue.global(qos: .utility))
provider.request(.userProfile("ashfurrow")) {
/* this is called on a utility thread */
}
Expand All @@ -27,4 +27,4 @@ provider.reactive.request(.userProfile("ashfurrow"))
.map { /* this is called on the current thread */ }
.observe(on: QueueScheduler(qos: .utility))
.map { /* this is called on a utility thread */ }
```
```

0 comments on commit 651c21f

Please sign in to comment.