-
-
Notifications
You must be signed in to change notification settings - Fork 875
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom File Upload Controller (#1114)
* Added pluggable PFFileUploadController protocol to PFFile. * Added PFFile’s filename to protocol. * Added missing implementation file for PFFileUploadResult. Added new files to other targets. * Converted to specifying the PFFileUploadController globally on Parse.configuration. Created a default PFFileUploadController policy for parse-server REST upload rather than hard coding it in PFFileController. * Backed out implementing standard upload as an implementation of PFFileUploadController; it exposed too many internals. * Added missing private variable declaration. * Changed copy to strong for global config reference. * Added missing equality and copy semantics in ParseClientConfiguration. * Marked PFFileUploadController.h as public in project. * Marked PFFileUploadResult.h as public in project. * Added PFFileUploadController.h and PFFileUploadResult.h to the global header file. Changed ref to PFFileUploadController.h to a forward declaration.
- Loading branch information
1 parent
e194a9d
commit 2e21ca6
Showing
9 changed files
with
169 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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 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
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 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 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