mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert "Show bundle download progress on iOS"
This reverts commit 373f7edf55.
This commit is contained in:
@@ -198,6 +198,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoad
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RCTMultipartDataTask *task = [[RCTMultipartDataTask alloc] initWithURL:scriptURL partHandler:^(NSInteger statusCode, NSDictionary *headers, NSData *data, NSError *error, BOOL done) {
|
||||
if (!done) {
|
||||
if (onProgress) {
|
||||
@@ -260,11 +261,6 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoad
|
||||
}
|
||||
|
||||
onComplete(nil, data, data.length);
|
||||
} progressHandler:^(NSDictionary *headers, NSNumber *loaded, NSNumber *total) {
|
||||
// Only care about download progress events for the javascript bundle part.
|
||||
if ([headers[@"Content-Type"] isEqualToString:@"application/javascript"]) {
|
||||
onProgress(progressEventFromDownloadProgress(loaded, total));
|
||||
}
|
||||
}];
|
||||
|
||||
[task startTask];
|
||||
@@ -291,16 +287,6 @@ static RCTLoadingProgress *progressEventFromData(NSData *rawData)
|
||||
return progress;
|
||||
}
|
||||
|
||||
static RCTLoadingProgress *progressEventFromDownloadProgress(NSNumber *total, NSNumber *done)
|
||||
{
|
||||
RCTLoadingProgress *progress = [RCTLoadingProgress new];
|
||||
progress.status = @"Downloading JavaScript bundle";
|
||||
// Progress values are in bytes transform them to kilobytes for smaller numbers.
|
||||
progress.done = done != nil ? @([done integerValue] / 1024) : nil;
|
||||
progress.total = total != nil ? @([total integerValue] / 1024) : nil;
|
||||
return progress;
|
||||
}
|
||||
|
||||
static NSDictionary *userInfoForRawResponse(NSString *rawText)
|
||||
{
|
||||
NSDictionary *parsedResponse = RCTJSONParse(rawText, nil);
|
||||
|
||||
Reference in New Issue
Block a user