Skip to content

Commit

Permalink
Improve post selection handling
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-taffe committed Nov 28, 2018
1 parent 719fecd commit c77acb0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions BetteReddit/Controller/PostListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ - (void)viewDidLoad {

-(void)changedSubreddit:(NSNotification *)notification{
self.current = notification.object;
NSInteger selection = self.postListView.selectedRow;
if(selection != -1){
PostTableViewCell *row = [self.postListView viewAtColumn:0 row:selection makeIfNecessary:false];
row.isSelected = false;
row.needsDisplay = true;
}
[self.current loadMoreSubredditPosts:false onComplete:^(NSArray * _Nullable newPosts){
dispatch_async(dispatch_get_main_queue(),^(void){
[self.postListView reloadData];
Expand Down Expand Up @@ -97,6 +103,8 @@ - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row{

- (void)tableViewSelectionDidChange:(NSNotification *)notification{
NSInteger selection = self.postListView.selectedRow;
if(selection == -1)
return;
PostTableViewCell *row = [self.postListView viewAtColumn:0 row:selection makeIfNecessary:false];
row.isSelected = true;
row.needsDisplay = true;
Expand Down

0 comments on commit c77acb0

Please sign in to comment.