mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Proper error message on failed mark as unread in ios app.
This commit is contained in:
parent
3688ad342d
commit
fe789de2c3
2 changed files with 28 additions and 11 deletions
|
@ -952,7 +952,10 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
hud.mode = MBProgressHUDModeText;
|
||||
hud.removeFromSuperViewOnHide = YES;
|
||||
|
||||
NSIndexPath *topRow = [[self.feedTitlesTable indexPathsForVisibleRows] objectAtIndex:0];
|
||||
NSIndexPath *topRow;
|
||||
if ([[self.feedTitlesTable indexPathsForVisibleRows] count]) {
|
||||
topRow = [[self.feedTitlesTable indexPathsForVisibleRows] objectAtIndex:0];
|
||||
}
|
||||
int selectedSegmentIndex = [self.intelligenceControl selectedSegmentIndex];
|
||||
self.stillVisibleFeeds = [NSMutableDictionary dictionary];
|
||||
|
||||
|
@ -988,14 +991,16 @@ heightForHeaderInSection:(NSInteger)section {
|
|||
[self.feedTitlesTable reloadData];
|
||||
|
||||
NSIndexPath *newMiddleRow;
|
||||
if ([self.feedTitlesTable numberOfRowsInSection:topRow.section] == 0) {
|
||||
if (topRow && [self.feedTitlesTable numberOfRowsInSection:topRow.section] == 0) {
|
||||
newMiddleRow = [[self.feedTitlesTable indexPathsForVisibleRows] objectAtIndex:0];
|
||||
} else {
|
||||
} else if (topRow) {
|
||||
newMiddleRow = [NSIndexPath indexPathForRow:0 inSection:topRow.section];
|
||||
}
|
||||
[self.feedTitlesTable scrollToRowAtIndexPath:newMiddleRow
|
||||
atScrollPosition:UITableViewScrollPositionTop
|
||||
animated:NO];
|
||||
if (newMiddleRow) {
|
||||
[self.feedTitlesTable scrollToRowAtIndexPath:newMiddleRow
|
||||
atScrollPosition:UITableViewScrollPositionTop
|
||||
animated:NO];
|
||||
}
|
||||
[self.feedTitlesTable
|
||||
reloadRowsAtIndexPaths:[self.feedTitlesTable indexPathsForVisibleRows]
|
||||
withRowAnimation:direction == 1 ? UITableViewRowAnimationLeft : UITableViewRowAnimationRight];
|
||||
|
|
|
@ -554,13 +554,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)requestFailed:(ASIHTTPRequest *)request {
|
||||
NSLog(@"Error in story detail: %@", [request error]);
|
||||
- (void)requestFailed:(id)request {
|
||||
NSString *error;
|
||||
if ([request error]) {
|
||||
error = [NSString stringWithFormat:@"%@", [request error]];
|
||||
if ([request class] == [ASIHTTPRequest class]) {
|
||||
NSLog(@"Error in story detail: %@", [request error]);
|
||||
if ([request error]) {
|
||||
error = [NSString stringWithFormat:@"%@", [request error]];
|
||||
} else {
|
||||
error = @"The server barfed!";
|
||||
}
|
||||
} else {
|
||||
error = @"The server barfed!";
|
||||
error = request;
|
||||
}
|
||||
[self informError:error];
|
||||
}
|
||||
|
@ -786,6 +790,14 @@
|
|||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
NSString *responseString = [request responseString];
|
||||
NSDictionary *results = [[NSDictionary alloc]
|
||||
initWithDictionary:[responseString JSONValue]];
|
||||
|
||||
if ([[results objectForKey:@"code"] intValue] < 0) {
|
||||
return [self requestFailed:[results objectForKey:@"message"]];
|
||||
}
|
||||
|
||||
[appDelegate markActiveStoryUnread];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue