use of com.vodafone360.people.service.io.Request.Type in project 360-Engine-for-Android by 360.
the class SyncMeEngine method processPushEvent.
/**
* This method process the "pc" push event.
* @param resp Response - server response normally containing a "pc"
* PushEvent data type
* @return boolean - TRUE if a push event was found in the response
*/
private boolean processPushEvent(final DecodedResponse resp) {
if (resp.mDataTypes == null || resp.mDataTypes.size() == 0) {
return false;
}
BaseDataType dataType = resp.mDataTypes.get(0);
if ((dataType == null) || dataType.getType() != BaseDataType.PUSH_EVENT_DATA_TYPE) {
return false;
}
PushEvent pushEvent = (PushEvent) dataType;
LogUtils.logV("SyncMeEngine processPushMessage():" + pushEvent.mMessageType);
switch(pushEvent.mMessageType) {
case PROFILE_CHANGE:
addGetMeProfileContactRequest();
break;
default:
break;
}
return true;
}
use of com.vodafone360.people.service.io.Request.Type in project 360-Engine-for-Android by 360.
the class Auth method getPublicKey.
/**
* Implementation of "auth/getpublickey" API.
*
* @param engine Handle to LoginEngine which handles requests using this
* API.
* @return Request ID generated for this request.
* @throws NullPointerException when engine is NULL
*/
public static int getPublicKey(BaseEngine engine) {
if (engine == null) {
throw new NullPointerException("Auth.getPublicKey() engine cannot be NULL");
}
Request request = new Request(FUNCTION_GET_PUBLIC_KEY, Request.Type.RETRIEVE_PUBLIC_KEY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
request.addData("type", "all");
QueueManager queue = QueueManager.getInstance();
int requestId = queue.addRequest(request);
queue.fireQueueStateChanged();
return requestId;
}
use of com.vodafone360.people.service.io.Request.Type in project 360-Engine-for-Android by 360.
the class IdentityEngine method handleGetAvailableIdentitiesResponse.
/**
* Handle Server response to request for available Identities. The response
* should be a list of Identity items. The request is completed with
* ServiceStatus.SUCCESS or ERROR_UNEXPECTED_RESPONSE if the data-type
* retrieved are not Identity items.
*
* @param data List of BaseDataTypes generated from Server response.
*/
private void handleGetAvailableIdentitiesResponse(List<BaseDataType> data) {
LogUtils.logD("IdentityEngine: handleServerGetAvailableIdentitiesResponse");
ServiceStatus errorStatus = getResponseStatus(BaseDataType.AVAILABLE_IDENTITY_DATA_TYPE, data);
if (errorStatus == ServiceStatus.SUCCESS) {
synchronized (mAvailableIdentityList) {
mAvailableIdentityList.clear();
for (BaseDataType item : data) {
Identity identity = (Identity) item;
if (!identity.isIdentityFieldBlankorNull()) {
mAvailableIdentityList.add(identity);
}
}
}
}
pushIdentitiesToUi(ServiceUiRequest.GET_AVAILABLE_IDENTITIES);
LogUtils.logD("IdentityEngine: handleGetAvailableIdentitiesResponse complete request.");
}
use of com.vodafone360.people.service.io.Request.Type in project 360-Engine-for-Android by 360.
the class PresenceEngine method updateChatDatabase.
/**
* Updates the database with the given ChatMessage and Type.
*
* @param message ChatMessage.
* @param type TimelineSummaryItem.Type.
*/
private void updateChatDatabase(ChatMessage message, TimelineSummaryItem.Type type) {
ChatDbUtils.convertUserIds(message, mDbHelper);
LogUtils.logD("PresenceEngine.updateChatDatabase() with [" + type.name() + "] message");
if (message.getLocalContactId() == null || message.getLocalContactId() < 0) {
LogUtils.logE("PresenceEngine.updateChatDatabase() " + "WILL NOT UPDATE THE DB! - INVALID localContactId = " + message.getLocalContactId());
return;
}
/** We mark all incoming messages as unread. **/
ChatDbUtils.saveChatMessageAsATimeline(message, type, mDbHelper);
UiAgent uiAgent = mEventCallback.getUiAgent();
if (uiAgent != null && (message.getLocalContactId() != -1)) {
uiAgent.updateChat(message.getLocalContactId(), true, message.getNetworkId());
}
}
use of com.vodafone360.people.service.io.Request.Type in project 360-Engine-for-Android by 360.
the class HttpConnectionThread method addErrorToResponseQueue.
/**
* Adds errors to the response queue whenever there is an HTTP error on the
* backend.
*
* @param reqIds The request IDs the error happened for.
*/
public void addErrorToResponseQueue(List<Integer> reqIds) {
EngineId source = null;
QueueManager requestQueue = QueueManager.getInstance();
ResponseQueue responseQueue = ResponseQueue.getInstance();
for (Integer reqId : reqIds) {
// attempt to get type from request
Request req = requestQueue.getRequest(reqId);
if (req != null)
source = req.mEngineId;
responseQueue.addToResponseQueue(new DecodedResponse(reqId, null, source, DecodedResponse.ResponseType.SERVER_ERROR.ordinal()));
}
}
Aggregations