Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1695)

Unified Diff: Vermilion/Modules/GoogleDocs/GoogleDocsSaveAsActions.m

Issue 4675073: Fix up build Base URL: http://qsb-mac.googlecode.com/svn/trunk/
Patch Set: Created 14 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Vermilion/Modules/GoogleDocs/GoogleDocsSaveAsActions.m
===================================================================
--- Vermilion/Modules/GoogleDocs/GoogleDocsSaveAsActions.m (revision 1083)
+++ Vermilion/Modules/GoogleDocs/GoogleDocsSaveAsActions.m (working copy)
@@ -70,9 +70,10 @@
// Send a user notification to the Vermilion client.
- (void)informUserWithDescription:(NSString *)description
type:(HGSUserMessageType)type
- fetcher:(GDataHTTPFetcher *)fetcher;
-- (void)fetcher:(GDataHTTPFetcher *)fetcher finishedWithData:(NSData *)data;
-- (void)fetcher:(GDataHTTPFetcher *)fetcher failedWithError:(NSError *)error;
+ fetcher:(GTMHTTPFetcher *)fetcher;
+- (void)fetcher:(GTMHTTPFetcher *)fetcher
+ finishedWithData:(NSData *)data
+ error:(NSError *)error;
@end
@@ -164,21 +165,35 @@
NSURLRequest *request = [service requestForURL:downloadURL
ETag:nil
httpMethod:nil];
- GDataHTTPFetcher *fetcher = [GDataHTTPFetcher
- httpFetcherWithRequest:request];
+ GTMHTTPFetcher *fetcher = [GTMHTTPFetcher fetcherWithRequest:request];
[fetcher setProperties:saveAsInfo];
[fetcher beginFetchWithDelegate:self
- didFinishSelector:@selector(fetcher:finishedWithData:)
- didFailSelector:@selector(fetcher:failedWithError:)];
+ didFinishSelector:@selector(fetcher:finishedWithData:error:)];
}
-- (void)fetcher:(GDataHTTPFetcher *)fetcher finishedWithData:(NSData *)data {
+- (void)fetcher:(GTMHTTPFetcher *)fetcher
+ finishedWithData:(NSData *)data
+ error:(NSError *)error {
+ if (error) {
+ NSString *errorFormat
+ = HGSLocalizedString(@"Could not fetch Google Doc! (%d)",
+ @"A dialog label explaining to the user that we could "
+ @"not fetch a Google Doc. %d is an error code.");
+ NSString *errorString = [NSString stringWithFormat:errorFormat,
+ [error code]];
+ [self informUserWithDescription:errorString
+ type:kHGSUserMessageErrorType
+ fetcher:fetcher];
+ HGSLog(@"GoogleDocsSaveAsActions download of file failed: error=%d '%@'.",
+ [error code], [error localizedDescription]);
+ return;
+ }
// save the file to the local path specified by the user
NSURL *saveURL = [fetcher propertyForKey:kHGSSaveAsURLKey];
NSString *extension = [fetcher propertyForKey:kGoogleDocsDocSaveAsExtensionKey];
NSString *savePath = [saveURL path];
savePath = [savePath stringByAppendingPathExtension:extension];
- NSError *error = nil;
+ error = nil;
BOOL didWrite = [data writeToFile:savePath
options:NSAtomicWrite
error:&error];
@@ -197,23 +212,9 @@
}
}
-- (void)fetcher:(GDataHTTPFetcher *)fetcher failedWithError:(NSError *)error {
- NSString *errorFormat
- = HGSLocalizedString(@"Could not fetch Google Doc! (%d)",
- @"A dialog label explaining to the user that we could "
- @"not fetch a Google Doc. %d is an error code.");
- NSString *errorString = [NSString stringWithFormat:errorFormat,
- [error code]];
- [self informUserWithDescription:errorString
- type:kHGSUserMessageErrorType
- fetcher:fetcher];
- HGSLog(@"GoogleDocsSaveAsActions download of file failed: error=%d '%@'.",
- [error code], [error localizedDescription]);
-}
-
- (void)informUserWithDescription:(NSString *)description
type:(HGSUserMessageType)type
- fetcher:(GDataHTTPFetcher *)fetcher {
+ fetcher:(GTMHTTPFetcher *)fetcher {
HGSResult *result = [fetcher propertyForKey:kHGSSaveAsHGSResultKey];
NSString *category = [result valueForKey:kGoogleDocsDocCategoryKey];
HGSAssert(category, nil);
« no previous file with comments | « Vermilion/Modules/GoogleBookmarks/GoogleBookmarksSource.m ('k') | Vermilion/Vermilion/HGSGDataServiceSource.m » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b