private static boolean checkCurrentUser(final AVCallback callback) { if (AVUser.getCurrentUser() == null) { if (callback != null) { callback.internalDone(null, AVErrorUtils.sessionMissingException()); } return false; } return true; }
private static boolean checkCurrentUser(final AVCallback callback) { if (AVUser.getCurrentUser() == null) { if (callback != null) { callback.internalDone(null, AVErrorUtils.sessionMissingException()); } return false; } return true; }
@Deprecated public static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count, final String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = statusQueryMap(userId, sid, count, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
@Deprecated public static void getInboxUnreadStatusesCountWithInboxTypeInBackgroud(long sid, long count, final String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = statusQueryMap(userId, sid, count, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
/** * <p> * 创建follower查询。创建follower查询后,您可以使用whereEqualTo("follower", userFollower)查询特定的follower。 * 您也可以使用skip和limit支持分页操作。 * * </p> * * @param clazz AVUser类或者其子类。 * @since 2.3.0 */ public <T extends AVUser> AVQuery<T> followerQuery(Class<T> clazz) throws AVException { if (AVUtils.isBlankString(this.getObjectId())) { throw AVErrorUtils.sessionMissingException(); } return followerQuery(getObjectId(), clazz); }
/** * <p> * 创建followee查询。 创建followee查询后,您可以使用whereEqualTo("followee", userFollowee)查询特定的followee。 * 您也可以使用skip和limit支持分页操作。 * * </p> * * @param clazz AVUser类或者其子类。 * * @since 2.3.0 */ public <T extends AVUser> AVQuery<T> followeeQuery(Class<T> clazz) throws AVException { if (AVUtils.isBlankString(this.getObjectId())) { throw AVErrorUtils.sessionMissingException(); } return followeeQuery(getObjectId(), clazz); }
/** * <p> * 创建follower查询。创建follower查询后,您可以使用whereEqualTo("follower", userFollower)查询特定的follower。 * 您也可以使用skip和limit支持分页操作。 * * </p> * * @param clazz AVUser类或者其子类。 * @param <T> subclass of AVUser * @return follower查询对象 * @since 2.3.0 * @throws AVException 如果当前对象未保存过则会报错 */ public <T extends AVUser> AVQuery<T> followerQuery(Class<T> clazz) throws AVException { if (AVUtils.isBlankString(this.getObjectId())) { throw AVErrorUtils.sessionMissingException(); } return followerQuery(getObjectId(), clazz); }
/** * <p> * 创建followee查询。 创建followee查询后,您可以使用whereEqualTo("followee", userFollowee)查询特定的followee。 * 您也可以使用skip和limit支持分页操作。 * * </p> * * @param clazz AVUser类或者其子类。 * @return followee 查询 * @param <T> AVUser的子类 * @throws AVException 如果本对象从来没有保存过会遇到错误 * * @since 2.3.0 */ public <T extends AVUser> AVQuery<T> followeeQuery(Class<T> clazz) throws AVException { if (AVUtils.isBlankString(this.getObjectId())) { throw AVErrorUtils.sessionMissingException(); } return followeeQuery(getObjectId(), clazz); }
public static void getUnreadStatusesCountInBackground(String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
public static void getUnreadStatusesCountInBackground(String inboxType, final CountCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(0, AVErrorUtils.sessionMissingException()); } return; } String userId = AVUser.getCurrentUser().getObjectId(); Map<String, String> map = getStatusQueryMap(userId, 0, 0, 0, inboxType, null, true, true); getStatusCountImpl("subscribe/statuses/count", map, callback); }
private void updatePasswordInBackground(String oldPassword, String newPassword, final UpdatePasswordCallback callback, boolean sync) { if (!this.isAuthenticated() || AVUtils.isBlankString(getObjectId())) { callback.internalDone(AVErrorUtils.sessionMissingException()); } else { String relativePath = String.format("users/%s/updatePassword", this.getObjectId()); Map<String, Object> params = new HashMap<String, Object>(); params.put("old_password", oldPassword); params.put("new_password", newPassword); String paramsString = AVUtils.restfulServerData(params); PaasClient.storageInstance().putObject(relativePath, paramsString, sync, headerMap(), new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (null == e && !AVUtils.isBlankString(content)) { sessionToken = AVUtils.getJSONValue(content, SESSION_TOKEN_KEY); } callback.internalDone(e); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(AVErrorUtils.createException(error, content)); } }, getObjectId(), getObjectId()); } }
private void updatePasswordInBackground(String oldPassword, String newPassword, final UpdatePasswordCallback callback, boolean sync) { if (!this.isAuthenticated() || AVUtils.isBlankString(getObjectId())) { callback.internalDone(AVErrorUtils.sessionMissingException()); } else { String relativePath = String.format("users/%s/updatePassword", this.getObjectId()); Map<String, Object> params = new HashMap<String, Object>(); params.put("old_password", oldPassword); params.put("new_password", newPassword); String paramsString = AVUtils.restfulServerData(params); PaasClient.storageInstance().putObject(relativePath, paramsString, sync, headerMap(), new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (null == e && !TextUtils.isEmpty(content)) { sessionToken = AVUtils.getJSONValue(content, SESSION_TOKEN_KEY); } callback.internalDone(e); } @Override public void onFailure(Throwable error, String content) { callback.internalDone(AVErrorUtils.createException(error, content)); } }, getObjectId(), getObjectId()); } }
private static void deleteStatusWithId(boolean sync, String statusId, final DeleteCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(AVErrorUtils.invalidObjectIdException()); } return; } String endPoint = String.format("statuses/%s", statusId); PaasClient.storageInstance().deleteObject(endPoint, sync, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }, statusId, null); }
private static void deleteStatusWithId(boolean sync, String statusId, final DeleteCallback callback) { if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException()); } return; } if (AVUtils.isBlankString(statusId)) { if (callback != null) { callback.internalDone(AVErrorUtils.invalidObjectIdException()); } return; } String endPoint = String.format("statuses/%s", statusId); PaasClient.storageInstance().deleteObject(endPoint, sync, new GenericObjectCallback() { @Override public void onSuccess(String content, AVException e) { if (callback != null) { callback.internalDone(null); } } @Override public void onFailure(Throwable error, String content) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(error, content)); } } }, statusId, null); }
if (!checkCurrentUser(null)) { if (callback != null) { callback.internalDone(AVErrorUtils.sessionMissingException());