Media Manager refactoring: split the existing file in 2 parts: MediaManager/MediaLoader

This commit is contained in:
giomfo
2015-01-08 21:23:49 +01:00
parent 8ae53afd15
commit 11ff1fd788
10 changed files with 342 additions and 294 deletions
+8 -9
View File
@@ -30,9 +30,9 @@
self.progressView.hidden = NO;
NSString* downloadRate = [downloadStatsDict valueForKey:kMediaManagerProgressDownloadRateKey];
NSString* remaingTime = [downloadStatsDict valueForKey:kMediaManagerProgressRemaingTimeKey];
NSString* progressString = [downloadStatsDict valueForKey:kMediaManagerProgressStringKey];
NSString* downloadRate = [downloadStatsDict valueForKey:kMediaLoaderProgressDownloadRateKey];
NSString* remaingTime = [downloadStatsDict valueForKey:kMediaLoaderProgressRemaingTimeKey];
NSString* progressString = [downloadStatsDict valueForKey:kMediaLoaderProgressStringKey];
NSMutableString* text = [[NSMutableString alloc] init];
@@ -52,7 +52,7 @@
self.statsLabel.text = text;
NSNumber* progressNumber = [downloadStatsDict valueForKey:kMediaManagerProgressRateKey];
NSNumber* progressNumber = [downloadStatsDict valueForKey:kMediaLoaderProgressRateKey];
if (progressNumber) {
self.progressChartView.progress = progressNumber.floatValue;
@@ -98,9 +98,9 @@
if (self.message.attachmentURL) {
// check if there is a downlad in progress
id loader = [MediaManager mediaLoaderForURL:self.message.attachmentURL];
MediaLoader *loader = [MediaManager mediaLoaderForURL:self.message.attachmentURL];
NSDictionary *dict = [MediaManager downloadStatsDict:loader];
NSDictionary *dict = loader.downloadStatsDict;
if (dict) {
isHidden = NO;
@@ -127,10 +127,9 @@
- (void)cancelDownload {
// get the linked medida loader
id loader = [MediaManager mediaLoaderForURL:self.message.attachmentURL];
MediaLoader *loader = [MediaManager mediaLoaderForURL:self.message.attachmentURL];
if (loader) {
[MediaManager cancel:loader];
[loader cancel];
}
// ensure there is no more progress bar