Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #663

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
10 changes: 5 additions & 5 deletions MWPhotoBrowser.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Pod::Spec.new do |s|
'https://raw.github.com/mwaterfall/MWPhotoBrowser/master/Screenshots/MWPhotoBrowser6.png'
]

s.homepage = 'https://github.com/mwaterfall/MWPhotoBrowser'
s.homepage = 'https://github.com/ZMAsd/MWPhotoBrowser'
s.author = { 'Michael Waterfall' => '[email protected]' }
s.social_media_url = 'https://twitter.com/mwaterfall'

s.source = {
:git => 'https://github.com/mwaterfall/MWPhotoBrowser.git',
:git => 'https://github.com/ZMAsd/MWPhotoBrowser.git',
:tag => '2.1.2'
}
s.platform = :ios, '7.0'
s.platform = :ios, '10.0'
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'MWPhotoBrowser' => ['Pod/Assets/*.png']
Expand All @@ -37,12 +37,12 @@ Pod::Spec.new do |s|
s.frameworks = 'ImageIO', 'QuartzCore', 'AssetsLibrary', 'MediaPlayer'
s.weak_frameworks = 'Photos'

s.dependency 'MBProgressHUD', '~> 0.9'
s.dependency 'MBProgressHUD', '~> 1.2.0'
s.dependency 'DACircularProgress', '~> 2.3'

# SDWebImage
# 3.7.2 contains bugs downloading local files
# https://github.com/rs/SDWebImage/issues/1109
s.dependency 'SDWebImage', '~> 3.7', '!= 3.7.2'
s.dependency 'SDWebImage', '~> 5.12.1'

end
42 changes: 20 additions & 22 deletions Pod/Classes/MWPhoto.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import <SDWebImage/SDWebImageDecoder.h>
#import <SDWebImage/SDWebImageManager.h>
#import <SDWebImage/SDWebImageOperation.h>
#import <SDWebImage/SDWebImageDownloader.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import "MWPhoto.h"
#import "MWPhotoBrowser.h"
Expand Down Expand Up @@ -211,28 +212,25 @@ - (void)performLoadUnderlyingImageAndNotify {
// Load from local file
- (void)_performLoadUnderlyingImageAndNotifyWithWebURL:(NSURL *)url {
@try {
SDWebImageManager *manager = [SDWebImageManager sharedManager];
_webImageOperation = [manager downloadImageWithURL:url
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
if (expectedSize > 0) {
float progress = receivedSize / (float)expectedSize;
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:progress], @"progress",
self, @"photo", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:MWPHOTO_PROGRESS_NOTIFICATION object:dict];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
if (error) {
MWLog(@"SDWebImage failed to download image: %@", error);
}
_webImageOperation = nil;
self.underlyingImage = image;
dispatch_async(dispatch_get_main_queue(), ^{
[self imageLoadingComplete];
});
}];
[[SDWebImageDownloader sharedDownloader] downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
if (expectedSize > 0) {
float progress = receivedSize / (float)expectedSize;
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:progress], @"progress",
self, @"photo", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:MWPHOTO_PROGRESS_NOTIFICATION object:dict];
}
} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
if (error) {
MWLog(@"SDWebImage failed to download image: %@", error);
}
_webImageOperation = nil;
self.underlyingImage = image;
dispatch_async(dispatch_get_main_queue(), ^{
[self imageLoadingComplete];
});

}];
} @catch (NSException *e) {
MWLog(@"Photo from web: %@", e);
_webImageOperation = nil;
Expand Down