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
4 changes: 2 additions & 2 deletions FacebookImagePicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Pod::Spec.new do |s|
}
s.source_files = ['FacebookImagePicker/OL*.{h,m}', 'FacebookImagePicker/UIImageView+FacebookFadeIn.{h,m}']
s.resources = ['FacebookImagePicker/FacebookImagePicker.xcassets', 'FacebookImagePicker/*.xib']
s.dependency 'FBSDKCoreKit', '~> 4.13.1'
s.dependency 'FBSDKLoginKit', '~> 4.13.1'
s.dependency 'FBSDKCoreKit'
s.dependency 'FBSDKLoginKit'
end
1 change: 1 addition & 0 deletions FacebookImagePicker/OLAlbumViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@protocol OLAlbumViewControllerDelegate <NSObject>
- (void)albumViewControllerDoneClicked:(OLAlbumViewController *)albumController;
- (void)albumViewController:(OLAlbumViewController *)albumController didFailWithError:(NSError *)error;
- (void)albumViewControllerCancelClicked:(OLAlbumViewController *)albumController;
@optional
- (void)albumViewController:(OLAlbumViewController *)albumController didSelectImage:(OLFacebookImage *)image;
- (BOOL)albumViewController:(OLAlbumViewController *)albumController shouldSelectImage:(OLFacebookImage *)image;
Expand Down
19 changes: 14 additions & 5 deletions FacebookImagePicker/OLAlbumViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ - (void)viewDidLoad {

if (self.shouldDisplayLogoutButton) {
[self addLogoutButtonAnimated:NO];
} else {
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonClicked)];
}

self.albumRequestForNextPage = [[OLFacebookAlbumRequest alloc] init];
Expand Down Expand Up @@ -199,9 +201,19 @@ - (void)onButtonLogoutClicked {
[self.delegate albumViewControllerDoneClicked:self];
}

- (void)cancelButtonClicked{
[self.delegate albumViewControllerCancelClicked:self];
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self updateSelectedFromPhotoViewController];
if (self.isMultiselectEnabled) {
// only remember selected photos from other album if enable multiple selection mode
[self updateSelectedFromPhotoViewController];
} else {
self.selected = nil;
}

}

#pragma mark - UITableViewDataSource methods
Expand Down Expand Up @@ -263,17 +275,14 @@ - (void)photoViewController:(OLPhotoViewController *)photoController didFailWith
}

- (void)photoViewController:(OLPhotoViewController *)photoController didSelectImage:(OLFacebookImage *)image{
if(self.isMultiselectEnabled) {
[self updateSelectedFromPhotoViewController];
}

if ([self.delegate respondsToSelector:@selector(albumViewController:didSelectImage:)]){
[self.delegate albumViewController:self didSelectImage:image];
}
}

- (void)photoViewController:(OLPhotoViewController *)photoController didDeSelectImage:(OLFacebookImage *)image{
[self updateSelectedFromPhotoViewController];
//[self updateSelectedFromPhotoViewController];
}

- (BOOL)photoViewController:(OLPhotoViewController *)photoController shouldSelectImage:(OLFacebookImage *)image{
Expand Down
9 changes: 4 additions & 5 deletions FacebookImagePicker/OLFacebookImagePickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ @implementation OLFacebookImagePickerController
- (id)init {
UIViewController *vc = [[UIViewController alloc] init];
vc.view.backgroundColor = [UIColor whiteColor];
vc.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonClicked)];
if (self = [super initWithRootViewController:vc]) {
_shouldDisplayLogoutButton = YES;
_isMultiselectEnabled = YES;
Expand All @@ -35,10 +34,6 @@ - (id)init {
return self;
}

- (void)cancelButtonClicked{
[self.delegate facebookImagePicker:self didFinishPickingImages:@[]];
}

- (void)viewDidAppear:(BOOL)animated{
if (![FBSDKAccessToken currentAccessToken] && !self.haveSeenViewDidAppear){
self.haveSeenViewDidAppear = YES;
Expand Down Expand Up @@ -100,6 +95,10 @@ - (void)albumViewControllerDoneClicked:(OLAlbumViewController *)albumController
[self.delegate facebookImagePicker:self didFinishPickingImages:albumController.selected];
}

- (void)albumViewControllerCancelClicked:(OLAlbumViewController *)albumController {
[self.delegate facebookImagePickerDidCancelPickingImages:self];
}

- (void)albumViewController:(OLAlbumViewController *)albumController didFailWithError:(NSError *)error {
[self.delegate facebookImagePicker:self didFailWithError:error];
}
Expand Down
7 changes: 0 additions & 7 deletions FacebookImagePicker/OLPhotoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@ -(void) collectionView:(UICollectionView *)collectionView didDeselectItemAtIndex
}

-(void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
if(self.isMultiselectEnabled) {
[self updateTitleWithSelectedIndexPaths:collectionView.indexPathsForSelectedItems];

} else {
[collectionView deselectItemAtIndexPath:indexPath animated:NO];
}

if ([self.delegate respondsToSelector:@selector(photoViewController:didSelectImage:)]){
[self.delegate photoViewController:self didSelectImage:[self.photos objectAtIndex:indexPath.item]];
}
Expand Down
6 changes: 4 additions & 2 deletions FacebookImagePicker/Podfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pod 'FBSDKCoreKit', '~> 4.8.0'
pod 'FBSDKLoginKit', '~> 4.8.0'
target 'FacebookImagePicker' do
pod 'FBSDKCoreKit', '~> 4.13.1'
pod 'FBSDKLoginKit', '~> 4.13.1'
end