Skip to content
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
12 changes: 5 additions & 7 deletions MWPhotoBrowser.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'MWPhotoBrowser'
s.version = '2.1.2'
s.version = '2.1.5'
s.license = 'MIT'
s.summary = 'A simple iOS photo and video browser with optional grid view, captions and selections.'
s.description = <<-DESCRIPTION
Expand All @@ -25,7 +25,7 @@ Pod::Spec.new do |s|

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

s.dependency 'MBProgressHUD', '~> 0.9'
s.dependency 'MBProgressHUD', '~> 1.0'
s.dependency 'DACircularProgress', '~> 2.3'
s.dependency 'Masonry', '~> 1.1'

# 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', '~> 4.3'

end
47 changes: 23 additions & 24 deletions Pod/Classes/MWPhoto.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Copyright 2010 d3i. All rights reserved.
//

#import <SDWebImage/SDWebImageDecoder.h>
#import <SDWebImage/SDWebImageManager.h>
#import <SDWebImage/SDWebImageOperation.h>
#import <AssetsLibrary/AssetsLibrary.h>
Expand All @@ -19,7 +18,7 @@ @interface MWPhoto () {
id <SDWebImageOperation> _webImageOperation;
PHImageRequestID _assetRequestID;
PHImageRequestID _assetVideoRequestID;

}

@property (nonatomic, strong) UIImage *image;
Expand All @@ -38,7 +37,7 @@ @implementation MWPhoto
#pragma mark - Class Methods

+ (MWPhoto *)photoWithImage:(UIImage *)image {
return [[MWPhoto alloc] initWithImage:image];
return [[MWPhoto alloc] initWithImage:image];
}

+ (MWPhoto *)photoWithURL:(NSURL *)url {
Expand Down Expand Up @@ -212,27 +211,27 @@ - (void)performLoadUnderlyingImageAndNotify {
- (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];
}
_webImageOperation = [manager loadImageWithURL:url
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL *imageURL) {
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];
});
}];
}
completed:^(UIImage *image, NSData *data, 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];
});
}];
} @catch (NSException *e) {
MWLog(@"Photo from web: %@", e);
_webImageOperation = nil;
Expand Down Expand Up @@ -313,7 +312,7 @@ - (void)_performLoadUnderlyingImageAndNotifyWithAsset:(PHAsset *)asset targetSiz
// Release if we can get it again from path or url
- (void)unloadUnderlyingImage {
_loadingInProgress = NO;
self.underlyingImage = nil;
self.underlyingImage = nil;
}

- (void)imageLoadingComplete {
Expand Down
1 change: 1 addition & 0 deletions Pod/Classes/MWPhotoBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

@interface MWPhotoBrowser : UIViewController <UIScrollViewDelegate, UIActionSheetDelegate>

@property (nonatomic) UIColor *navigationBarTintColor;
@property (nonatomic, weak) IBOutlet id<MWPhotoBrowserDelegate> delegate;
@property (nonatomic) BOOL zoomPhotosToFill;
@property (nonatomic) BOOL displayNavArrows;
Expand Down
Loading