use of com.vodafone360.people.datatypes.Identity in project 360-Engine-for-Android by 360.
the class IdentityEngine method getMyChattableIdentities.
/**
* Takes all third party identities that have a chat capability set to true.
*
* @return A list of chattable 3rd party identities the user is signed in to. If the retrieval identities failed the returned list will be empty.
*/
public ArrayList<Identity> getMyChattableIdentities() {
final ArrayList<Identity> chattableIdentities = new ArrayList<Identity>();
final ArrayList<Identity> myIdentityList;
final int identityListSize;
synchronized (mMyIdentityList) {
// make a shallow copy
myIdentityList = new ArrayList<Identity>(mMyIdentityList);
}
identityListSize = myIdentityList.size();
// list if it does
for (int i = 0; i < identityListSize; i++) {
Identity identity = myIdentityList.get(i);
List<IdentityCapability> capabilities = identity.mCapabilities;
if (null == capabilities) {
// if the capabilties are null skip to next identity
continue;
}
// run through capabilties and check for chat
for (int j = 0; j < capabilities.size(); j++) {
IdentityCapability capability = capabilities.get(j);
if (null == capability) {
// skip null capabilities
continue;
}
if ((capability.mCapability == IdentityCapability.CapabilityID.chat) && (capability.mValue)) {
chattableIdentities.add(identity);
break;
}
}
}
return chattableIdentities;
}
use of com.vodafone360.people.datatypes.Identity 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.");
}
Aggregations