Upload Feature#244
Closed
iswiftshek wants to merge 2 commits into
Closed
Conversation
codedentwickler
suggested changes
Dec 18, 2019
|
|
||
| if assetPath != nil { | ||
| let ext = assetPath!.absoluteString?.components(separatedBy: "ext=")[1].lowercased() | ||
| if ext == "png" || ext == "jpg" || ext == "heic" { |
Member
There was a problem hiding this comment.
This code should be in the presenter though. That way our VCs stay lean.
| } | ||
| do { | ||
| let data = try Data(contentsOf: videoURL as URL, options: .mappedIfSafe) | ||
| print(data) |
Member
There was a problem hiding this comment.
Better to use the logger class.
| do { | ||
| let data = try Data(contentsOf: videoURL as URL, options: .mappedIfSafe) | ||
| print(data) | ||
| fileName = "VIDEO.mp4" |
Member
There was a problem hiding this comment.
Not a good way to name a file to be uploaded. The file name should be as unique as possible unless the backend handles that for you else there will be collision issues later.
You can use the timestamp or some other dynamic properties to make it unique.
| self.presenter.getFiles(self.share, directory: self.directory) | ||
| } | ||
| } catch { | ||
| print(error) |
| switch encodingResult { | ||
| case .success(let upload, _, _): | ||
| upload.response { response in | ||
| debugPrint(response) |
| completion(true) | ||
| } | ||
| case .failure(let encodingError): | ||
| print(encodingError) |
| guard let image = info[.editedImage] as? UIImage else { | ||
| return | ||
| } | ||
| fileName = "IMG.jpeg" |
Member
There was a problem hiding this comment.
same as "VIDEO.mp4" below
Member
|
We close this one in favor of #301 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR completes the upload feature #239.
The user can now add images, videos and documents. (#233)
For images and videos, I used
IMAGE.jpeg,VIDEO.mp4and if those files already exist, they are uploaded in this format<TYPE>_yyyymmdd-HHMM.jpegDocuments are uploaded with their original names as on the device like
fileDocument.pdf