cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasongin <...@git.apache.org>
Subject [GitHub] cordova-plugin-contacts pull request: CB-8115 Save contact birthda...
Date Thu, 03 Dec 2015 19:31:15 GMT
Github user jasongin commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-contacts/pull/95#discussion_r46598813
  
    --- Diff: src/android/ContactAccessorSdk5.java ---
    @@ -1854,6 +1859,39 @@ public boolean remove(String id) {
             return (result > 0) ? true : false;
         }
     
    +    /**
    +     * Gets birthday date from contact JSON object
    +     * @param contact an object to get birthday from
    +     * @return birthday or null, if the field isn't present or
    +     *   is malformed in the contact
    +     */
    +    private Date getBirthday(JSONObject contact) {
    +        try {
    +            Long timestamp = contact.getLong("birthday");
    +            return new Date(timestamp);
    +        } catch (JSONException e) {
    +            Log.d(LOG_TAG, "Could not get birthday: " + e.getMessage());
    +            return null;
    +        }
    +    }
    +
    +    /**
    +     * Gets birthday from contacts database cursor object
    +     * @param c cursor for the contact
    +     * @return birthday or null, if birthday column is empty or
    +     * the value can't be parsed into valid date object
    +     */
    +    private Date getBirthday(Cursor c) {
    +        int colBirthday = c.getColumnIndex(CommonDataKinds.Event.START_DATE);
    +
    +        try {
    +            return Date.valueOf(c.getString(colBirthday));
    +        } catch (IllegalArgumentException e) {
    +            Log.d(LOG_TAG, "Failed to get birthday for contact: " + e.getMessage());
    --- End diff --
    
    As explained previously:  Log.e(LOG_TAG, "Failed...   ", e);


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message