void onResponse4MemberBlock(AVIMOperation imop, String operation, int reqeustId, Messages.BlacklistCommand blacklistCommand) { if (null == blacklistCommand) { return; } List<String> allowedList = blacklistCommand.getAllowedPidsList(); List<Messages.ErrorCommand> errorCommandList = blacklistCommand.getFailedPidsList(); Bundle bundle = genBundleFromPartiallyResult(allowedList, errorCommandList); BroadcastUtil.sendIMLocalBroadcast(session.getSelfPeerId(), blacklistCommand.getSrcCid(), reqeustId, bundle, imop); }
private boolean checkUserAuthentication(final AVCallback callback) { if (!this.isAuthenticated() || AVUtils.isBlankString(getObjectId())) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(AVException.SESSION_MISSING, "No valid session token, make sure signUp or login has been called.")); } return false; } return true; }
@Override public void onFailure(Throwable error, String content) { for (AVObject o : objects) { o.running = false; o.rollbackDataToOperationQueue(); o.onSaveFailure(); } LogUtil.log.d(content); if (callback != null) callback.internalDone(null, AVErrorUtils.createException(error, content)); } };
private void generateQueryPath() { // This method is only used for cache and currently only storage service use cache if (AVUtils.isBlankString(queryPath)) { conditions.assembleParameters(); queryPath = PaasClient.storageInstance().buildUrl(queryPath(), new AVRequestParams(getParameters())); } }
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); }
@Override public void onSuccess(String content, AVException e) { AVUser user = AVUser.newAVUser(); AVUtils.copyPropertiesFromJsonStringToAVObject(content, user); user.setAnonymous(true); AVUser.changeCurrentUser(user, true); if (internalCallback != null) { internalCallback.internalDone(user, null); } }
private static boolean checkCurrentUser(final AVCallback callback) { if (AVUser.getCurrentUser() == null) { if (callback != null) { callback.internalDone(null, AVErrorUtils.sessionMissingException()); } return false; } return true; }
/** * Removes the previously cached result for this query, forcing the next find() to hit the * network. If there is no cached result for this query, then this is a no-op. */ public void clearCachedResult() { generateQueryPath(); if (!AVUtils.isBlankString(queryPath)) { AVCacheManager.sharedInstance().delete(queryPath); } }
@Override public void onFailure(Throwable error, String content) { LogUtil.log.d(content + error); callback.internalDone(null, AVErrorUtils.createException(error, content)); } });
synchronized AnalyticsEvent beginEvent(Context context, String name, String label, String key) { AnalyticsEvent event = eventByName(name, label, key, true); if (!AVUtils.isBlankString(label)) { event.setLabel(label); } event.start(); duration.resume(); return event; }
@Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); // To change body of overridden methods use File | // Settings // | File Templates. if (callback != null) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } } });
@Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); if (callback != null) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } } });
void onResponse4MemberMute(AVIMOperation imop, String operation, int requestId, Messages.ConvCommand convCommand) { if (null == convCommand) { return; } List<String> allowedList = convCommand.getAllowedPidsList(); List<Messages.ErrorCommand> errorCommandList = convCommand.getFailedPidsList(); Bundle bundle = genBundleFromPartiallyResult(allowedList, errorCommandList); BroadcastUtil.sendIMLocalBroadcast(session.getSelfPeerId(), conversationId, requestId, bundle, imop); }
private void init() { objectId = ""; isDataReady = false; if (getPaasClientInstance().getDefaultACL() != null) { acl = new AVACL(getPaasClientInstance().getDefaultACL()); } running = false; }
@Override public void onSessionOpen(Context context, AVSession session, int requestId) { // 既然已经成功了,就往缓存里面添加一条记录 AVSessionCacheHelper.getTagCacheInstance().addSession(session.getSelfPeerId(), session.tag); // 这里需要给AVIMClient那边发一个LocalBoardcastMessage if (requestId > CommandPacket.UNSUPPORTED_OPERATION) { BroadcastUtil.sendIMLocalBroadcast(session.getSelfPeerId(), null, requestId, AVIMOperation.CLIENT_OPEN); } }
public AVSession(String selfId, AVSessionListener sessionListener) { this.selfId = selfId; this.context = AVOSCloud.applicationContext; this.sessionListener = sessionListener; this.websocketListener = new AVDefaultWebSocketListener(this); pendingMessages = new PendingMessageCache<Message>(selfId, Message.class); conversationOperationCache = new AVIMOperationQueue(selfId); }
private boolean checkUserAuthentication(final AVCallback callback) { if (!this.isAuthenticated() || AVUtils.isBlankString(getObjectId())) { if (callback != null) { callback.internalDone(AVErrorUtils.createException(AVException.SESSION_MISSING, "No valid session token, make sure signUp or login has been called.")); } return false; } return true; }
private void generateQueryPath() { // This method is only used for cache and currently only storage service use cache if (AVUtils.isBlankString(queryPath)) { conditions.assembleParameters(); queryPath = PaasClient.storageInstance().buildUrl(queryPath(), new AVRequestParams(getParameters())); } }
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); }
@Override public void onFailure(Throwable error, String content) { super.onFailure(error, content); // To change body of overridden methods use File | Settings // | File Templates. if (callback != null) { callback.internalDone(null, AVErrorUtils.createException(error, content)); } } }, null, null);