Search in sources :

Example 41 with BaseDataType

use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.

the class LoginEngine method handleNewPublicKeyResponse.

/**
 * Called when a response to the server fetch public key request is
 * received. Validates the response and stores the new public key details.
 *
 * @param mDataTypes Response data from server.
 */
private void handleNewPublicKeyResponse(List<BaseDataType> mDataTypes) {
    LogUtils.logD("LoginEngine.handleNewPublicKeyResponse()");
    ServiceStatus errorStatus = getResponseStatus(BaseDataType.PUBLIC_KEY_DETAILS_DATA_TYPE, mDataTypes);
    if (errorStatus == ServiceStatus.SUCCESS) {
        LogUtils.logD("LoginEngine.handleNewPublicKeyResponse() - Succesfully retrieved");
        // AA
        // 1. save to DB; save the flag that we aren't using default and
        // have to use one from DB
        // 2. start registration again
        mPublicKey = (PublicKeyDetails) mDataTypes.get(0);
        // done in startRegistrationProcessCrypted already
        // mDb.modifyCredentialsAndPublicKey(mLoginDetails, mPublicKey);
        startRegistrationProcessCrypted(mRegistrationDetails);
    } else {
        completeUiRequest(errorStatus, null);
    }
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 42 with BaseDataType

use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.

the class LoginEngine method handleRequestingActivationResponse.

/**
 * Called when a response to the RequestActivationCode API is received
 * (manual login). In case of success, tries to fetch a login session from
 * the server.
 *
 * @param data The received data
 */
private void handleRequestingActivationResponse(List<BaseDataType> data) {
    LogUtils.logD("LoginEngine.handleRequestingActivationResponse()");
    ServiceStatus errorStatus = getResponseStatus(BaseDataType.STATUS_MSG_DATA_TYPE, data);
    if (errorStatus == ServiceStatus.SUCCESS) {
        // Now waiting for SMS...
        setTimeout(ACTIVATE_LOGIN_TIMEOUT);
        return;
    }
    completeUiRequest(errorStatus, null);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 43 with BaseDataType

use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.

the class LoginEngine method handleCreateSessionManualResponse.

/**
 * Called when a response to the GetSessionByCredentials API is received
 * (manual login). In case of success, tries to activate the account using
 * the activation code received by SMS.
 *
 * @param data The received data
 */
private void handleCreateSessionManualResponse(List<BaseDataType> data) {
    LogUtils.logD("LoginEngine.handleCreateSessionManualResponse()");
    ServiceStatus errorStatus = getResponseStatus(BaseDataType.AUTH_SESSION_HOLDER_TYPE, data);
    if (errorStatus == ServiceStatus.SUCCESS && (data.size() > 0)) {
        setActivatedSession((AuthSessionHolder) data.get(0));
        startActivateAccount();
        return;
    }
    completeUiRequest(errorStatus, null);
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 44 with BaseDataType

use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.

the class LoginEngine method handleCreateSessionAutoResponse.

/**
 * Called when a response to the GetSessionByCredentials API is received
 * (auto login). In case of success, moves to the logged in state
 *
 * @param data The received data
 */
private void handleCreateSessionAutoResponse(List<BaseDataType> data) {
    LogUtils.logD("LoginEngine.handleCreateSessionResponse()");
    ServiceStatus errorStatus = getResponseStatus(BaseDataType.AUTH_SESSION_HOLDER_TYPE, data);
    if (errorStatus == ServiceStatus.SUCCESS && (data.size() > 0)) {
        clearTimeout();
        setActivatedSession((AuthSessionHolder) data.get(0));
        newState(State.LOGGED_ON);
    } else {
        LogUtils.logE("LoginEngine.handleCreateSessionResponse() - Auto Login Failed Error " + errorStatus);
        // mAreLoginDetailsValid = false;
        if (errorStatus == ServiceStatus.ERROR_INVALID_PASSWORD) {
            mAreLoginDetailsValid = false;
            newState(State.LOGIN_FAILED_WRONG_CREDENTIALS);
        } else {
            newState(State.LOGIN_FAILED);
        }
    // }
    }
}
Also used : ServiceStatus(com.vodafone360.people.service.ServiceStatus)

Example 45 with BaseDataType

use of com.vodafone360.people.datatypes.BaseDataType in project 360-Engine-for-Android by 360.

the class UploadServerContactsTest method reportDeleteContactSuccess.

private void reportDeleteContactSuccess(int reqId, List<BaseDataType> data) {
    Log.d(LOG_TAG, "reportDeleteContactSuccess");
    mProcessor.verifyDeleteContactsState();
    List<Long> contactIdList = new ArrayList<Long>();
    mProcessor.testFetchContactDeleteList(contactIdList);
    assertEquals(Math.min(mItemCount, mProcessor.testGetPageSize()), contactIdList.size());
    ContactListResponse contactListResponse = new ContactListResponse();
    contactListResponse.mServerRevisionAfter = 1;
    contactListResponse.mServerRevisionBefore = 0;
    data.add(contactListResponse);
    contactListResponse.mContactIdList = new ArrayList<Integer>();
    for (Long serverID : contactIdList) {
        assertTrue(serverID != null);
        contactListResponse.mContactIdList.add(Integer.valueOf(serverID.intValue()));
    }
    mItemCount -= contactIdList.size();
    assertTrue(mItemCount >= 0);
    if (mItemCount == 0) {
        nextState(State.IDLE);
    }
}
Also used : ArrayList(java.util.ArrayList) ContactListResponse(com.vodafone360.people.datatypes.ContactListResponse)

Aggregations

BaseDataType (com.vodafone360.people.datatypes.BaseDataType)29 ArrayList (java.util.ArrayList)25 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)21 ServiceStatus (com.vodafone360.people.service.ServiceStatus)15 ServerError (com.vodafone360.people.datatypes.ServerError)12 MediumTest (android.test.suitebuilder.annotation.MediumTest)9 Contact (com.vodafone360.people.datatypes.Contact)9 IOException (java.io.IOException)9 ContactChanges (com.vodafone360.people.datatypes.ContactChanges)8 Identity (com.vodafone360.people.datatypes.Identity)7 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)7 HessianDecoder (com.vodafone360.people.service.utils.hessian.HessianDecoder)7 ContactDetail (com.vodafone360.people.datatypes.ContactDetail)6 ExternalResponseObject (com.vodafone360.people.datatypes.ExternalResponseObject)5 PushEvent (com.vodafone360.people.datatypes.PushEvent)5 StatusMsg (com.vodafone360.people.datatypes.StatusMsg)5 Bundle (android.os.Bundle)3 Suppress (android.test.suitebuilder.annotation.Suppress)3 ActivityItem (com.vodafone360.people.datatypes.ActivityItem)3 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)3