mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
NewsBlur: fixed #770 (crash deleting story tags)
This commit is contained in:
parent
82a7d980f6
commit
64f4163a06
4 changed files with 13 additions and 8 deletions
|
@ -775,7 +775,7 @@
|
|||
}
|
||||
|
||||
[self.userTagsViewController view]; // Force viewDidLoad
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(220, 38 * MIN(6.5, [[self.dictSavedStoryTags allKeys] count]+0.5))];
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(220, 38 * MIN(6.5, [[self.dictSavedStoryTags allKeys] count] + [self.activeStory[@"user_tags"] count] + 1))];
|
||||
CGRect frame = [sender CGRectValue];
|
||||
[self.popoverController presentPopoverFromRect:frame
|
||||
inView:self.storyPageControl.currentPage.view
|
||||
|
|
|
@ -99,7 +99,8 @@
|
|||
- (void)markStoryUnread:(NSString *)storyId feedId:(id)feedId;
|
||||
- (void)markStoryUnread:(NSDictionary *)story feed:(NSDictionary *)feed;
|
||||
|
||||
- (NSDictionary *)markStory:story asSaved:(BOOL)saved;
|
||||
- (NSDictionary *)markStory:(NSDictionary *)story asSaved:(BOOL)saved;
|
||||
- (NSDictionary *)markStory:(NSDictionary *)story asSaved:(BOOL)saved forceUpdate:(BOOL)forceUpdate;
|
||||
- (void)toggleStorySaved;
|
||||
- (BOOL)toggleStorySaved:(NSDictionary *)story;
|
||||
- (void)syncStoryAsSaved:(NSDictionary *)story;
|
||||
|
|
|
@ -659,10 +659,14 @@
|
|||
}
|
||||
|
||||
- (NSDictionary *)markStory:(NSDictionary *)story asSaved:(BOOL)saved {
|
||||
return [self markStory:story asSaved:saved forceUpdate:NO];
|
||||
}
|
||||
|
||||
- (NSDictionary *)markStory:(NSDictionary *)story asSaved:(BOOL)saved forceUpdate:(BOOL)forceUpdate {
|
||||
BOOL firstSaved = NO;
|
||||
NSMutableDictionary *newStory = [story mutableCopy];
|
||||
BOOL isSaved = [[story objectForKey:@"starred"] boolValue];
|
||||
if (isSaved == saved) {
|
||||
if (isSaved == saved && !forceUpdate) {
|
||||
return newStory;
|
||||
}
|
||||
[newStory setValue:[NSNumber numberWithBool:saved] forKey:@"starred"];
|
||||
|
|
|
@ -244,11 +244,11 @@ const NSInteger kHeaderHeight = 24;
|
|||
NSMutableArray *newUserTags = [[story objectForKey:@"user_tags"] mutableCopy];
|
||||
[newUserTags removeObject:tagName];
|
||||
[story setObject:newUserTags forKey:@"user_tags"];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES];
|
||||
[appDelegate.storiesCollection syncStoryAsSaved:story];
|
||||
NSInteger newCount = [appDelegate adjustSavedStoryCount:tagName direction:-1];
|
||||
|
||||
NSInteger row = [[self arrayUserTagsNotInStory] indexOfObject:tagName];
|
||||
|
||||
[tagsTableView beginUpdates];
|
||||
[tagsTableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:indexPath.row inSection:0]]
|
||||
withRowAnimation:UITableViewRowAnimationTop];
|
||||
|
@ -269,7 +269,7 @@ const NSInteger kHeaderHeight = 24;
|
|||
NSInteger otherTagRow = [[self arrayUserTagsNotInStory] indexOfObject:tagName];
|
||||
|
||||
[story setObject:[[story objectForKey:@"user_tags"] arrayByAddingObject:tagName] forKey:@"user_tags"];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES];
|
||||
[appDelegate.storiesCollection syncStoryAsSaved:story];
|
||||
[appDelegate adjustSavedStoryCount:tagName direction:1];
|
||||
|
||||
|
@ -291,7 +291,7 @@ const NSInteger kHeaderHeight = 24;
|
|||
NSInteger storyTagRow = [[self arrayStoryTags] indexOfObject:tagName];
|
||||
|
||||
[story setObject:[[story objectForKey:@"user_tags"] arrayByAddingObject:tagName] forKey:@"user_tags"];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES];
|
||||
[appDelegate.storiesCollection syncStoryAsSaved:story];
|
||||
[appDelegate adjustSavedStoryCount:tagName direction:1];
|
||||
|
||||
|
@ -318,7 +318,7 @@ const NSInteger kHeaderHeight = 24;
|
|||
NSMutableDictionary *story = [appDelegate.activeStory mutableCopy];
|
||||
|
||||
[story setObject:[[story objectForKey:@"user_tags"] arrayByAddingObject:tagName] forKey:@"user_tags"];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES];
|
||||
[appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES];
|
||||
[appDelegate.storiesCollection syncStoryAsSaved:story];
|
||||
[appDelegate adjustSavedStoryCount:tagName direction:1];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue