aboutsummaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-05-14 22:31:51 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-05-14 22:31:51 -0700
commit8e361569d850f689179e469ed413aa45ef7bf1ec (patch)
tree421101753a691c7b01a28369e678f80fff8f7fc4 /example
parent4d4c38e55607ac8ee2819ff904834d5a9b8fa922 (diff)
Don't encode JSON dictionary into a string
Diffstat (limited to 'example')
-rw-r--r--example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj2
-rwxr-xr-xexample/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm4
-rw-r--r--example/ios/iOS UI Test/iOS UI Test/MCOMessageViewScript.js7
-rwxr-xr-xexample/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm7
4 files changed, 7 insertions, 13 deletions
diff --git a/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
index a4e6718f..4b8dae30 100644
--- a/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
+++ b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
@@ -24,7 +24,6 @@
AB9EAE3617036FD700D750C7 /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB9EAE3417036FD600D750C7 /* SettingsViewController.m */; };
AB9EAE3717036FD700D750C7 /* SettingsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB9EAE3517036FD700D750C7 /* SettingsViewController.xib */; };
AB9EAE40170374D900D750C7 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB9EAE3F170374D900D750C7 /* Security.framework */; };
- ABE40268173F0151007F1FB3 /* MCOMessageViewScript.js in Sources */ = {isa = PBXBuildFile; fileRef = ABE40267173F0151007F1FB3 /* MCOMessageViewScript.js */; };
ABE40269173F0282007F1FB3 /* MCOMessageViewScript.js in Resources */ = {isa = PBXBuildFile; fileRef = ABE40267173F0151007F1FB3 /* MCOMessageViewScript.js */; };
ABE4026B173F3FCE007F1FB3 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABE4026A173F3FCE007F1FB3 /* ImageIO.framework */; };
B12AAA3417322654003551C7 /* MCOMessageView.mm in Sources */ = {isa = PBXBuildFile; fileRef = B12AAA3017322654003551C7 /* MCOMessageView.mm */; };
@@ -338,7 +337,6 @@
AB665BCD17134336007F2151 /* FXKeychain.m in Sources */,
B12AAA3417322654003551C7 /* MCOMessageView.mm in Sources */,
B12AAA3517322654003551C7 /* MCTMsgViewController.mm in Sources */,
- ABE40268173F0151007F1FB3 /* MCOMessageViewScript.js in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
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 c39ee1af..158387d2 100755
--- a/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm
+++ b/example/ios/iOS UI Test/iOS UI Test/MCOMessageView.mm
@@ -147,7 +147,7 @@
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];
};
@@ -165,8 +165,6 @@
{
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;
}
diff --git a/example/ios/iOS UI Test/iOS UI Test/MCOMessageViewScript.js b/example/ios/iOS UI Test/iOS UI Test/MCOMessageViewScript.js
index 1078b04b..37d60649 100644
--- a/example/ios/iOS UI Test/iOS UI Test/MCOMessageViewScript.js
+++ b/example/ios/iOS UI Test/iOS UI Test/MCOMessageViewScript.js
@@ -16,14 +16,13 @@ var findCIDImageURL = function() {
return JSON.stringify(imgLinks);
}
-var replaceImageSrc = function(jsonString) {
- var parsedJson = JSON.parse(jsonString);
+var replaceImageSrc = function(info) {
var images = imageElements();
for (var i = 0; i < images.length; i++) {
var url = images[i].getAttribute('src');
- if (url.indexOf(parsedJson.URLKey) == 0) {
- images[i].setAttribute('src', parsedJson.LocalPathKey);
+ if (url.indexOf(info.URLKey) == 0) {
+ images[i].setAttribute('src', info.LocalPathKey);
break;
}
}
diff --git a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm
index b60e91c7..dd2b36ee 100755
--- a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm
+++ b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm
@@ -251,15 +251,14 @@ typedef void (^DownloadCallback)(NSError * error);
[info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailFromImageAlways];
[info setObject:(id) [NSNumber numberWithFloat:(float) IMAGE_PREVIEW_WIDTH] forKey:(id) kCGImageSourceThumbnailMaxPixelSize];
thumbnail = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, (__bridge CFDictionaryRef) info);
- //[info release];
CGImageDestinationRef destination;
NSMutableData * destData = [NSMutableData data];
destination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef) destData,
- + (CFStringRef) @"public.jpeg",
- + 1, NULL);
-
+ (CFStringRef) @"public.jpeg",
+ 1, NULL);
+
CGImageDestinationAddImage(destination, thumbnail, NULL);
CGImageDestinationFinalize(destination);