Issue 72: Contact.Save: onSuccess callback is called when contact is not saved.

This commit is contained in:
macdonst 2011-04-29 02:06:58 +08:00
parent 0aacfbdd50
commit fd8bb2f671

View File

@ -46,7 +46,14 @@ public class ContactManager extends Plugin {
return new PluginResult(status, res, "navigator.service.contacts.cast");
}
else if (action.equals("save")) {
return new PluginResult(status, contactAccessor.save(args.getJSONObject(0)));
if (contactAccessor.save(args.getJSONObject(0))) {
return new PluginResult(status, result);
}
else {
JSONObject r = new JSONObject();
r.put("code", 0);
return new PluginResult(PluginResult.Status.ERROR, r);
}
}
else if (action.equals("remove")) {
if (contactAccessor.remove(args.getString(0))) {