mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing crash when mis-counting feeds. Correcting height of font popover on iphone. Adding horizontal bounce to story page control.
This commit is contained in:
parent
1cc128b5a2
commit
ce20040e8c
12 changed files with 8889 additions and 106 deletions
|
@ -703,6 +703,14 @@
|
|||
feedTitle = [activeFeed objectForKey:@"feed_title"];
|
||||
}
|
||||
|
||||
int activeStoryLocation = [self locationOfActiveStory];
|
||||
if (activeStoryLocation >= 0) {
|
||||
BOOL animated = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
|
||||
!self.tryFeedCategory);
|
||||
[self.storyPageControl changePage:activeStoryLocation animated:animated];
|
||||
// [self.storyPageControl updatePageWithActiveStory:activeStoryLocation];
|
||||
}
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:feedTitle style: UIBarButtonItemStyleBordered target: nil action: nil];
|
||||
[feedDetailViewController.navigationItem setBackBarButtonItem: newBackButton];
|
||||
|
@ -714,13 +722,6 @@
|
|||
navController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
|
||||
}
|
||||
|
||||
int activeStoryLocation = [self locationOfActiveStory];
|
||||
if (activeStoryLocation >= 0) {
|
||||
BOOL animated = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
|
||||
!self.tryFeedCategory);
|
||||
[self.storyPageControl changePage:activeStoryLocation animated:animated];
|
||||
// [self.storyPageControl updatePageWithActiveStory:activeStoryLocation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navController
|
||||
|
|
|
@ -602,6 +602,14 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
|
||||
NSInteger intelligenceLevel = [appDelegate selectedIntelligence];
|
||||
NSMutableArray *indexPaths = [NSMutableArray array];
|
||||
NSMutableDictionary *oldSectionRows = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary *switchingSectionRows = [NSMutableDictionary dictionary];
|
||||
|
||||
for (int section=0; section < [self numberOfSectionsInTableView:self.feedTitlesTable]; section++) {
|
||||
[oldSectionRows setObject:[NSNumber numberWithInt:[self.feedTitlesTable
|
||||
numberOfRowsInSection:section]]
|
||||
forKey:[NSNumber numberWithInt:section]];
|
||||
}
|
||||
|
||||
// if show all sites, calculate feeds and mark visible
|
||||
if (self.viewShowingAllFeeds) {
|
||||
|
@ -649,7 +657,36 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[self calculateFeedLocations:YES];
|
||||
}
|
||||
|
||||
// @try {
|
||||
// Count the rows that will be deleted/inserted and ensure it matches
|
||||
// the table's count, just in case they are incorrect.
|
||||
for (NSIndexPath *rowPath in indexPaths) {
|
||||
NSNumber *section = [NSNumber numberWithInt:rowPath.section];
|
||||
[switchingSectionRows setObject:[NSNumber numberWithInt:[[switchingSectionRows objectForKey:section] intValue] + 1]
|
||||
forKey:section];
|
||||
}
|
||||
|
||||
BOOL correct = YES;
|
||||
for (int section=0; section < [self numberOfSectionsInTableView:self.feedTitlesTable]; section++) {
|
||||
int newRows = [self tableView:self.feedTitlesTable numberOfRowsInSection:section];
|
||||
int oldRows = [[oldSectionRows objectForKey:[NSNumber numberWithInt:section]] intValue];
|
||||
int difference = [[switchingSectionRows objectForKey:[NSNumber numberWithInt:section]] intValue];
|
||||
if (!self.viewShowingAllFeeds) {
|
||||
difference = difference * -1;
|
||||
}
|
||||
if (oldRows + difference != newRows) {
|
||||
correct = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
NSArray *visiblePaths = [self.feedTitlesTable indexPathsForVisibleRows];
|
||||
NSIndexPath *middleRow = [visiblePaths objectAtIndex:0];
|
||||
|
||||
|
||||
// If the row counts don't match up, no animation is possible. Instead of crashing
|
||||
// just reload the table. Loss of animation, but better than crashing.
|
||||
if (!correct) {
|
||||
[self.feedTitlesTable reloadData];
|
||||
} else {
|
||||
[self.feedTitlesTable beginUpdates];
|
||||
if ([indexPaths count] > 0) {
|
||||
if (self.viewShowingAllFeeds) {
|
||||
|
@ -661,16 +698,13 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
}
|
||||
[self.feedTitlesTable endUpdates];
|
||||
// }
|
||||
// @catch (NSException *exception) {
|
||||
// NSLog(@"EXCEPTION: %@", exception);
|
||||
// [self.feedTitlesTable beginUpdates];
|
||||
// [self.feedTitlesTable endUpdates];
|
||||
// [self.feedTitlesTable reloadData];
|
||||
// }
|
||||
}
|
||||
|
||||
CGPoint offset = CGPointMake(0, 0);
|
||||
[self.feedTitlesTable setContentOffset:offset animated:YES];
|
||||
NSIndexPath *newMiddleRow = [NSIndexPath indexPathForItem:0 inSection:middleRow.section];
|
||||
[self.feedTitlesTable scrollToRowAtIndexPath:newMiddleRow atScrollPosition:UITableViewScrollPositionTop animated:YES];
|
||||
// CGRect middleRect = [self.feedTitlesTable rectForRowAtIndexPath:middleRow];
|
||||
// CGPoint offset = CGPointMake(middleRect.origin.x, middleRect.origin.y);
|
||||
// [self.feedTitlesTable setContentOffset:offset animated:YES];
|
||||
|
||||
// Forget still visible feeds, since they won't be populated when
|
||||
// all feeds are showing, and shouldn't be populated after this
|
||||
|
|
|
@ -366,7 +366,7 @@
|
|||
appDelegate.activeFeedStories = [NSArray arrayWithArray:newActiveFeedStories];
|
||||
|
||||
self.commentField.text = nil;
|
||||
[appDelegate.storyPageControl refreshPages];
|
||||
[appDelegate.storyPageControl.currentPage setActiveStoryAtIndex:-1];
|
||||
[appDelegate.storyPageControl.currentPage refreshComments:replyId];
|
||||
[appDelegate changeActiveFeedDetailRow];
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
- (void)hideStory;
|
||||
|
||||
- (void)toggleLikeComment:(BOOL)likeComment;
|
||||
- (void)flashCheckmarkHud:(NSString *)messageType;
|
||||
- (void)scrolltoComment;
|
||||
- (void)changeWebViewWidth;
|
||||
- (void)showUserProfile:(NSString *)userId xCoordinate:(int)x yCoordinate:(int)y width:(int)width height:(int)height;
|
||||
|
|
|
@ -1212,23 +1212,32 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
// // adding in a simulated delay
|
||||
// sleep(1);
|
||||
|
||||
[self flashCheckmarkHud:shareType];
|
||||
}
|
||||
|
||||
- (void)flashCheckmarkHud:(NSString *)messageType {
|
||||
[MBProgressHUD hideHUDForView:appDelegate.storyPageControl.view animated:NO];
|
||||
self.storyHUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
self.storyHUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]];
|
||||
self.storyHUD.mode = MBProgressHUDModeCustomView;
|
||||
self.storyHUD.removeFromSuperViewOnHide = YES;
|
||||
|
||||
if ([shareType isEqualToString:@"reply"]) {
|
||||
self.storyHUD.removeFromSuperViewOnHide = YES;
|
||||
|
||||
if ([messageType isEqualToString:@"reply"]) {
|
||||
self.storyHUD.labelText = @"Replied";
|
||||
} else if ([shareType isEqualToString:@"edit-reply"]) {
|
||||
} else if ([messageType isEqualToString:@"edit-reply"]) {
|
||||
self.storyHUD.labelText = @"Edited Reply";
|
||||
} else if ([shareType isEqualToString:@"edit-share"]) {
|
||||
} else if ([messageType isEqualToString:@"edit-share"]) {
|
||||
self.storyHUD.labelText = @"Edited Comment";
|
||||
} else if ([shareType isEqualToString:@"share"]) {
|
||||
} else if ([messageType isEqualToString:@"share"]) {
|
||||
self.storyHUD.labelText = @"Shared";
|
||||
} else if ([shareType isEqualToString:@"like-comment"]) {
|
||||
} else if ([messageType isEqualToString:@"like-comment"]) {
|
||||
self.storyHUD.labelText = @"Favorited";
|
||||
} else if ([shareType isEqualToString:@"unlike-comment"]) {
|
||||
} else if ([messageType isEqualToString:@"unlike-comment"]) {
|
||||
self.storyHUD.labelText = @"Unfavorited";
|
||||
} else if ([messageType isEqualToString:@"saved"]) {
|
||||
self.storyHUD.labelText = @"Saved";
|
||||
} else if ([messageType isEqualToString:@"unsaved"]) {
|
||||
self.storyHUD.labelText = @"No longer saved";
|
||||
}
|
||||
[self.storyHUD hide:YES afterDelay:1];
|
||||
}
|
||||
|
|
|
@ -141,8 +141,6 @@
|
|||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[self setNextPreviousButtons];
|
||||
[appDelegate adjustStoryDetailWebView];
|
||||
|
||||
previousPage.view.hidden = YES;
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
|
||||
if (!appDelegate.isSocialView) {
|
||||
|
@ -184,7 +182,8 @@
|
|||
self.navigationItem.titleView = imageView;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
previousPage.view.hidden = YES;
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
|
@ -195,7 +194,7 @@
|
|||
// self.subscribeButton.tintColor = UIColorFromRGB(0x0a6720);
|
||||
}
|
||||
appDelegate.isTryFeedView = NO;
|
||||
previousPage.view.hidden = NO;
|
||||
[self applyNewIndex:previousPage.pageIndex pageController:previousPage];
|
||||
}
|
||||
|
||||
- (void)transitionFromFeedDetail {
|
||||
|
@ -299,13 +298,15 @@
|
|||
pageFrame.origin.y = 0;
|
||||
pageFrame.origin.x = self.scrollView.frame.size.width * newIndex;
|
||||
pageFrame.size.height = self.scrollView.frame.size.height;
|
||||
pageController.view.hidden = NO;
|
||||
pageController.view.frame = pageFrame;
|
||||
} else {
|
||||
// NSLog(@"Out of bounds: was %d, now %d", pageController.pageIndex, newIndex);
|
||||
CGRect pageFrame = pageController.view.frame;
|
||||
pageFrame.origin.x = self.scrollView.frame.size.width * newIndex;
|
||||
pageFrame.origin.y = 48;
|
||||
pageFrame.origin.y = self.scrollView.frame.size.height;
|
||||
pageFrame.size.height = self.scrollView.frame.size.height;
|
||||
pageController.view.hidden = YES;
|
||||
pageController.view.frame = pageFrame;
|
||||
}
|
||||
|
||||
|
@ -726,7 +727,7 @@
|
|||
}
|
||||
|
||||
[appDelegate markActiveStorySaved:YES];
|
||||
[self informMessage:@"This story is now saved"];
|
||||
[self.currentPage flashCheckmarkHud:@"saved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnsaved {
|
||||
|
@ -759,7 +760,7 @@
|
|||
// [appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[appDelegate markActiveStorySaved:NO];
|
||||
[self informMessage:@"This story is no longer saved"];
|
||||
[self.currentPage flashCheckmarkHud:@"unsaved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnread {
|
||||
|
@ -824,47 +825,7 @@
|
|||
#pragma mark Styles
|
||||
|
||||
|
||||
- (IBAction)toggleFontSize:(id)sender {
|
||||
// if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
// if (popoverController == nil) {
|
||||
// popoverController = [[UIPopoverController alloc]
|
||||
// initWithContentViewController:appDelegate.fontSettingsViewController];
|
||||
//
|
||||
// popoverController.delegate = self;
|
||||
// } else {
|
||||
// if (popoverController.isPopoverVisible) {
|
||||
// [popoverController dismissPopoverAnimated:YES];
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// [popoverController setContentViewController:appDelegate.fontSettingsViewController];
|
||||
// }
|
||||
//
|
||||
// [popoverController setPopoverContentSize:CGSizeMake(274.0, 130.0)];
|
||||
// UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc]
|
||||
// initWithCustomView:sender];
|
||||
//
|
||||
// [popoverController presentPopoverFromBarButtonItem:settingsButton
|
||||
// permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
|
||||
// } else {
|
||||
// FontSettingsViewController *fontSettings = [[FontSettingsViewController alloc] init];
|
||||
// appDelegate.fontSettingsViewController = fontSettings;
|
||||
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:appDelegate.fontSettingsViewController];
|
||||
//
|
||||
// // adding Done button
|
||||
// UIBarButtonItem *donebutton = [[UIBarButtonItem alloc]
|
||||
// initWithTitle:@"Done"
|
||||
// style:UIBarButtonItemStyleDone
|
||||
// target:self
|
||||
// action:@selector(hideToggleFontSize)];
|
||||
//
|
||||
// appDelegate.fontSettingsViewController.navigationItem.rightBarButtonItem = donebutton;
|
||||
// appDelegate.fontSettingsViewController.navigationItem.title = @"Style";
|
||||
// navController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
|
||||
// [self presentModalViewController:navController animated:YES];
|
||||
//
|
||||
// }
|
||||
|
||||
- (IBAction)toggleFontSize:(id)sender {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
[appDelegate.masterContainerViewController showFontSettingsPopover:sender];
|
||||
} else {
|
||||
|
@ -881,7 +842,7 @@
|
|||
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
|
||||
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
|
||||
}
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(240, 154)];
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(240, 226)];
|
||||
[self.popoverController presentPopoverFromBarButtonItem:self.fontSettingsButton
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,21 @@
|
|||
<Bucket
|
||||
type = "1"
|
||||
version = "1.0">
|
||||
<FileBreakpoints>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Classes/StoryPageControl.m"
|
||||
timestampString = "377572385.895663"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "301"
|
||||
endingLineNumber = "301"
|
||||
landmarkName = "-applyNewIndex:pageController:"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
<SymbolicBreakpoints>
|
||||
<SymbolicBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
// #define BACKGROUND_REFRESH_SECONDS -5
|
||||
#define BACKGROUND_REFRESH_SECONDS -10*60
|
||||
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
|
||||
#define NEWSBLUR_LINK_COLOR 0x405BA8
|
||||
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -398,14 +398,6 @@ del {
|
|||
|
||||
#story_pane .NB-story-comment-reply.NB-highlighted {
|
||||
background-color: #FBE5C7;
|
||||
padding-left: 50px;
|
||||
padding-right: 5px;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
#story_pane .NB-story-comment-reply.NB-highlighted .NB-story-comment-reply-photo {
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
#story_pane .NB-story-comment.NB-highlighted {
|
||||
|
|
Loading…
Add table
Reference in a new issue