/** * Whether the AVUser has been authenticated on this device. This will be true if the AVUser was * obtained via a logIn or signUp method. Only an authenticated AVUser can be saved (with altered * attributes) and deleted. * * @return Whether the AVUser has been authenticated */ public boolean isAuthenticated() { return (!AVUtils.isBlankString(sessionToken) || !AVUtils.isBlankString(sinaWeiboToken) || !AVUtils .isBlankString(qqWeiboToken)); }
private Map<String, Object> fillMap(String key, String value, Map<String, Object> map) { if (!AVUtils.isBlankString(value)) { map.put(key, value); } return map; }
/** * Add a key-value pair to this conversation * @param key Keys must be alphanumerical plus underscore, and start with a letter. * @param value Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other * AVObjects. value may not be null. */ public void set(String key, Object value) { if (!AVUtils.isBlankString(key) && null != value) { pendingInstanceData.put(key, value); } }
public AVIMAudioRecorder(String path, RecordEventListener listener) { if (AVUtils.isBlankString(path)) { throw new IllegalArgumentException("local path is empty."); } this.localPath = path; this.listener = listener; }
@Override protected Map<String, String> headerMap() { Map<String, String> map = new HashMap<String, String>(); if (!AVUtils.isBlankString(sessionToken)) { map.put(PaasClient.sessionTokenField, sessionToken); } return map; }
public static boolean updateLastModify(final String absolutURLString, final String ts) { if (!isLastModifyEnabled()) { return false; } if (!AVUtils.isBlankString(ts)) { lastModify.put(absolutURLString, ts); return true; } return false; }
/** * Accessor to the class name. */ public String getClassName() { if (AVUtils.isBlankString(className)) { className = getSubClassName(this.getClass()); } return className; }
public void addDescendingOrder(String key) { if (AVUtils.isBlankString(order)) { orderByDescending(key); return; } order = String.format("%s,-%s", order, key); }
static private Map<String, String> statisticsDictionary(String event) { if (AVUtils.isBlankString(event)) { throw new IllegalArgumentException("Blank event string."); } Map<String, String> map = new HashMap<String, String>(); map.put("event_id", event); map.put("channel", impl.getAppChannel()); return map; }
private void completeFileUpload(boolean success){ if (!AVUtils.isBlankString(token)) { try { JSONObject completeResult = new JSONObject(); completeResult.put("result",success); completeResult.put("token",this.token); PaasClient.storageInstance().postObject("fileCallback", completeResult.toJSONString(), false, new GenericObjectCallback() {}); } catch (Exception e) { // ignore } } }
@Override public int hashCode() { if (AVUtils.isBlankString(this.objectId)) { return super.hashCode(); } final int prime = 31; int result = 1; result = prime * result + ((getClassName() == null) ? 0 : getClassName().hashCode()); result = prime * result + ((objectId == null) ? 0 : objectId.hashCode()); return result; }
@Override public void onSuccess(String content, AVException e) { if (!AVUtils.isBlankString(content)) { Map<String, String> map = JSON.parseObject(content, HashMap.class); if (null != map && map.containsKey(VALIDATE_TOKEN)) { callback.internalDone(map.get(VALIDATE_TOKEN), null); return; } } callback.internalDone(null, null); }
private List<AVUser> processResultByTag(String content, String tag) { List<AVUser> list = new LinkedList<AVUser>(); if (AVUtils.isBlankString(content)) { return list; } AVFollowResponse resp = new AVFollowResponse(); resp = JSON.parseObject(content, resp.getClass()); processResultList(resp.results, list, tag); return list; }
public static String getFileMimeType(AVFile avFile) { String fileName = avFile.getName(); String fileUrl = avFile.getUrl(); String mimeType = AVFile.DEFAULTMIMETYPE; if (!AVUtils.isBlankString(fileName)) { mimeType = AVUtils.getMimeTypeFromLocalFile(fileName); } else if (!AVUtils.isBlankString(fileUrl)) { mimeType = AVUtils.getMimeTypeFromUrl(fileUrl); } return mimeType; } }
private static String getAVRoleEndpoint(AVRole object) { String endpoint = get(AVRole.class.getSimpleName(), ENDPOINT); if (!AVUtils.isBlankString(object.getObjectId())) { endpoint = String.format("%s/%s", endpoint, object.getObjectId()); } return endpoint; }
String getUserSessionToken() { if (AVUtils.isBlankString(userSessionToken)) { userSessionToken = AVPersistenceUtils.sharedInstance().getPersistentSettingString(selfId, AVUSER_SESSION_TOKEN, ""); } return userSessionToken; }
void updateUserSessionToken(String token) { userSessionToken = token; if (!AVUtils.isBlankString(userSessionToken)) { AVPersistenceUtils.sharedInstance().savePersistentSettingString(selfId, AVUSER_SESSION_TOKEN, userSessionToken); } }
/** * Returns whether or not this query has a cached result. */ public boolean hasCachedResult() { generateQueryPath(); return !AVUtils.isBlankString(this.queryPath) && AVCacheManager.sharedInstance().hasCache(this.queryPath); }
@Override protected void onSaveSuccess() { super.onSaveSuccess(); this.processAuthData(null); if (!AVUtils.isBlankString(sessionToken)) { changeCurrentUser(this, true); } }
private void refreshInBackground(boolean sync, String includeKeys, RefreshCallback<AVObject> callback) { Map<String, String> params = new HashMap<String, String>(); if (!AVUtils.isBlankString(includeKeys)) { params.put("include", includeKeys); } PaasClient.storageInstance().getObject(AVPowerfulUtils.getEndpoint(this), new AVRequestParams(params), sync, headerMap(), new FetchObjectCallback(callback)); }