Use utility app for http requests; Make them async.

This commit is contained in:
Paul Chote
2010-12-30 13:34:13 +13:00
parent 428999fc0b
commit 39ed6087cb
12 changed files with 100 additions and 49 deletions

View File

@@ -69,7 +69,7 @@
[[NSFileManager defaultManager] removeItemAtPath:filename error:NULL];
bytesCompleted = bytesTotal = -1;
[[JSBridge sharedInstance] notifyDownloadProgress:self];
[[JSBridge sharedInstance] runCallback:@"downloadProgressed" withArgument:[self key]];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSFileHandleReadCompletionNotification
object:[[task standardOutput] fileHandleForReading]];
@@ -120,7 +120,7 @@
}
}
}
[[JSBridge sharedInstance] notifyDownloadProgress:self];
[[JSBridge sharedInstance] runCallback:@"downloadProgressed" withArgument:[self key]];
// Keep reading
if ([n object] != nil)
@@ -171,8 +171,8 @@
}
}
}
[[JSBridge sharedInstance] notifyExtractProgress:self];
[[JSBridge sharedInstance] runCallback:@"extractProgressed" withArgument:[self key]];
// Keep reading
if ([n object] != nil)
[[n object] readInBackgroundAndNotify];