From 02584d57ed6c2c0893285a4f106e2922f4249987 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 27 Jul 2017 17:14:28 -0700 Subject: [PATCH] iOS v7.0.1. Fixing crash with saved story tags. --- clients/ios/Classes/UserTagsViewController.m | 34 +++++++++++++------- clients/ios/NewsBlur-iPhone-Info.plist | 4 +-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/clients/ios/Classes/UserTagsViewController.m b/clients/ios/Classes/UserTagsViewController.m index 105a7e636..3590f4de0 100644 --- a/clients/ios/Classes/UserTagsViewController.m +++ b/clients/ios/Classes/UserTagsViewController.m @@ -319,18 +319,30 @@ const NSInteger kHeaderHeight = 24; - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [addTagBar resignFirstResponder]; NSString *tagName = addTagBar.text; - NSMutableDictionary *story = [appDelegate.activeStory mutableCopy]; - [story setObject:[[story objectForKey:@"user_tags"] arrayByAddingObject:tagName] forKey:@"user_tags"]; - [appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES]; - [appDelegate.storiesCollection syncStoryAsSaved:story]; - [appDelegate adjustSavedStoryCount:tagName direction:1]; - - NSInteger row = [[self arrayUserTags] indexOfObject:tagName]; - [tagsTableView beginUpdates]; - [tagsTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] - withRowAnimation:UITableViewRowAnimationTop]; - [tagsTableView endUpdates]; + if ([[self arrayStoryTags] containsObject:tagName]) { + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[self.arrayStoryTags indexOfObject:tagName] inSection:1]; + [self tableView:tagsTableView didSelectRowAtIndexPath:indexPath]; + } else if ([[self arrayUserTags] containsObject:tagName]) { + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[self.arrayUserTags indexOfObject:tagName] inSection:0]; + [self tableView:tagsTableView didSelectRowAtIndexPath:indexPath]; + } else if ([[self arrayUserTagsNotInStory] containsObject:tagName]) { + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[self.arrayUserTagsNotInStory indexOfObject:tagName] inSection:2]; + [self tableView:tagsTableView didSelectRowAtIndexPath:indexPath]; + } else { + NSMutableDictionary *story = [appDelegate.activeStory mutableCopy]; + + [story setObject:[[story objectForKey:@"user_tags"] arrayByAddingObject:tagName] forKey:@"user_tags"]; + [appDelegate.storiesCollection markStory:story asSaved:YES forceUpdate:YES]; + [appDelegate.storiesCollection syncStoryAsSaved:story]; + [appDelegate adjustSavedStoryCount:tagName direction:1]; + + NSInteger row = [[self arrayUserTags] indexOfObject:tagName]; + [tagsTableView beginUpdates]; + [tagsTableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:row inSection:0]] + withRowAnimation:UITableViewRowAnimationTop]; + [tagsTableView endUpdates]; + } [addTagBar setText:@""]; } diff --git a/clients/ios/NewsBlur-iPhone-Info.plist b/clients/ios/NewsBlur-iPhone-Info.plist index ac8449f43..da8c2c649 100644 --- a/clients/ios/NewsBlur-iPhone-Info.plist +++ b/clients/ios/NewsBlur-iPhone-Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 7.0.0 + 7.0.1 CFBundleSignature ???? CFBundleURLTypes @@ -58,7 +58,7 @@ CFBundleVersion - 78 + 79 FacebookAppID 230426707030569 ITSAppUsesNonExemptEncryption