removed verbose console output, added default address type 'home', [CB-1374] escape new line char in returned contacts.
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 @@
{
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 @@
address.PhysicalAddress.PostalCode,
address.PhysicalAddress.CountryRegion);
-
- Debug.WriteLine("getFormattedJSONAddress returning :: " + jsonAddress);
+ //Debug.WriteLine("getFormattedJSONAddress returning :: " + jsonAddress);
return "{" + jsonAddress + "}";
}
@@ -579,7 +582,7 @@
retVal += this.getFormattedJSONAddress(address, false) + ",";
}
- Debug.WriteLine("FormatJSONAddresses returning :: " + retVal);
+ //Debug.WriteLine("FormatJSONAddresses returning :: " + retVal);
return retVal.TrimEnd(',');
}
@@ -647,9 +650,9 @@
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") +"}";
}
}
}