improve post selection handling

This commit is contained in:
Sami Samhuri 2015-06-28 13:53:44 -07:00
parent 4d20adec84
commit 1f54984542

View file

@ -195,15 +195,15 @@ static const NSUInteger SectionPublished = 1;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self requestStatusWithCaching:YES];
if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) {
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
}
PMKPromise *postP = self.postCollections ? [PMKPromise promiseWithValue:self.postCollections] : [self requestPostsWithCaching:YES];
postP.then(^{
if (self.selectedIndexPath && [self postForIndexPath:self.selectedIndexPath]) {
[self.tableView selectRowAtIndexPath:self.selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];
self.selectedIndexPath = nil;
}
if (self.clearsSelectionOnViewWillAppear && self.tableView.indexPathForSelectedRow) {
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
}
});
}