-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Downloads/Uploads manager usage simplification and sample unification #59
Conversation
NetworkingSampleApp/NetworkingSampleApp/Scenes/Download/DownloadProgressViewModel.swift
Show resolved
Hide resolved
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/UploadsView.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're almost there. I think about few little improvements we can do here.
NetworkingSampleApp/NetworkingSampleApp/UIElements/TaskProgressView.swift
Show resolved
Hide resolved
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/UploadsViewModel.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩴
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/UploadsViewModel.swift
Show resolved
Hide resolved
NetworkingSampleApp/NetworkingSampleApp/UIElements/TaskProgressView.swift
Show resolved
Hide resolved
NetworkingSampleApp/NetworkingSampleApp/Scenes/Upload/UploadsView.swift
Outdated
Show resolved
Hide resolved
…rvcom/ios-networking into feat/downloads-uploads-simplification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it took me only ages but at the end I'm happy with result
📲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐱
This PR aims to simply the usage of DownloadAPIManager/UploadAPIManager and also unify the sample screens logic + UI.
Managers usage simplification
While I was writing a new README I realised that we are forcing the user to create unnecessary Router boiler plate in order to create a download/upload request.
Download
Hence I've created a new method on
DownloadAPIManaging
where you can simply pass theURL
of the file you wish to download instead ofRequestable
. The request is then made with internal dummyDownloadRouter
.Upload
First I've created a new enum
UploadType
and I replaced the three different upload methods with one where you pass an uploadType parameter. Then I defined a new method where you can pass theUploadType
and an uploadURL
. Similarly to download the request is made with internal dummyUploadRouter
.Sample logic + UI unification
UploadAPIManager
shared instance.UploadService
and use the shared manager instance instead.FormUploadsViewModel
and move the logic to theUploadsViewModel
.TaskProgressView
with generic viewModel ofTaskProgressViewModel
protocol and use it in both upload and download screens.