Loading src/com/owncloud/android/lib/resources/users/GetRemoteUserInfoOperation.java +14 −14 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { private static final String NODE_PHONE = "phone"; private static final String NODE_ADDRESS = "address"; private static final String NODE_WEBSITE = "website"; private static final String NODE_WEBPAGE = "webpage"; private static final String NODE_TWITTER = "twitter"; private static final String NODE_QUOTA = "quota"; Loading Loading @@ -164,8 +165,7 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { userInfo.setDisplayName(respData.getString(NODE_DISPLAY_NAME_ALT)); } if (respData.has(NODE_EMAIL) && !respData.isNull(NODE_EMAIL) && !TextUtils.isEmpty(respData.getString(NODE_EMAIL))) { if (hasData(respData, NODE_EMAIL)) { userInfo.setEmail(respData.getString(NODE_EMAIL)); } Loading @@ -187,25 +187,20 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { userInfo.setQuota(new Quota(quotaFree, quotaUsed, quotaTotal, quotaRelative, quotaValue)); } if (respData.has(NODE_PHONE) && !respData.isNull(NODE_PHONE) && !TextUtils.isEmpty(respData.getString(NODE_PHONE))) { if (hasData(respData, NODE_PHONE)) userInfo.setPhone(respData.getString(NODE_PHONE)); } if (respData.has(NODE_ADDRESS) && !respData.isNull(NODE_ADDRESS) && !TextUtils.isEmpty(respData.getString(NODE_ADDRESS))) { if (hasData(respData, NODE_ADDRESS)) userInfo.setAddress(respData.getString(NODE_ADDRESS)); } if (respData.has(NODE_WEBSITE) && !respData.isNull(NODE_WEBSITE) && !TextUtils.isEmpty(respData.getString(NODE_WEBSITE))) { // webpage field name pre NC12 if (hasData(respData, NODE_WEBSITE)) userInfo.setWebpage(respData.getString(NODE_WEBSITE)); } else if (hasData(respData, NODE_WEBPAGE)) userInfo.setWebpage(respData.getString(NODE_WEBPAGE)); if (respData.has(NODE_TWITTER) && !respData.isNull(NODE_TWITTER) && !TextUtils.isEmpty(respData.getString(NODE_TWITTER))) { if (hasData(respData, NODE_TWITTER)) userInfo.setTwitter(respData.getString(NODE_TWITTER)); } if (respData.has(NODE_ENABLED)) { userInfo.setEnabled(respData.getBoolean(NODE_ENABLED)); Loading Loading @@ -238,6 +233,11 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { return result; } private boolean hasData(JSONObject respData, String objectName) throws JSONException { return respData.has(objectName) && !respData.isNull(objectName) && !TextUtils.isEmpty(respData.getString(objectName)); } private boolean isSuccess(int status) { return (status == HttpStatus.SC_OK); } Loading Loading
src/com/owncloud/android/lib/resources/users/GetRemoteUserInfoOperation.java +14 −14 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { private static final String NODE_PHONE = "phone"; private static final String NODE_ADDRESS = "address"; private static final String NODE_WEBSITE = "website"; private static final String NODE_WEBPAGE = "webpage"; private static final String NODE_TWITTER = "twitter"; private static final String NODE_QUOTA = "quota"; Loading Loading @@ -164,8 +165,7 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { userInfo.setDisplayName(respData.getString(NODE_DISPLAY_NAME_ALT)); } if (respData.has(NODE_EMAIL) && !respData.isNull(NODE_EMAIL) && !TextUtils.isEmpty(respData.getString(NODE_EMAIL))) { if (hasData(respData, NODE_EMAIL)) { userInfo.setEmail(respData.getString(NODE_EMAIL)); } Loading @@ -187,25 +187,20 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { userInfo.setQuota(new Quota(quotaFree, quotaUsed, quotaTotal, quotaRelative, quotaValue)); } if (respData.has(NODE_PHONE) && !respData.isNull(NODE_PHONE) && !TextUtils.isEmpty(respData.getString(NODE_PHONE))) { if (hasData(respData, NODE_PHONE)) userInfo.setPhone(respData.getString(NODE_PHONE)); } if (respData.has(NODE_ADDRESS) && !respData.isNull(NODE_ADDRESS) && !TextUtils.isEmpty(respData.getString(NODE_ADDRESS))) { if (hasData(respData, NODE_ADDRESS)) userInfo.setAddress(respData.getString(NODE_ADDRESS)); } if (respData.has(NODE_WEBSITE) && !respData.isNull(NODE_WEBSITE) && !TextUtils.isEmpty(respData.getString(NODE_WEBSITE))) { // webpage field name pre NC12 if (hasData(respData, NODE_WEBSITE)) userInfo.setWebpage(respData.getString(NODE_WEBSITE)); } else if (hasData(respData, NODE_WEBPAGE)) userInfo.setWebpage(respData.getString(NODE_WEBPAGE)); if (respData.has(NODE_TWITTER) && !respData.isNull(NODE_TWITTER) && !TextUtils.isEmpty(respData.getString(NODE_TWITTER))) { if (hasData(respData, NODE_TWITTER)) userInfo.setTwitter(respData.getString(NODE_TWITTER)); } if (respData.has(NODE_ENABLED)) { userInfo.setEnabled(respData.getBoolean(NODE_ENABLED)); Loading Loading @@ -238,6 +233,11 @@ public class GetRemoteUserInfoOperation extends RemoteOperation { return result; } private boolean hasData(JSONObject respData, String objectName) throws JSONException { return respData.has(objectName) && !respData.isNull(objectName) && !TextUtils.isEmpty(respData.getString(objectName)); } private boolean isSuccess(int status) { return (status == HttpStatus.SC_OK); } Loading