Replace valueForKey with subscript access in RCTJavascriptLoader

Reviewed By: shergin

Differential Revision: D4559391

fbshipit-source-id: 44cb4900f93f2ac60dae3a461ed5344e1af08f3b
This commit is contained in:
Pieter De Baets 2017-02-15 03:41:32 -08:00 committed by Facebook Github Bot
parent a965f153ff
commit a2000d1200

View File

@ -230,7 +230,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoad
// For multipart responses packager sets X-Http-Status header in case HTTP status code
// is different from 200 OK
NSString *statusCodeHeader = [headers valueForKey:@"X-Http-Status"];
NSString *statusCodeHeader = headers[@"X-Http-Status"];
if (statusCodeHeader) {
statusCode = [statusCodeHeader integerValue];
}
@ -263,9 +263,9 @@ static RCTLoadingProgress *progressEventFromData(NSData *rawData)
}
RCTLoadingProgress *progress = [RCTLoadingProgress new];
progress.status = [info valueForKey:@"status"];
progress.done = [info valueForKey:@"done"];
progress.total = [info valueForKey:@"total"];
progress.status = info[@"status"];
progress.done = info[@"done"];
progress.total = info[@"total"];
return progress;
}
@ -281,12 +281,11 @@ static NSDictionary *userInfoForRawResponse(NSString *rawText)
}
NSMutableArray<NSDictionary *> *fakeStack = [NSMutableArray new];
for (NSDictionary *err in errors) {
[fakeStack addObject:
@{
[fakeStack addObject: @{
@"methodName": err[@"description"] ?: @"",
@"file": err[@"filename"] ?: @"",
@"lineNumber": err[@"lineNumber"] ?: @0
}];
}];
}
return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]};
}