Media Manager refactoring (in progress)

This commit is contained in:
giomfo
2015-01-08 18:20:34 +01:00
parent 53bc918c36
commit 8d5f726303
5 changed files with 168 additions and 137 deletions
+7 -5
View File
@@ -414,6 +414,12 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
imageURL = anImageURL;
if (!imageURL) {
// Set preview by default
self.image = previewImage;
return;
}
// Check whether the image download is in progress
id loader = [MediaManager mediaLoaderForURL:imageURL];
if (loader) {
@@ -443,11 +449,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMediaDownloadProgress:) name:kMediaDownloadProgressNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMediaDownloadEnd:) name:kMediaDownloadDidFinishNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMediaDownloadEnd:) name:kMediaDownloadDidFailNotification object:nil];
[MediaManager loadPicture:imageURL
success:^(UIImage *anImage) {
}
failure:^(NSError *error) {
}];
[MediaManager downloadPicture:imageURL];
}
}
}