Permalink
Browse files

BUGFIX: small readability error handling improvement - sometimes HUD …

…was spinning forever.
  • Loading branch information...
1 parent 6288b0d commit 5bbb4c924bcb784d4e114f8ad0491bd882320472 @VilemKurz VilemKurz committed Apr 23, 2012
Showing with 13 additions and 10 deletions.
  1. +11 −9 Classes/ShareKit/Sharers/Services/Readability/SHKReadability.m
  2. +2 −1 ShareKit.xcodeproj/project.pbxproj
@@ -268,21 +268,23 @@ - (void)handleUnsuccessfulTicket:(NSData *)data
// this is the error message for revoked access, Readability Error Message: "You are unauthenticated. (API protected by OAuth)."
if ([errorMessage rangeOfString:@"unauthenticated"].location != NSNotFound) {
[self shouldReloginWithPendingAction:SHKPendingSend];
- return;
+ return;
}
NSDictionary *errorDict = [errorMessage objectFromJSONString];
if ([[errorDict objectForKey:@"success"] intValue] == 0)
{
- NSError * error = nil;
- if ([[errorDict objectForKey:@"messages"] isKindOfClass:[NSArray class]]) {
- error = [NSError errorWithDomain:@"Readability" code:2 userInfo:[NSDictionary dictionaryWithObject:[[errorDict objectForKey:@"messages"] objectAtIndex:0] forKey:NSLocalizedDescriptionKey]];
+ NSError * error = nil;
+ if ([[errorDict objectForKey:@"messages"] isKindOfClass:[NSArray class]]) {
+ error = [NSError errorWithDomain:@"Readability" code:2 userInfo:[NSDictionary dictionaryWithObject:[[errorDict objectForKey:@"messages"] objectAtIndex:0] forKey:NSLocalizedDescriptionKey]];
+ }
+ if ([[errorDict objectForKey:@"messages"] objectForKey:@"url"]) {
+ error = [NSError errorWithDomain:@"Readability" code:2 userInfo:[NSDictionary dictionaryWithObject:[[[errorDict objectForKey:@"messages"] objectForKey:@"url"] objectAtIndex:0] forKey:NSLocalizedDescriptionKey]];
+ }
+ [self sendDidFailWithError:error];
+ } else {
+ [self sendDidFinish]; //otherways HUD might spin forever if success is 1
}
- if ([[errorDict objectForKey:@"messages"] objectForKey:@"url"]) {
- error = [NSError errorWithDomain:@"Readability" code:2 userInfo:[NSDictionary dictionaryWithObject:[[[errorDict objectForKey:@"messages"] objectForKey:@"url"] objectAtIndex:0] forKey:NSLocalizedDescriptionKey]];
- }
- [self sendDidFailWithError:error];
- }
}
- (void)shareFormSave:(SHKFormController *)form
@@ -14,7 +14,6 @@
2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; };
28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD735F0D9D9599002E5188 /* MainWindow.xib */; };
28F335F11007B36200424DE2 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28F335F01007B36200424DE2 /* RootViewController.xib */; };
- 3BD2BD54153431390042EB86 /* SHKCustomFormControllerLargeTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BD2BD53153431390042EB86 /* SHKCustomFormControllerLargeTextField.m */; };
4312CF7C11CB33E200E61D7A /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4312CF7B11CB33E200E61D7A /* MessageUI.framework */; };
43150A8D11E78697008C6B68 /* SHKInstapaper.m in Sources */ = {isa = PBXBuildFile; fileRef = 43150A8C11E78697008C6B68 /* SHKInstapaper.m */; };
432B147C11FF4B0700291B37 /* SHKPhotoAlbum.m in Sources */ = {isa = PBXBuildFile; fileRef = 432B147B11FF4B0700291B37 /* SHKPhotoAlbum.m */; };
@@ -96,6 +95,7 @@
7A333EE514CC5B9D0060900C /* NSHTTPCookieStorage+DeleteForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A333EE414CC5B9D0060900C /* NSHTTPCookieStorage+DeleteForURL.m */; };
7A36F42714B2021100372747 /* SHKSharerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A36F42614B2021100372747 /* SHKSharerDelegate.m */; };
7A3C61EE147520B700C47D14 /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A3C61ED147520B700C47D14 /* Twitter.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
+ 7A5474E315455617000226FF /* SHKCustomFormControllerLargeTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BD2BD53153431390042EB86 /* SHKCustomFormControllerLargeTextField.m */; };
7A89681D14C80F9900DB07AF /* SHKFormControllerLargeTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AF78BB214B71FD8008ACA5D /* SHKFormControllerLargeTextField.m */; };
7AA40554146F0EFF00685C81 /* SHKCustomActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AA40553146F0EFF00685C81 /* SHKCustomActionSheet.m */; };
7AA40570146F1D6400685C81 /* ShareKitDemoConfigurator.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AA4056F146F1D6400685C81 /* ShareKitDemoConfigurator.m */; };
@@ -1324,6 +1324,7 @@
7A25903714CD4E8000FBA124 /* NSMutableDictionary+NSNullsToEmptyStrings.m in Sources */,
7AF2523814F0499E00CE8709 /* JSONKit.m in Sources */,
FDB495A41520349A00505A99 /* SHKReadability.m in Sources */,
+ 7A5474E315455617000226FF /* SHKCustomFormControllerLargeTextField.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit 5bbb4c9

Please sign in to comment.