Fixing sharing to twitter/fb, blank pages, perf improvements for iphone.

This commit is contained in:
Samuel Clay 2012-11-19 19:15:05 -08:00
parent 655a172054
commit 39db803888
6 changed files with 2945 additions and 36 deletions

View file

@ -1149,6 +1149,7 @@
}
- (void)changeActiveFeedDetailRow {
NSLog(@"changeActiveFeedDetailRow in feed detail view");
int rowIndex = [appDelegate locationOfActiveStory];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];

View file

@ -729,23 +729,20 @@ static const CGFloat kFolderTitleHeight = 28;
FeedTableCell *cell = (FeedTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[FeedTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.appDelegate = (NewsBlurAppDelegate *)[[UIApplication sharedApplication] delegate];
cell = [[FeedTableCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.appDelegate = appDelegate;
}
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:indexPath.section];
NSArray *feeds = [appDelegate.dictFolders objectForKey:folderName];
NSArray *activeFolderFeeds = [self.activeFeedLocations objectForKey:folderName];
int location = [[activeFolderFeeds objectAtIndex:indexPath.row] intValue];
id feedId = [feeds objectAtIndex:location];
id feedId = [feeds objectAtIndex:location];
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
BOOL isSocial = [appDelegate isSocialFeed:feedIdStr];
if (isSocial) {
feed = [appDelegate.dictSocialFeeds objectForKey:feedIdStr];
cell.feedFavicon = [Utilities getImage:feedIdStr isSocial:YES];
@ -759,6 +756,8 @@ static const CGFloat kFolderTitleHeight = 28;
cell.negativeCount = [[feed objectForKey:@"ng"] intValue];
cell.isSocial = isSocial;
[cell setNeedsDisplay];
return cell;
}

View file

@ -125,21 +125,15 @@
- (IBAction)doToggleButton:(id)sender {
UIButton *button = (UIButton *)sender;
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if (button.selected) {
button.selected = NO;
if ([[button currentTitle] isEqualToString: @"Facebook"]) {
[userPreferences setInteger:0 forKey:@"shareToFacebook"];
} else if ([[button currentTitle] isEqualToString: @"Twitter"]) {
[userPreferences setInteger:0 forKey:@"shareToTwitter"];
}
} else {
button.selected = YES;
if ([[button currentTitle] isEqualToString: @"Facebook"]) {
[userPreferences setInteger:1 forKey:@"shareToFacebook"];
} else if ([[button currentTitle] isEqualToString: @"Twitter"]) {
[userPreferences setInteger:1 forKey:@"shareToTwitter"];
}
button.selected = !button.selected;
int selected = button.selected ? 1 : 0;
if (button.tag == 1) {
[userPreferences setInteger:selected forKey:@"shareToTwitter"];
} else if (button.tag == 2) {
[userPreferences setInteger:selected forKey:@"shareToFacebook"];
}
[userPreferences synchronize];
}

File diff suppressed because it is too large Load diff

View file

@ -222,7 +222,7 @@
nextPage.pageIndex = -2;
previousPage.pageIndex = -2;
self.scrollView.contentOffset = CGPointMake(0, 0);
// self.scrollView.contentOffset = CGPointMake(0, 0);
}
- (void)refreshPages {
@ -283,7 +283,6 @@
BOOL outOfBounds = newIndex >= pageCount || newIndex < 0;
if (!outOfBounds) {
// NSLog(@"Apply index was: %d, now %d", pageController.pageIndex, newIndex);
CGRect pageFrame = pageController.view.frame;
pageFrame.origin.y = 0;
pageFrame.origin.x = self.scrollView.frame.size.width * newIndex;
@ -321,7 +320,8 @@
int location = [appDelegate indexFromLocation:pageController.pageIndex];
[pageController setActiveStoryAtIndex:location];
[pageController clearStory];
if (self.isDraggingScrollview || abs(newIndex - self.scrollingToPage) <= 1) {
if (self.isDraggingScrollview ||
abs(newIndex - self.scrollingToPage) <= 1) {
[pageController initStory];
[pageController drawStory];
} else {
@ -405,14 +405,18 @@
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (keyPath == @"contentOffset" && self.isDraggingScrollview) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
keyPath == @"contentOffset" &&
self.isDraggingScrollview) {
CGFloat pageWidth = self.scrollView.frame.size.width;
float fractionalPage = self.scrollView.contentOffset.x / pageWidth;
NSInteger nearestNumber = lround(fractionalPage);
int storyIndex = [appDelegate indexFromLocation:nearestNumber];
appDelegate.activeStory = [appDelegate.activeFeedStories objectAtIndex:storyIndex];
[appDelegate changeActiveFeedDetailRow];
if (storyIndex != [appDelegate indexOfActiveStory]) {
appDelegate.activeStory = [appDelegate.activeFeedStories objectAtIndex:storyIndex];
[appDelegate changeActiveFeedDetailRow];
}
}
}
@ -446,6 +450,9 @@
float fractionalPage = self.scrollView.contentOffset.x / pageWidth;
NSInteger nearestNumber = lround(fractionalPage);
if (currentPage.pageIndex == nearestNumber ||
currentPage.pageIndex == -1) return;
if (currentPage.pageIndex < nearestNumber) {
NSLog(@"Swap next into current, current into previous: %d / %d", currentPage.pageIndex, nearestNumber);
StoryDetailViewController *swapCurrentController = currentPage;
@ -463,7 +470,6 @@
}
NSLog(@"Set Story from scroll: %f = %d (%d/%d/%d)", fractionalPage, nearestNumber, previousPage.pageIndex, currentPage.pageIndex, nextPage.pageIndex);
if (currentPage.pageIndex == -1) return;
nextPage.webView.scrollView.scrollsToTop = NO;
previousPage.webView.scrollView.scrollsToTop = NO;
@ -490,15 +496,15 @@
[appDelegate changeActiveFeedDetailRow];
if (self.currentPage.pageIndex != location) {
NSLog(@"Updating Current: %d", location);
NSLog(@"Updating Current: from %d to %d", currentPage.pageIndex, location);
[self applyNewIndex:location pageController:self.currentPage];
}
if (self.nextPage.pageIndex != location+1) {
NSLog(@"Updating Next: %d", location+1);
NSLog(@"Updating Next: from %d to %d", nextPage.pageIndex, location+1);
[self applyNewIndex:location+1 pageController:self.nextPage];
}
if (self.previousPage.pageIndex != location-1) {
NSLog(@"Updating Previous: %d", location-1);
NSLog(@"Updating Previous: from %d to %d", previousPage.pageIndex, location-1);
[self applyNewIndex:location-1 pageController:self.previousPage];
}
}

File diff suppressed because it is too large Load diff