Skip to content

Commit

Permalink
Just some cleanup and minor refactoring/code style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgio Calderolla committed Jun 23, 2014
1 parent 106e078 commit 7adbf8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Catch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,10 @@
44717AC61913A08700580054 /* CatchFeedHelper */ = {
isa = PBXGroup;
children = (
4412E8161957F09200701124 /* com.giorgiocalderolla.Catch.CatchFeedHelper.entitlements */,
44717AD71913A1C900580054 /* CTCFeedChecker.h */,
44717AD81913A1C900580054 /* CTCFeedChecker.m */,
44717AAB19131BC700580054 /* CTCFeedParser.h */,
44717AAC19131BC700580054 /* CTCFeedParser.m */,
44717ACD1913A08700580054 /* main.m */,
44717AC71913A08700580054 /* Supporting Files */,
);
path = CatchFeedHelper;
Expand All @@ -334,6 +332,8 @@
44717AC71913A08700580054 /* Supporting Files */ = {
isa = PBXGroup;
children = (
4412E8161957F09200701124 /* com.giorgiocalderolla.Catch.CatchFeedHelper.entitlements */,
44717ACD1913A08700580054 /* main.m */,
44717AC81913A08700580054 /* CatchFeedHelper-Info.plist */,
44717AC91913A08700580054 /* InfoPlist.strings */,
44717ACC1913A08700580054 /* CatchFeedHelper-Prefix.pch */,
Expand Down
14 changes: 9 additions & 5 deletions CatchFeedHelper/CTCFeedChecker.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ - (void)checkShowRSSFeed:(NSURL *)feedURL

NSString *downloadFolderPath = downloadFolderURL.path;

// Flush the cache, we want fresh results
[NSURLCache.sharedURLCache removeAllCachedResponses];

// Download the feed
NSXMLDocument *feed = [self downloadFeed:feedURL];
if (!feed) {
Expand Down Expand Up @@ -81,11 +78,16 @@ - (void)checkShowRSSFeed:(NSURL *)feedURL

- (NSXMLDocument*)downloadFeed:(NSURL*)feedURL {
NSLog(@"Downloading feed %@", feedURL);

// Flush the cache, we want fresh results
[NSURLCache.sharedURLCache removeAllCachedResponses];

NSError *error = nil;

// Create a NSXMLDocument by downloading feed
NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:feedURL options:NSXMLNodeOptionsNone error:&error];
NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:feedURL
options:NSXMLNodeOptionsNone
error:&error];

if (!document) {
NSLog(@"Feed download failed: %@", error);
Expand Down Expand Up @@ -181,7 +183,9 @@ - (NSString *)downloadFile:(NSURL *)fileURL
NSURLRequest *urlRequest = [[NSURLRequest alloc] initWithURL:fileURL];
NSURLResponse *urlResponse = NSURLResponse.new;
NSError *downloadError = NSError.new;
downloadedFile = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&urlResponse error:&downloadError];
downloadedFile = [NSURLConnection sendSynchronousRequest:urlRequest
returningResponse:&urlResponse
error:&downloadError];

if (!downloadedFile) return nil;

Expand Down

0 comments on commit 7adbf8b

Please sign in to comment.