This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. set up the intial view with the first Feed Item | |
- (void) initFeedsPageViewController { | |
... | |
FeedItem * firstFeedItem = self.feedItemsArray[0]; | |
PSHCoverFeedPageViewController * currentPagePageViewController = [[PSHCoverFeedPageViewController alloc] init]; | |
currentPagePageViewController.feedType = firstFeedItem.type; | |
currentPagePageViewController.messageLabelString = firstFeedItem.message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) likeFeed { | |
UIImageView * animatedLikeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"coverfeed-like_button"]]; | |
animatedLikeImageView.frame = CGRectMake(80.0f, 210.0f, 160.0f, 160.0f); | |
animatedLikeImageView.contentMode = UIViewContentModeScaleToFill; | |
self.animatedLikeImageView = animatedLikeImageView; | |
self.animatedLikeImageView.hidden = YES; | |
[self.view addSubview:self.animatedLikeImageView]; | |
double delayInSeconds = .3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(IBAction)commentButtonTapped:(id)sender { | |
if (self.commentsPostingView.hidden == YES){ | |
if (self.commentsViewController != nil){ | |
self.commentsViewController = nil; | |
[self.commentsViewController.view removeFromSuperview]; | |
[self.commentsViewController removeFromParentViewController]; | |
} | |
self.commentsViewController = [[PSHCommentsViewController alloc] init]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
if (!self.imageURLString){ | |
self.imageURLString = self.sourceAvartarImageURL; | |
self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; | |
} | |
UIImage * feedImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.imageURLString]]]; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
self.backgroundImageView.alpha = 0.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)stopAnimateBackground { | |
self.backgroundImageView.transform = CGAffineTransformIdentity; | |
[UIView setAnimationsEnabled:YES]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)animateBackground { | |
NSInteger randInt = arc4random()%3; | |
NSInteger translationX = 0; | |
NSInteger translationY = 0; | |
NSInteger scaleX = 0; | |
NSInteger scaleY = 0; | |
switch (randInt) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform :ios, '6.1' | |
pod 'MagicalRecord', '~>2.1.0' | |
pod 'AFNetworking', '~>1.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save before refreshing data | |
[[NSManagedObjectContext MR_defaultContext] saveWithOptions:MRSaveSynchronously completion:^(BOOL success, NSError *error) { | |
NSArray * feedItemsArray = [FeedItem findAllSortedBy:@"createdTime" ascending:NO]; | |
fetchFeedSuccess(feedItemsArray, nil); | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) likeFeed:(NSString*)graphID { | |
InitAccountSuccessBlock successBlock = ^{ | |
NSString * likeURLString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/likes", graphID]; | |
NSURL * feedURL = [NSURL URLWithString:likeURLString]; | |
SLRequest * request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodPOST URL:feedURL parameters:nil]; | |
NSLog(@"request.URL: %@", request.URL); | |
request.account = self.facebookAccount; | |
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary * facebookOptions = @{ACFacebookAppIdKey:kPSHFacebookAppID, | |
ACFacebookPermissionsKey: @[@"email", @"publish_stream", @"read_stream", @"user_photos"], | |
ACFacebookAudienceKey:ACFacebookAudienceFriends}; | |
ACAccountType * facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]; | |
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:facebookOptions | |
completion: ^(BOOL granted, NSError *error) { | |
NSLog(@"granted: %i", granted); | |
if (granted) { | |
NSArray *accounts = [self.accountStore accountsWithAccountType:facebookAccountType]; |