Skip to content

Commit c0f59d0

Browse files
committed
Add generic types to all methods of PFFileController.
1 parent b6eeafc commit c0f59d0

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Parse/Internal/File/Controller/PFFileController.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@class BFTask<__covariant BFGenericType>;
1919
@class PFFileState;
2020
@class PFFileStagingController;
21+
@class PFFileDataStream;
2122

2223
@interface PFFileController : NSObject
2324

@@ -51,9 +52,9 @@
5152
5253
@return `BFTask` with a result set to `nil`.
5354
*/
54-
- (BFTask *)downloadFileAsyncWithState:(PFFileState *)fileState
55-
cancellationToken:(BFCancellationToken *)cancellationToken
56-
progressBlock:(PFProgressBlock)progressBlock;
55+
- (BFTask<PFVoid> *)downloadFileAsyncWithState:(PFFileState *)fileState
56+
cancellationToken:(BFCancellationToken *)cancellationToken
57+
progressBlock:(PFProgressBlock)progressBlock;
5758

5859
/**
5960
Downloads a file asynchronously with a given state and yields a stream to the live download of that file.
@@ -64,9 +65,9 @@
6465
6566
@return `BFTask` with a result set to live `NSInputStream` of the file.
6667
*/
67-
- (BFTask *)downloadFileStreamAsyncWithState:(PFFileState *)fileState
68-
cancellationToken:(BFCancellationToken *)cancellationToken
69-
progressBlock:(PFProgressBlock)progressBlock;
68+
- (BFTask<PFFileDataStream *> *)downloadFileStreamAsyncWithState:(PFFileState *)fileState
69+
cancellationToken:(BFCancellationToken *)cancellationToken
70+
progressBlock:(PFProgressBlock)progressBlock;
7071

7172
///--------------------------------------
7273
#pragma mark - Upload
@@ -93,7 +94,7 @@
9394
#pragma mark - Cache
9495
///--------------------------------------
9596

96-
- (BFTask *)clearFileCacheAsync;
97+
- (BFTask<PFVoid> *)clearFileCacheAsync;
9798

9899
- (NSString *)cachedFilePathForFileState:(PFFileState *)fileState;
99100

Parse/Internal/File/Controller/PFFileController.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ - (PFFileStagingController *)fileStagingController {
8181
#pragma mark - Download
8282
///--------------------------------------
8383

84-
- (BFTask *)downloadFileAsyncWithState:(PFFileState *)fileState
85-
cancellationToken:(BFCancellationToken *)cancellationToken
86-
progressBlock:(PFProgressBlock)progressBlock {
84+
- (BFTask<PFVoid> *)downloadFileAsyncWithState:(PFFileState *)fileState
85+
cancellationToken:(BFCancellationToken *)cancellationToken
86+
progressBlock:(PFProgressBlock)progressBlock {
8787
if (cancellationToken.cancellationRequested) {
8888
return [BFTask cancelledTask];
8989
}
@@ -131,11 +131,11 @@ - (BFTask *)downloadFileAsyncWithState:(PFFileState *)fileState
131131
}];
132132
}
133133

134-
- (BFTask *)downloadFileStreamAsyncWithState:(PFFileState *)fileState
135-
cancellationToken:(BFCancellationToken *)cancellationToken
136-
progressBlock:(PFProgressBlock)progressBlock {
134+
- (BFTask<PFFileDataStream *> *)downloadFileStreamAsyncWithState:(PFFileState *)fileState
135+
cancellationToken:(BFCancellationToken *)cancellationToken
136+
progressBlock:(PFProgressBlock)progressBlock {
137137
return [BFTask taskFromExecutor:[BFExecutor defaultPriorityBackgroundExecutor] withBlock:^id{
138-
BFTaskCompletionSource *taskCompletionSource = [BFTaskCompletionSource taskCompletionSource];
138+
BFTaskCompletionSource<PFFileDataStream *> *taskCompletionSource = [BFTaskCompletionSource taskCompletionSource];
139139
NSString *filePath = [self _temporaryFileDownloadPathForFileState:fileState];
140140
PFFileDataStream *stream = [[PFFileDataStream alloc] initWithFileAtPath:filePath];
141141
[[self downloadFileAsyncWithState:fileState
@@ -259,7 +259,7 @@ - (NSString *)cacheFilesDirectoryPath {
259259
return [self.dataSource.fileManager parseCacheItemPathForPathComponent:PFFileControllerCacheDirectoryName_];
260260
}
261261

262-
- (BFTask *)clearFileCacheAsync {
262+
- (BFTask<PFVoid> *)clearFileCacheAsync {
263263
return [BFTask taskFromExecutor:[BFExecutor defaultExecutor] withBlock:^id{
264264
NSString *path = self.cacheFilesDirectoryPath;
265265
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {

0 commit comments

Comments
 (0)