removed verbose console output, added default address type 'home', [CB-1374] escape new line char in returned contacts.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/fe9e0a85 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/fe9e0a85 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/fe9e0a85 Branch: refs/heads/master Commit: fe9e0a8586ab8c35b4583353b5c7b14f5790a9d7 Parents: a27394b Author: Jesse MacFadyen <purplecabb...@gmail.com> Authored: Mon Sep 10 11:28:56 2012 -0700 Committer: Jesse MacFadyen <purplecabb...@gmail.com> Committed: Mon Sep 10 11:28:56 2012 -0700 ---------------------------------------------------------------------- .../standalone/cordovalib/Commands/Contacts.cs | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/fe9e0a85/templates/standalone/cordovalib/Commands/Contacts.cs ---------------------------------------------------------------------- diff --git a/templates/standalone/cordovalib/Commands/Contacts.cs b/templates/standalone/cordovalib/Commands/Contacts.cs index 1157b91..8428ea5 100644 --- a/templates/standalone/cordovalib/Commands/Contacts.cs +++ b/templates/standalone/cordovalib/Commands/Contacts.cs @@ -303,6 +303,10 @@ namespace WP7CordovaClassLib.Cordova.Commands { foreach (JSONContactAddress address in contact.addresses) { + if (address.type == null) + { + address.type = "home"; // set a default + } string fieldType = address.type.ToLower(); if (fieldType == "work") { @@ -565,8 +569,7 @@ namespace WP7CordovaClassLib.Cordova.Commands address.PhysicalAddress.PostalCode, address.PhysicalAddress.CountryRegion); - - Debug.WriteLine("getFormattedJSONAddress returning :: " + jsonAddress); + //Debug.WriteLine("getFormattedJSONAddress returning :: " + jsonAddress); return "{" + jsonAddress + "}"; } @@ -579,7 +582,7 @@ namespace WP7CordovaClassLib.Cordova.Commands retVal += this.getFormattedJSONAddress(address, false) + ","; } - Debug.WriteLine("FormatJSONAddresses returning :: " + retVal); + //Debug.WriteLine("FormatJSONAddresses returning :: " + retVal); return retVal.TrimEnd(','); } @@ -647,9 +650,9 @@ namespace WP7CordovaClassLib.Cordova.Commands FormatJSONName(con), con.Notes.FirstOrDefault()); - Debug.WriteLine("jsonContact = " + jsonContact); - - return "{" + jsonContact + "}"; + //Debug.WriteLine("jsonContact = " + jsonContact); + // JSON requires new line characters be escaped + return "{" + jsonContact.Replace("\n", "\\n") +"}"; } } }