-
-
Notifications
You must be signed in to change notification settings - Fork 878
Custom File Upload Controller #1114
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bf13868
Added pluggable PFFileUploadController protocol to PFFile.
kcoop 17aacaf
Added PFFile’s filename to protocol.
kcoop dc76a52
Added missing implementation file for PFFileUploadResult.
kcoop ee60efd
Converted to specifying the PFFileUploadController globally on Parse.…
kcoop e7517cd
Backed out implementing standard upload as an implementation of PFFil…
kcoop 3668cd1
Added missing private variable declaration.
kcoop dcc7c90
Changed copy to strong for global config reference.
kcoop e72968b
Added missing equality and copy semantics in ParseClientConfiguration.
kcoop 0b1905a
Marked PFFileUploadController.h as public in project.
kcoop d3a8dde
Marked PFFileUploadResult.h as public in project.
kcoop 715c185
Added PFFileUploadController.h and PFFileUploadResult.h to the global…
kcoop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// PFFileUploadResult.m | ||
// Parse | ||
// | ||
// Created by Ken Cooper on 2/21/17. | ||
// Copyright © 2017 Parse Inc. All rights reserved. | ||
// | ||
|
||
#import "PFFileUploadResult.h" | ||
|
||
@implementation PFFileUploadResult | ||
|
||
@end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// PFUploadController.h | ||
// Parse | ||
// | ||
// Created by Ken Cooper on 2/20/17. | ||
// Copyright © 2017 Parse Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Bolts/BFTask.h> | ||
|
||
/** | ||
A policy interface for overriding the default upload behavior of uploading a PFFile | ||
to application's parse server. Allows for direct uploads to other file storage | ||
providers. | ||
*/ | ||
@protocol PFFileUploadController <NSObject> | ||
|
||
/** | ||
Uploads a file asynchronously from file path for a given file state. | ||
|
||
@param sourceFilePath Path to the file to upload. | ||
@param fileName The PFFile's fileName. | ||
@param mimeType The PFFile's mime type. | ||
@param sessionToken The current users's session token. | ||
@param cancellationToken Cancellation token. | ||
@param progressBlock Progress block to call (optional). | ||
|
||
@return `BFTask` with a success result set to `PFFileUploadResult` containing the url and name of the uploaded file. | ||
*/ | ||
-(BFTask<PFFileUploadResult *> * _Nonnull)uploadSourceFilePath:(NSString * _Nonnull)sourceFilePath | ||
fileName:(NSString * _Nullable)fileName | ||
mimeType:(NSString * _Nullable)mimeType | ||
sessionToken:(NSString * _Nonnull)sessionToken | ||
cancellationToken:(BFCancellationToken * _Nonnull)cancellationToken | ||
progressBlock:(PFProgressBlock _Nonnull)progressBlock; | ||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// PFFileUploadResult.h | ||
// Parse | ||
// | ||
// Created by Ken Cooper on 2/21/17. | ||
// Copyright © 2017 Parse Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** | ||
Response provided by a custom `PFFileUploadController`. | ||
*/ | ||
@interface PFFileUploadResult : NSObject | ||
@property (strong, nonatomic) NSString *url; | ||
@property (strong, nonatomic) NSString *name; | ||
@end |
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
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
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
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.
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 could very well have the
PFRESTFileUploadController: NSObject<PFFileUploadController>
what do you think?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.
Absolutely. I originally started to go that route, but wanted to minimize touching the code base. I'll make that change. I assume you want the PFRESTFileUploadController to have a public .h?
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's an internal one, not really a need to be exposed. The protocol needs to be however.
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.
OK, will do. Few things to do first, but will get to it in a bit.