-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from strvcom/feat/downloads-uploads-simplifica…
…tion [feat] Downloads/Uploads manager usage simplification and sample unification
- Loading branch information
Showing
28 changed files
with
544 additions
and
657 deletions.
There are no files selected for viewing
54 changes: 19 additions & 35 deletions
54
NetworkingSampleApp/NetworkingSampleApp.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
NetworkingSampleApp/NetworkingSampleApp/API/Routers/SampleDownloadRouter.swift
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
NetworkingSampleApp/NetworkingSampleApp/API/Routers/SampleUploadRouter.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ import Foundation | |
enum SampleAPIConstants { | ||
static let userHost = "https://reqres.in/api" | ||
static let authHost = "https://nonexistentmockauth.com/api" | ||
// swiftlint:disable:next force_https | ||
static let uploadHost = "https://httpbin.org" | ||
// swiftlint:disable:next force_unwrapping force_https | ||
static let uploadURL = URL(string: "https://httpbin.org/post")! | ||
static let validEmail = "[email protected]" | ||
static let validPassword = "cityslicka" | ||
static let videoUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" | ||
|
20 changes: 20 additions & 0 deletions
20
NetworkingSampleApp/NetworkingSampleApp/Extensions/URLSessionTask.State+Convenience.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// URLSessionTask.State+Convenience.swift | ||
// NetworkingSampleApp | ||
// | ||
// Created by Matej Molnár on 21.12.2023. | ||
// | ||
|
||
import Foundation | ||
|
||
extension URLSessionTask.State { | ||
var title: String { | ||
switch self { | ||
case .canceling: "cancelling" | ||
case .completed: "completed" | ||
case .running: "running" | ||
case .suspended: "suspended" | ||
@unknown default: "" | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
NetworkingSampleApp/NetworkingSampleApp/Extensions/UploadAPIManager+SharedInstance.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// UploadAPIManager+SharedInstance.swift | ||
// NetworkingSampleApp | ||
// | ||
// Created by Matej Molnár on 21.12.2023. | ||
// | ||
|
||
import Networking | ||
|
||
extension UploadAPIManager { | ||
static var shared: UploadAPIManaging = { | ||
var responseProcessors: [ResponseProcessing] = [ | ||
LoggingInterceptor.shared, | ||
StatusCodeProcessor.shared | ||
] | ||
var errorProcessors: [ErrorProcessing] = [LoggingInterceptor.shared] | ||
|
||
#if DEBUG | ||
responseProcessors.append(EndpointRequestStorageProcessor.shared) | ||
errorProcessors.append(EndpointRequestStorageProcessor.shared) | ||
#endif | ||
|
||
return UploadAPIManager( | ||
urlSessionConfiguration: .default, | ||
requestAdapters: [ | ||
LoggingInterceptor.shared | ||
], | ||
responseProcessors: responseProcessors, | ||
errorProcessors: errorProcessors | ||
) | ||
}() | ||
} |
66 changes: 0 additions & 66 deletions
66
NetworkingSampleApp/NetworkingSampleApp/Scenes/Download/DownloadProgressView.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/FormUploadsViewModel.swift
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/UploadItem.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.