Skip to content

Commit

Permalink
Merge pull request #141 from shyambhat/dev
Browse files Browse the repository at this point in the history
v3.6.6
  • Loading branch information
shyambhat committed Aug 21, 2015
2 parents 8b561f3 + 7ff3fc1 commit 69a6f37
Show file tree
Hide file tree
Showing 25 changed files with 1,093 additions and 471 deletions.
17 changes: 5 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@

language: objective-c
xcode_workspace: InstagramKit-Example/InstagramKit-Example.xcworkspace
xcode_scheme: InstagramKit-Example
xcode_sdk: iphonesimulator8.1
podfile: InstagramKit-Example/Podfile
xcode_workspace: InstagramKit.xcworkspace
xcode_scheme: InstagramKit
osx_image: xcode6.4
xcode_sdk: iphonesimulator8.4
# before_install:
# - gem install cocoapods --quiet
# - pod --version
# - pod repo remove master
# - pod setup
# - pod install
# - pod repo update --silent

# script:
#- pod lib lint
# - xctool -xcode_workspace InstagramKit-Example/InstagramKit-Example.xcode_workspace -xcode_scheme 'InstagramKit-Example' -configuration Release -sdk iphonesimulator -arch i386 build
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/* Begin PBXFileReference section */
17B839D94B3A182F8D8DBFBE /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
8203CC4F1B48D5C8007FA65B /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
82DA94FF1B483C1C00A6303B /* InstagramKit-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "InstagramKit-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
82DA95031B483C1C00A6303B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
82DA95041B483C1C00A6303B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -99,7 +98,6 @@
82DA95291B483CA900A6303B /* AppDelegate.h */,
82DA952A1B483CA900A6303B /* AppDelegate.m */,
82DA952B1B483CA900A6303B /* View */,
8203CC4F1B48D5C8007FA65B /* Constants.h */,
);
path = Classes;
sourceTree = "<group>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@
<segue destination="bg8-FQ-jcr" kind="unwind" unwindAction="unwindSegue:" id="bs6-0C-g4M"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" title="Done" id="miF-uD-4yD">
<connections>
<segue destination="bg8-FQ-jcr" kind="unwind" unwindAction="unwindSegue:" id="Qcu-EH-w5a"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="webView" destination="bBm-kX-gC1" id="jm6-gY-iFs"/>
Expand Down
27 changes: 0 additions & 27 deletions InstagramKit-Example/InstagramKit-Example/Classes/Constants.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
#import "IKCell.h"
#import "InstagramMedia.h"
#import "IKMediaViewController.h"
#import "Constants.h"
#import "IKLoginViewController.h"

#define kNumberOfCellsInARow 3
#define kFetchItemsCount 15

@interface IKCollectionViewController ()

@property (nonatomic, strong) NSMutableArray *mediaArray;
@property (nonatomic, strong) InstagramPaginationInfo *currentPaginationInfo;
@property (nonatomic, weak) InstagramEngine *instagramEngine;
@property (nonatomic, strong) NSMutableArray *mediaArray;
@property (nonatomic, strong) InstagramPaginationInfo *currentPaginationInfo;
@property (nonatomic, weak) InstagramEngine *instagramEngine;

@end

Expand All @@ -52,8 +51,8 @@ - (void)viewDidLoad

[self loadMedia];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userAuthenticated:)
name:kInstagramUserAuthenticatedNotification
selector:@selector(userAuthenticationChanged:)
name:InstagtamKitUserAuthenticationChangedNotification
object:nil];
}

Expand All @@ -66,22 +65,19 @@ - (void)viewDidLoad
- (void)loadMedia
{
self.currentPaginationInfo = nil;

BOOL isSessionValid = [self.instagramEngine isSessionValid];
[self setTitle: (isSessionValid) ? @"My Feed" : @"Popular Media"];
[self.navigationItem.leftBarButtonItem setTitle: (isSessionValid) ? @"Log out" : @"Log in"];
[self.navigationItem.rightBarButtonItem setEnabled: isSessionValid];
[self.mediaArray removeAllObjects];
[self.collectionView reloadData];

if (isSessionValid) {
[self setTitle:@"My Feed"];
[self.navigationItem.leftBarButtonItem setTitle:@"Log out"];
[self.navigationItem.rightBarButtonItem setEnabled:YES];
[self.mediaArray removeAllObjects];
[self.collectionView reloadData];
[self requestSelfFeed];
}
else
{
[self setTitle:@"Popular Media"];
[self.navigationItem.leftBarButtonItem setTitle:@"Log in"];
[self.navigationItem.rightBarButtonItem setEnabled:NO];
[self.mediaArray removeAllObjects];
[self.collectionView reloadData];
[self requestPopularMedia];
}
}
Expand All @@ -90,8 +86,7 @@ - (void)loadMedia
#pragma mark - API Requests -

/**
- requestPopularMedia
Calls InstagramKit's Helper method to fetch Popular Instagram Media.
Calls InstagramKit's helper method to fetch Popular Instagram Media.
*/
- (void)requestPopularMedia
{
Expand All @@ -107,8 +102,7 @@ - (void)requestPopularMedia


/**
- requestSelfFeed
Calls InstagramKit's Helper method to fetch Media in logged in Users own feed.
Calls InstagramKit's helper method to fetch Media in the authenticated user's feed.
@discussion The self.currentPaginationInfo object is updated on each successful call
and it's updated nextMaxId is passed as a parameter to the next paginated request.
*/
Expand All @@ -133,7 +127,6 @@ - (void)requestSelfFeed


/**
- moreTapped:
Invoked when user taps the 'More' navigation item.
@discussion The requestSelfFeed method is called with updated pagination parameters (nextMaxId).
*/
Expand All @@ -143,9 +136,8 @@ - (IBAction)moreTapped:(id)sender {


/**
- loginTapped:
Invoked when user taps the left navigation item.
@discussion Either directs to the Login ViewController or logs out.
Invoked when user taps the left navigation item.
@discussion Either directs to the Login ViewController or logs out.
*/
- (IBAction)loginTapped:(id)sender
{
Expand All @@ -157,18 +149,16 @@ - (IBAction)loginTapped:(id)sender
{
[self.instagramEngine logout];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Logged out" message:@"The user is now logged out." delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"InstagramKit" message:@"You are now logged out." delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[alert show];

[self loadMedia];
}
}


#pragma mark - User Authenticated Notification -


- (void)userAuthenticated:(NSNotification *)notification
- (void)userAuthenticationChanged:(NSNotification *)notification
{
[self loadMedia];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#import "IKLoginViewController.h"
#import "InstagramKit.h"
#import "Constants.h"

@interface IKLoginViewController () <UIWebViewDelegate>

Expand All @@ -34,8 +33,9 @@ - (void)viewDidLoad
{
[super viewDidLoad];
self.webView.scrollView.bounces = NO;

NSURL *authURL = [[InstagramEngine sharedEngine] authorizarionURLForScope:InstagramKitLoginScopeBasic];
[self.navigationItem.rightBarButtonItem setEnabled:NO];

NSURL *authURL = [[InstagramEngine sharedEngine] authorizarionURL];
[self.webView loadRequest:[NSURLRequest requestWithURL:authURL]];

}
Expand All @@ -44,22 +44,17 @@ - (void)viewDidLoad
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSError *error;
if ([[InstagramEngine sharedEngine] extractValidAccessTokenFromURL:request.URL error:&error])
if ([[InstagramEngine sharedEngine] receivedValidAccessTokenFromURL:request.URL error:&error])
{
if (!error) {
[self dismissViewControllerAnimated:YES
completion:nil];

[[NSNotificationCenter defaultCenter] postNotificationName:kInstagramUserAuthenticatedNotification
object:nil];
}
else
{
NSLog(@"%@",error);
}
[self authenticationSuccess];
}

return YES;
}

- (void)authenticationSuccess
{
[self.navigationItem setLeftBarButtonItem:nil];
[self.navigationItem.rightBarButtonItem setEnabled:YES];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

@interface IKMediaViewController ()

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *captionLabel;
@property (nonatomic, strong) InstagramMedia *media;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *captionLabel;
@property (nonatomic, strong) InstagramMedia *media;

@end

Expand Down
3 changes: 2 additions & 1 deletion InstagramKit-Example/Podfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pod 'InstagramKit', :path => '../'
pod "InstagramKit", :path => '../'
pod "InstagramKit/UICKeyChainStore", :path => '../'
12 changes: 11 additions & 1 deletion InstagramKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ Pod::Spec.new do |s|
s.homepage = 'https://github.com/shyambhat/InstagramKit'
s.license = 'MIT'
s.author = { "Shyam Bhat" => "[email protected]" }
s.platform = :ios, '6.0'
s.platform = :ios, '7.0'
s.source = { :git => "https://github.com/shyambhat/InstagramKit.git", :tag => '3.6.5' }
s.source_files = 'InstagramKit', 'InstagramKit/**/*.{h,m}'
s.exclude_files = 'InstagramKitDemo'
s.requires_arc = true
s.dependency 'AFNetworking', '~>2.0'
s.default_subspec = 'Exclude-UICKeyChainStore'

s.subspec 'Exclude-UICKeyChainStore' do |exclude_uickeychainstore|
# default lean subspec for users who don't need UICKeyChainStore
end

s.subspec 'UICKeyChainStore' do |uickeychainstore|
uickeychainstore.xcconfig =
{ 'OTHER_CFLAGS' => '$(inherited) -INSTAGRAMKIT_INCLUDE_UICKEYCHAINSTORE' }
uickeychainstore.dependency 'UICKeyChainStore', '~>2.0'
end
end
Loading

0 comments on commit 69a6f37

Please sign in to comment.