contact.setDeviceContactType(cursor.getShort(cursor.getColumnIndex(MobiComDatabaseHelper.DEVICE_CONTACT_TYPE))); contact.setPhoneDisplayName(cursor.getString(cursor.getColumnIndex(MobiComDatabaseHelper.PHONE_CONTACT_DISPLAY_NAME)));
newContact.setContactNumber(formattedPhoneNumber); newContact.setUserId(lookupKey); newContact.setDeviceContactType(Contact.ContactType.DEVICE.getValue()); newContact.setFullName(displayName); newContact.setPhoneDisplayName(displayName);
public void saveOrUpdate(Contact contact) { Contact existingContact = getContactById(contact.getUserId()); if (existingContact == null) { addContact(contact); } else { if (Contact.ContactType.DEVICE_AND_APPLOZIC.getValue().equals(existingContact.getDeviceContactType())) { contact.setDeviceContactType(existingContact.getDeviceContactType()); } else if (Contact.ContactType.DEVICE_AND_APPLOZIC.getValue().equals(contact.getDeviceContactType())) { contact.setDeviceContactType(existingContact.getDeviceContactType()); } updateContact(contact); } }
public void addContact(Contact contact) { try { if (Applozic.getInstance(context).isDeviceContactSync()) { contact.processContactNumbers(context); if (contact.getDeviceContactType() == null) { contact.setDeviceContactType(Contact.ContactType.APPLOZIC.getValue()); } } ContentValues contentValues = prepareContactValues(contact); dbHelper.getWritableDatabase().insert(CONTACT, null, contentValues); } catch (Exception e) { Utils.printLog(context, TAG, "Ignoring duplicate entry for contact"); } finally { dbHelper.close(); } }
contact.setBlocked(syncUserBlockedFeed.getUserBlocked()); if (Applozic.getInstance(context).isDeviceContactSync()) { contact.setDeviceContactType(Contact.ContactType.APPLOZIC.getValue()); contact.setBlockedBy(syncUserBlockByFeed.getUserBlocked()); if (Applozic.getInstance(context).isDeviceContactSync()) { contact.setDeviceContactType(Contact.ContactType.APPLOZIC.getValue());
public synchronized void processUser(UserDetail userDetail, Contact.ContactType contactType) { Contact contact = new Contact(); contact.setUserId(userDetail.getUserId()); contact.setContactNumber(userDetail.getPhoneNumber()); contact.setConnected(userDetail.isConnected()); contact.setStatus(userDetail.getStatusMessage()); if (!TextUtils.isEmpty(userDetail.getDisplayName())) { contact.setFullName(userDetail.getDisplayName()); } contact.setLastSeenAt(userDetail.getLastSeenAtTime()); contact.setUserTypeId(userDetail.getUserTypeId()); contact.setUnreadCount(0); contact.setLastMessageAtTime(userDetail.getLastMessageAtTime()); contact.setMetadata(userDetail.getMetadata()); contact.setRoleType(userDetail.getRoleType()); contact.setDeletedAtTime(userDetail.getDeletedAtTime()); if (!TextUtils.isEmpty(userDetail.getImageLink())) { contact.setImageURL(userDetail.getImageLink()); } if (Applozic.getInstance(context).isDeviceContactSync()) { contact.setDeviceContactType(contactType.getValue()); } else { contact.setContactType(contactType.getValue()); } baseContactService.upsert(contact); }
public synchronized Contact getContactFromUserDetail(UserDetail userDetail, Contact.ContactType contactType) { Contact contact = new Contact(); contact.setUserId(userDetail.getUserId()); contact.setContactNumber(userDetail.getPhoneNumber()); contact.setConnected(userDetail.isConnected()); contact.setStatus(userDetail.getStatusMessage()); if (!TextUtils.isEmpty(userDetail.getDisplayName())) { contact.setFullName(userDetail.getDisplayName()); } contact.setLastSeenAt(userDetail.getLastSeenAtTime()); contact.setUserTypeId(userDetail.getUserTypeId()); contact.setUnreadCount(0); contact.setLastMessageAtTime(userDetail.getLastMessageAtTime()); contact.setMetadata(userDetail.getMetadata()); contact.setRoleType(userDetail.getRoleType()); contact.setDeletedAtTime(userDetail.getDeletedAtTime()); if (!TextUtils.isEmpty(userDetail.getImageLink())) { contact.setImageURL(userDetail.getImageLink()); } if (Applozic.getInstance(context).isDeviceContactSync()) { contact.setDeviceContactType(contactType.getValue()); } else { contact.setContactType(contactType.getValue()); } baseContactService.upsert(contact); return contact; }
contact.setPhoneDisplayName(c.getPhoneDisplayName()); contact.setDeviceContactType(Contact.ContactType.DEVICE_AND_APPLOZIC.getValue()); List<Contact> contactListApplozic = getContactsByContactNumberAndType(contact.getFormattedContactNumber(), Contact.ContactType.APPLOZIC.getValue()); for (Contact c : contactListApplozic) { c.setDeviceContactType(Contact.ContactType.DEVICE_AND_APPLOZIC.getValue()); updateContact(c);