Search in sources :

Example 46 with Name

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

the class Auth method getSessionByCredentials.

/**
 * Implementation of "getsessionbycredentials" API. Used to login to an
 * existing VF360 account.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param username User-name for account.
 * @param password Password for account.
 * @param more Additional login details or NULL.
 * @return Request ID generated for this request.
 * @throws NullPointerException when engine is NULL
 * @throws NullPointerException when username is NULL
 * @throws NullPointerException when password is NULL
 */
public static int getSessionByCredentials(BaseEngine engine, String username, String password, Map<String, List<String>> more) {
    if (engine == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() engine cannot be NULL");
    }
    if (username == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() username cannot be NULL");
    }
    if (password == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() password cannot be NULL");
    }
    String ts = "" + (System.currentTimeMillis() / 1000);
    Request request = new Request(FUNCTION_GET_SESSION, Request.Type.SIGN_IN, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData("hash", AuthUtils.getMd5Hash(SettingsManager.getProperty(Settings.APP_SECRET_KEY).toLowerCase() + "&" + ts + "&" + username.toLowerCase() + "&" + password.toLowerCase()));
    request.addData(TIMESTAMP, ts);
    request.addData(USERNAME, username.toLowerCase());
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 47 with Name

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

the class Auth method getUsernameState.

/**
 * Implementation of "auth/getusernamestate" API.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param username User name for this account.
 * @return Request id generated for this request.
 * @return -1 when username is NULL.
 * @throws NullPointerException when engine is NULL
 */
public static int getUsernameState(BaseEngine engine, String username) {
    if (engine == null) {
        throw new NullPointerException("Auth.getUsernameState() engine cannot be NULL");
    }
    if (username == null) {
        LogUtils.logE("Auth.GetUsernameState() username must not be NULL, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_USERNAME_STATE, Request.Type.TEXT_RESPONSE_ONLY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(USERNAME, username);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 48 with Name

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

the class Auth method signupUserCrypted.

/**
 * Implementation of "auth/signupusercrypted" API. Encrypted signup to new
 * account.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param fullname Full name of user
 * @param username Username chosen for new account
 * @param password Password chosen for new account
 * @param timestamp Current timestamp.
 * @param email Email address associated with this account.
 * @param birthDate Birthday of user signing up (there is a minimum age
 *            limit for users).
 * @param msisdn MSIDN for user.
 * @param acceptedTAndC Whether user has accepted terms and conditions.
 * @param countryCode String identifier identifying country.
 * @param timezone Timezone identifier.
 * @param language Lauguage identifier.
 * @param mobileOperatorId ID of mobile operator.
 * @param mobileModelId Mobile device ID.
 * @param sendConfirmationMail True if confirmation email to be sent to
 *            user.
 * @param sendConfirmationSms True if confirmation SMS to be sent to user.
 * @param subscribeToNewsletter True if user wishes to subscribe to
 *            newsletter.
 * @return Request ID generated for this request.
 * @throws NullPointerException when engine is NULL
 * @throws NullPointerException when acceptedTAndC is NULL
 * @throws NullPointerException when mobileOperatorId is NULL
 * @throws NullPointerException when mobileModelId is NULL
 * @throws NullPointerException when sendConfirmationMail is NULL
 * @throws NullPointerException when sendConfirmationSms is NULL
 * @throws NullPointerException when subscribeToNewsletter is NULL
 */
public static int signupUserCrypted(BaseEngine engine, String fullname, String username, byte[] password, long timestamp, String email, String birthDate, String msisdn, Boolean acceptedTAndC, String countryCode, String timezone, String language, Long mobileOperatorId, Long mobileModelId, Boolean sendConfirmationMail, Boolean sendConfirmationSms, Boolean subscribeToNewsletter) {
    if (engine == null) {
        throw new NullPointerException("Auth.signupUserCrypted() engine cannot be NULL");
    }
    if (acceptedTAndC == null) {
        throw new NullPointerException("Auth.signupUserCrypted() acceptedTAndC cannot be NULL");
    }
    if (mobileOperatorId == null) {
        throw new NullPointerException("Auth.signupUserCrypted() mobileOperatorId cannot be NULL");
    }
    if (mobileModelId == null) {
        throw new NullPointerException("Auth.signupUserCrypted() mobileModelId cannot be NULL");
    }
    if (sendConfirmationMail == null) {
        throw new NullPointerException("Auth.signupUserCrypted() sendConfirmationMail cannot be NULL");
    }
    if (sendConfirmationSms == null) {
        throw new NullPointerException("Auth.signupUserCrypted() sendConfirmationSms cannot be NULL");
    }
    if (subscribeToNewsletter == null) {
        throw new NullPointerException("Auth.signupUserCrypted() subscribeToNewsletter cannot be NULL");
    }
    String ts = "" + (System.currentTimeMillis() / 1000);
    Request request = new Request(FUNCTION_SIGNUP_USER_CRYPTED, Request.Type.SIGN_UP, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(FULLNAME, fullname);
    request.addData(USERNAME, username);
    request.addData(PASSWORD, password);
    request.addData(EMAIL, email);
    request.addData(BIRTHDATE, birthDate);
    request.addData(MSISDN, msisdn);
    request.addData(ACCEPTED_T_AND_C, acceptedTAndC.toString());
    request.addData(COUNTY_CODE, countryCode);
    request.addData(TIMESTAMP, ts);
    request.addData(TIMEZONE, timezone);
    request.addData(LANGUAGE, language);
    request.addData(MOBILE_OPERATOR_ID, mobileOperatorId.toString());
    request.addData(MOBILE_MODE_ID, mobileModelId.toString());
    request.addData(SEND_CONFIRMATION_MAIL, sendConfirmationMail.toString());
    request.addData(SEND_CONFIRMAITON_SMS, sendConfirmationSms.toString());
    request.addData(SUBSCRIBE_TO_NEWSLETTER, subscribeToNewsletter.toString());
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 49 with Name

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

the class Identities method deleteIdentity.

/**
 * Implementation of identities/deleteIdentity API. Parameters are; [auth],
 * String network, String identityid.
 *
 * @param engine
 *            Handle to IdentitiesEngine.
 * @param network
 *            Name of network.
 * @param identityId
 *            The user's identity ID.
 * @return requestId The request ID generated for this request.
 */
public static int deleteIdentity(final BaseEngine engine, final String network, final String identityId) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Identities.deleteIdentity() Invalid session, return -1");
        return -1;
    }
    if (network == null) {
        LogUtils.logE("Identities.deleteIdentity() network cannot be NULL");
        return -1;
    }
    if (identityId == null) {
        LogUtils.logE("Identities.deleteIdentity() identityId cannot be NULL");
        return -1;
    }
    Request request = new Request(FUNCTION_DELETE_IDENITY, Request.Type.DELETE_IDENTITY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_IDENTITIES);
    request.addData("network", network);
    request.addData("identityid", identityId);
    LogUtils.logI("Identity to be removed : " + network + " : " + identityId);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 50 with Name

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

the class TestModule method createFakeStatusEventList.

/**
 * TODO: fill in the method properly
 * @return
 */
public List<ActivityItem> createFakeStatusEventList() {
    List<ActivityItem> activityList = new ArrayList<ActivityItem>();
    for (int i = 0; i < TABLE_SIZE; i++) {
        ActivityItem activityItem = new ActivityItem();
        /**
         * Unique identifier for the activity. This can be empty when setting
         * a new activity (the id is generated on the server side)
         */
        activityItem.activityId = System.currentTimeMillis();
        /**
         * Timestamp representing the time of the activity.
         * This may not be related to creation/updated time.
         */
        activityItem.time = System.currentTimeMillis();
        /**
         * local id for db
         */
        // activityItem.mLocalId; set by DB insertion
        // activityItem.mMoreInfo; //new Hashtable<ActivityItem, String>
        /**
         * The parent activity for 'grouped' or aggregated activities. This must be empty
         * for normal activities that can be retrieved normally. Normally, a GetActivities
         * without filter will not yield any 'grouped' or 'child' activities.
         * To get activities that have a mParentActivity set, the 'children' filter must
         * be used with a value of the parent Activity's id.
         */
        // activityItem.mParentActivity; // null
        /**
         * Indicates wether this activity 'groups' several child activities. When set,
         * there must be child activities set that refer the main activity. Normally,
         * a GetActivities without filter will not yield any 'grouped' or 'child' activities.
         * To get activities that have a parentactivity set, the 'children' filter
         * must be used with a value of the parent Activity's id.
         */
        // activityItem.mHasChildren = false;
        /**
         * Defines a binary preview for the activity. The preview can be a small thumbnail
         * of the activity. The type of the binary data is defined into the previewmime field.
         */
        // keep null
        // activityItem.mPreview = ByteBuffer.allocate(bytes.length);
        // activityItem.mPreviewMime;
        /**
         * Defines an http url that the client can use to retrieve preview binary data.
         * Can be used to embed the url into an IMG HTML tag.
         */
        // activityItem.mPreviewUrl
        /**
         * Name of the store type for this message. This field contains information about the
         * originator network (local or external community activity).
         * By default, should be set to local
         */
        activityItem.store = "local";
        activityItem.title = generateRandomString();
        activityItem.description = activityItem.description + activityItem.store;
        /**
         * Defines the type of the activity.
         */
        activityItem.type = Type.CONTACT_RECEIVED_STATUS_UPDATE;
        /**
         * Defines an internal reference (if any) to the source of the activity.
         * The format for the uri is "module:identifier".Some examples of valid uri are:
         * contact:2737b322c9f6476ca152aa6cf3e5ac12 The activity is linked to some
         * changes on a contact identified by id=2737b322c9f6476ca152aa6cf3e5ac12.
         * file:virtual/flickr/2590004126 The activity is linked to some actions
         * on a file identified by id=virtual/flickr/2590004126.
         * message:9efd255359074dd9bd04cc1c8c4743e5 The activity is linked to a message
         * identified by id=9efd255359074dd9bd04cc1c8c4743e5
         */
        activityItem.uri = "virtual/flickr/2590004126";
        // can be 0		activityItem.mActivityFlags;
        /**
         * Miscellaneous flags.
         */
        activityItem.flagList = new ArrayList<Flag>();
        activityItem.flagList.add(Flag.STATUS);
        activityItem.activityFlags = 0x04;
        /**
         * Defines the contact information of the counter-parties in the activity.
         * This field is not mandatory, because some activity types
         * are not related to contacts, but required if known..
         */
        // keep it simple - empty		activityItem.mContactList = ;
        activityItem.visibility = new ArrayList<Visibility>();
        activityItem.visibility.add(Visibility.ORIGINATOR);
        // keep it 0		activityItem.mVisibilityFlags = 0;
        activityList.add(activityItem);
    }
    return activityList;
}
Also used : ArrayList(java.util.ArrayList) Visibility(com.vodafone360.people.datatypes.ActivityItem.Visibility) Flag(com.vodafone360.people.datatypes.ActivityItem.Flag) ActivityItem(com.vodafone360.people.datatypes.ActivityItem)

Aggregations

ContactDetail (com.vodafone360.people.datatypes.ContactDetail)23 ServiceStatus (com.vodafone360.people.service.ServiceStatus)20 VCardHelper (com.vodafone360.people.datatypes.VCardHelper)13 Cursor (android.database.Cursor)12 Contact (com.vodafone360.people.datatypes.Contact)12 ArrayList (java.util.ArrayList)11 Name (com.vodafone360.people.datatypes.VCardHelper.Name)9 ContentValues (android.content.ContentValues)7 Uri (android.net.Uri)7 ContactSummary (com.vodafone360.people.datatypes.ContactSummary)7 SQLException (android.database.SQLException)6 Organisation (com.vodafone360.people.datatypes.VCardHelper.Organisation)6 QueueManager (com.vodafone360.people.service.io.QueueManager)6 Request (com.vodafone360.people.service.io.Request)6 TimelineSummaryItem (com.vodafone360.people.database.tables.ActivitiesTable.TimelineSummaryItem)5 ActivityItem (com.vodafone360.people.datatypes.ActivityItem)5 Hashtable (java.util.Hashtable)5 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)4 Suppress (android.test.suitebuilder.annotation.Suppress)4 Date (java.util.Date)4