diff options
author | Jonathan Willing <jwilling@me.com> | 2013-05-14 01:39:22 -0500 |
---|---|---|
committer | Jonathan Willing <jwilling@me.com> | 2013-05-14 01:39:22 -0500 |
commit | fc833912fbccae038c23a454802416165bbc3725 (patch) | |
tree | 33b4e19187c60a8fa0cef65b97d5d52593c906cc | |
parent | 1d7623348bfb8fa11a72fde1852ea21971c560e4 (diff) |
conform to formatting conventions
-rwxr-xr-x | example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm b/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm index 710c7c7a..3ebec857 100755 --- a/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm +++ b/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm @@ -143,17 +143,17 @@ void (^replaceImages)(NSError *error) = ^(NSError *error) { NSData * downloadedData = [[self delegate] MCOMessageView:self dataForPartWithUniqueID:partUniqueID]; NSData * previewData = [[self delegate] MCOMessageView:self previewForData:downloadedData isHTMLInlineImage:[self _isCID:url]]; - NSString *filename = [NSString stringWithFormat:@"%lu", (unsigned long)urlString.hash]; - NSURL *cacheURL = [self _cacheJPEGImageData:previewData withFilename:filename]; + NSString * filename = [NSString stringWithFormat:@"%lu", (unsigned long)urlString.hash]; + NSURL * cacheURL = [self _cacheJPEGImageData:previewData withFilename:filename]; - NSDictionary *args = @{ @"URLKey": urlString, @"LocalPathKey": cacheURL.absoluteString }; - NSString *jsonString = [self _jsonEscapedStringFromDictionary:args]; + NSDictionary * args = @{ @"URLKey": urlString, @"LocalPathKey": cacheURL.absoluteString }; + NSString * jsonString = [self _jsonEscapedStringFromDictionary:args]; - NSString *replaceScript = [NSString stringWithFormat:@"replaceImageSrc(\"%@\")", jsonString]; + NSString * replaceScript = [NSString stringWithFormat:@"replaceImageSrc(\"%@\")", jsonString]; [_webView stringByEvaluatingJavaScriptFromString:replaceScript]; }; - if (data == NULL) { + if (data == nil) { [[self delegate] MCOMessageView:self fetchDataForPartWithUniqueID:partUniqueID downloadedFinished:^(NSError * error) { replaceImages(error); }]; @@ -163,9 +163,10 @@ } } -- (NSString *) _jsonEscapedStringFromDictionary:(NSDictionary *)dictionary { - NSData *json = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil]; - NSString *jsonString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding]; +- (NSString *) _jsonEscapedStringFromDictionary:(NSDictionary *)dictionary +{ + NSData * json = [NSJSONSerialization dataWithJSONObject:dictionary options:0 error:nil]; + NSString * jsonString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding]; jsonString = [jsonString stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]; jsonString = [jsonString stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; return jsonString; @@ -173,7 +174,7 @@ - (NSURL *) _cacheJPEGImageData:(NSData *)imageData withFilename:(NSString *)filename { - NSString *path = [[NSTemporaryDirectory() stringByAppendingPathComponent:filename] stringByAppendingPathExtension:@"jpg"]; + NSString * path = [[NSTemporaryDirectory() stringByAppendingPathComponent:filename] stringByAppendingPathExtension:@"jpg"]; [imageData writeToFile:path atomically:YES]; return [NSURL fileURLWithPath:path]; } |