Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1 from exalted/AL333Z-master
Browse files Browse the repository at this point in the history
Aesthetic changes and improvements.
  • Loading branch information
AL333Z committed Feb 26, 2013
2 parents 2ca0c64 + 9ea52e2 commit 8adace6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions PTDownloadManager/PTFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@ typedef enum {
PTFileContentStatusAvailable,
} PTFileContentStatus;

#pragma mark - Delegate protocol definition
////////////////////////////////////////////////////////////////////////////////
// Delegate protocol
////////////////////////////////////////////////////////////////////////////////

@protocol PTFileDelegate <NSObject>

@optional

- (void)PTFileDidFinishDownload:(PTFile *)file;
- (void)fileDidFinishDownloading:(PTFile *)file;

@end

////////////////////////////////////////////////////////////////////////////////
// Class interface
////////////////////////////////////////////////////////////////////////////////

@interface PTFile : NSObject

// the location where file content should be stored
Expand Down
8 changes: 2 additions & 6 deletions PTDownloadManager/PTFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,15 @@ - (void)updateStatusForRequest:(ASIHTTPRequest *)request
if (!request || request.isCancelled || request.isFinished) {
[self.progressView removeFromSuperview];
self.label.text = self.savedLabelText;

[self.delegate fileDidFinishDownloading:self];
}
else if (request.isExecuting) {
self.label.text = NSLocalizedString(@"Loading...", nil);
}
else if (request.isReady) {
self.label.text = NSLocalizedString(@"Waiting...", nil);
}

if (request.isFinished) {
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(PTFileDidFinishDownload:)]) {
[self.delegate PTFileDidFinishDownload:self];
}
}
}

@end

0 comments on commit 8adace6

Please sign in to comment.