From fc833912fbccae038c23a454802416165bbc3725 Mon Sep 17 00:00:00 2001 From: Jonathan Willing Date: Tue, 14 May 2013 01:39:22 -0500 Subject: conform to formatting conventions --- .../ios/iOS UI Test/iOS UI Test/MCOMessageView.mm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'example') 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]; } -- cgit v1.2.3