error handling for google reader import

This commit is contained in:
Roy Yang 2012-08-12 21:46:47 -07:00
parent 417ef5011b
commit a380ca28d4
9 changed files with 34 additions and 25 deletions

View file

@ -236,15 +236,15 @@
[category isEqualToString:@"comment_like"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"] showFindingStory:YES];
} else if ([category isEqualToString:@"sharedstory"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"] showFindingStory:YES];
} else if ([category isEqualToString:@"feedsub"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"feed_id"]];
NSString *contentIdStr = nil;
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:[activity objectForKey:@"with_user"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:[activity objectForKey:@"with_user"] showFindingStory:NO];
}
// have the selected cell deselect

View file

@ -71,7 +71,12 @@
[self.navigationController popViewControllerAnimated:YES];
if ([type isEqualToString:@"google"]) {
[appDelegate.firstTimeUserAddSitesViewController importFromGoogleReader];
if (error.length) {
[appDelegate.firstTimeUserAddSitesViewController importFromGoogleReaderFailed:error];
} else {
[appDelegate.firstTimeUserAddSitesViewController importFromGoogleReader];
}
} else if ([type isEqualToString:@"facebook"]) {
if (error.length) {
[self showError:error];
@ -89,12 +94,12 @@
return NO;
}
// for failed google reader authorization
if ([URLString hasPrefix:[NSString stringWithFormat:@"http://%@/import/callback", NEWSBLUR_URL]]) {
[self.navigationController popViewControllerAnimated:YES];
[appDelegate.firstTimeUserAddSitesViewController importFromGoogleReaderFailed];
return NO;
}
// // for failed google reader authorization
// if ([URLString hasPrefix:[NSString stringWithFormat:@"http://%@/import/callback", NEWSBLUR_URL]]) {
// [self.navigationController popViewControllerAnimated:YES];
// [appDelegate.firstTimeUserAddSitesViewController importFromGoogleReaderFailed];
// return NO;
// }
return YES;

View file

@ -86,7 +86,7 @@
16);
[self.view addSubview:checkmarkView];
[self addSite:@"http://blog.newsblur.com/"];
[self addSite:@"http://blog.newsblur.com/rss"];
}
- (IBAction)tapPopularButton:(id)sender {
@ -129,7 +129,8 @@
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:siteUrl forKey:@"url"];
[request setPostValue:@"true" forKey:@"auto_active"];
[request setPostValue:@"true" forKey:@"skip_fetch"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(finishAddSite:)];
[request setDidFailSelector:@selector(requestFailed:)];

View file

@ -27,6 +27,6 @@
- (void)addCategories;
- (void)importFromGoogleReader;
- (void)importFromGoogleReaderFailed;
- (void)importFromGoogleReaderFailed:(NSString *)error;
- (void)updateSites;
@end

View file

@ -117,9 +117,9 @@
[request startAsynchronous];
}
- (void)importFromGoogleReaderFailed {
- (void)importFromGoogleReaderFailed:(NSString *)error {
[self.googleReaderButton setTitle:@"Retry Google Reader" forState:UIControlStateNormal];
self.instructionLabel.text = @"Importing from Google Reader failed. Please try again.";
self.instructionLabel.text = error;
}
- (void)finishImportFromGoogleReader:(ASIHTTPRequest *)request {

View file

@ -235,12 +235,13 @@
[appDelegate loadTryFeedDetailView:feedIdStr
withStory:contentIdStr
isSocial:YES
withUser:[interaction objectForKey:@"with_user"]];
withUser:[interaction objectForKey:@"with_user"]
showFindingStory:YES];
appDelegate.tryFeedCategory = category;
} else if ([category isEqualToString:@"story_reshare"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[interaction objectForKey:@"with_user"] objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[interaction objectForKey:@"with_user"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[interaction objectForKey:@"with_user"] showFindingStory:YES];
appDelegate.tryFeedCategory = category;
}

View file

@ -195,7 +195,7 @@
- (void)showAddSiteModal;
- (void)showMoveSite;
- (void)loadFeedDetailView;
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user;
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user showFindingStory:(BOOL)showHUD;
- (void)loadRiverFeedDetailView;
- (void)loadStoryDetailView;
- (void)adjustStoryDetailWebView;

View file

@ -352,8 +352,10 @@
}
}
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user {
[self.storyDetailViewController showFindingStoryHUD];
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user showFindingStory:(BOOL)showHUD {
if (showHUD) {
[self.storyDetailViewController showFindingStoryHUD];
}
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
[self.navigationController popToRootViewControllerAnimated:NO];

View file

@ -157,7 +157,7 @@
#pragma mark Table View - Profile Modules List
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
return 2;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
@ -279,22 +279,22 @@
} else if ([category isEqualToString:@"comment_reply"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"] showFindingStory:YES];
appDelegate.tryFeedCategory = category;
} else if ([category isEqualToString:@"comment_like"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:self.userProfile];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:self.userProfile showFindingStory:YES];
appDelegate.tryFeedCategory = category;
} else if ([category isEqualToString:@"sharedstory"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [self.userProfile objectForKey:@"id"]];
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:self.userProfile];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:self.userProfile showFindingStory:YES];
appDelegate.tryFeedCategory = category;
} else if ([category isEqualToString:@"feedsub"]) {
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"feed_id"]];
NSString *contentIdStr = nil;
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:self.userProfile];
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:self.userProfile showFindingStory:NO];
}
// have the selected cell deselect