use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.
the class MainApplication method removeUserData.
/**
* Remove all user data from People client, this includes all account
* information (downloaded contacts, login credentials etc.) and all cached
* settings.
*/
public synchronized void removeUserData() {
EngineManager mEngineManager = EngineManager.getInstance();
if (mEngineManager != null) {
// Resets all the engines, the call will block until every engines
// have been reset.
mEngineManager.resetAllEngines();
}
// Remove NAB Account at this point (does nothing on 1.X)
NativeContactsApi.getInstance().removePeopleAccount();
// the same action as in NetworkSettingsActivity onChecked()
setInternetAvail(InternetAvail.ALWAYS_CONNECT, false);
mDatabaseHelper.removeUserData();
// Before clearing the Application cache, kick the widget update. Pref's
// file contain the widget ID.
WidgetUtils.kickWidgetUpdateNow(this);
mApplicationCache.clearCachedData(this);
}
use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.
the class PeopleServiceImpl method logon.
/***
* @see com.vodafone360.people.service.interfaces.IPeopleService#logon(LoginDetails)
*/
@Override
public void logon(LoginDetails loginDetails) {
EngineManager manager = EngineManager.getInstance();
manager.getLoginEngine().addUiLoginRequest(loginDetails);
}
use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.
the class ResponseQueue method addToResponseQueue.
/**
* Adds a response item to the queue.
*
* @param reqId The request ID to add the response for.
* @param data The response data to add to the queue.
* @param source The corresponding engine that fired off the request for the
* response.
*/
public void addToResponseQueue(final DecodedResponse response) {
synchronized (QueueManager.getInstance().lock) {
ServiceStatus status = BaseEngine.getResponseStatus(BaseDataType.UNKNOWN_DATA_TYPE, response.mDataTypes);
if (status == ServiceStatus.ERROR_INVALID_SESSION) {
EngineManager em = EngineManager.getInstance();
if (em != null) {
LogUtils.logE("Logging out the current user because of invalide session");
em.getLoginEngine().logoutAndRemoveUser();
return;
}
}
synchronized (mResponses) {
mResponses.add(response);
}
Request request = RequestQueue.getInstance().removeRequest(response.mReqId);
if (request != null) {
// we suppose the response being handled by the same engine
// that issued the request with the given id
response.mSource = request.mEngineId;
}
mEngMgr = EngineManager.getInstance();
if (mEngMgr != null) {
mEngMgr.onCommsInMessage(response.mSource);
}
}
}
use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.
the class EngineManager method onCommsInMessage.
/**
* Respond to incoming message received from Comms layer. If this message
* has a valid engine id it is routed to that engine, otherwise The
* {@link EngineManager} will try to get the next response.
*
* @param source EngineId associated with incoming message.
*/
public void onCommsInMessage(EngineId source) {
BaseEngine engine = null;
if (source != null) {
engine = mEngineList.get(source.ordinal());
}
if (engine != null) {
engine.onCommsInMessage();
} else {
LogUtils.logE("EngineManager.onCommsInMessage - " + "Cannot dispatch message, unknown source " + source);
final ResponseQueue queue = ResponseQueue.getInstance();
queue.getNextResponse(source);
}
}
use of com.vodafone360.people.engine.EngineManager in project 360-Engine-for-Android by 360.
the class ActivitiesEngine method processCommsResponse.
/**
* Handle response received from transport layer (via EngineManager)
*
* @param resp Received Response item either a Status/Timeline related push
* message or a response to a get activities request.
*/
@Override
protected void processCommsResponse(DecodedResponse resp) {
LogUtils.logD("ActivitiesEngine processCommsResponse");
// handle push response
if (resp.mReqId == 0 && resp.mDataTypes.size() > 0) {
PushEvent evt = (PushEvent) resp.mDataTypes.get(0);
handlePushRequest(evt.mMessageType);
} else {
dequeueRequest(resp.mReqId);
handleGetActivitiesResponse(resp.mDataTypes);
}
}
Aggregations