public String getFormattedContactNumber() { return contact != null ? contact.getFormattedContactNumber() : null; }
public String getDisplayName() { if (formattedContactNumber != null) { return TextUtils.isEmpty(phoneDisplayName) ? TextUtils.isEmpty(getFormattedContactNumber()) ? getContactIds() : getFormattedContactNumber() : phoneDisplayName; } return TextUtils.isEmpty(fullName) ? getContactIds() : fullName; }
public String getContactIds() { return TextUtils.isEmpty(getUserId()) ? getFormattedContactNumber() : getUserId(); }
public String getCurrentUserId() { if (contact == null) { return ""; } return contact.getUserId() != null ? contact.getUserId() : contact.getFormattedContactNumber(); }
contactNumberList.add(contact.getFormattedContactNumber());
private void process(boolean processUserDetails) { Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String[] projection = new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.LOOKUP_KEY}; Cursor people = getApplicationContext().getContentResolver().query(uri, projection, null, null, null); AppContactService appContactService = new AppContactService(this); Log.i(TAG, "Found " + people.getCount() + " device contacts"); DeviceContactService deviceContactService = new DeviceContactService(getApplicationContext()); Set<String> userIdList = new HashSet<>(); while (people.moveToNext()) { Contact contact = deviceContactService.getContactFromContactCursor(people); if (contact == null) { continue; } appContactService.upsert(contact); userIdList.add(contact.getFormattedContactNumber()); } if (processUserDetails && !userIdList.isEmpty()) { UserService userService = UserService.getInstance(DeviceContactSyncService.this); userService.processUserDetailsByContactNos(userIdList); } if (processUserDetails) { MobiComUserPreference.getInstance(DeviceContactSyncService.this).setDeviceContactSyncTime(new Date().getTime()); } }
if (messageList.isEmpty()) { emptyTextView.setVisibility(VISIBLE); ((MobiComKitActivityInterface) getActivity()).removeConversation(message, channel != null ? String.valueOf(channel.getKey()) : contact.getFormattedContactNumber()); ((MobiComKitActivityInterface) getActivity()).updateLatestMessage(messageList.get(messageListSize - 1), channel != null ? String.valueOf(channel.getKey()) : contact.getFormattedContactNumber());
holder.contactNumberTextView.setText(contact.getFormattedContactNumber()); } else { holder.contactNumberTextView.setText(contact.getContactNumber());
List<Contact> contacts = new AppContactService(context).getContacts(Contact.ContactType.DEVICE); for (Contact contact : contacts) { if (!TextUtils.isEmpty(contact.getFormattedContactNumber())) { contactNoSet.add(contact.getFormattedContactNumber());
List<Contact> contacts = new AppContactService(ConversationIntentService.this).getContacts(Contact.ContactType.DEVICE); for (Contact contact : contacts) { if (!TextUtils.isEmpty(contact.getFormattedContactNumber())) { contactNoSet.add(contact.getFormattedContactNumber());
public void updateContactByPhoneNumber(Contact contact) { try { if (contact == null || TextUtils.isEmpty(contact.getFormattedContactNumber())) { return; if (isContactPresent(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE)) { List<Contact> contactDevice = getContactsByContactNumberAndType(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE.getValue()); for (Contact c : contactDevice) { contact.setPhoneDisplayName(c.getPhoneDisplayName()); } else if (Contact.ContactType.DEVICE.getValue().equals(contact.getDeviceContactType())) { if (isContactPresent(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE_AND_APPLOZIC)) {//do nothing } else if (isContactPresent(contact.getFormattedContactNumber(), Contact.ContactType.APPLOZIC)) { List<Contact> contactListApplozic = getContactsByContactNumberAndType(contact.getFormattedContactNumber(), Contact.ContactType.APPLOZIC.getValue()); for (Contact c : contactListApplozic) { c.setDeviceContactType(Contact.ContactType.DEVICE_AND_APPLOZIC.getValue()); updateContact(c); } else if (isContactPresent(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE)) { saveOrUpdate(contact); } else { if (isContactPresent(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE_AND_APPLOZIC)) { if (!TextUtils.isEmpty(contact.getPhoneDisplayName())) { updatePhoneContactDisplayName(contact.getFormattedContactNumber(), contact.getPhoneDisplayName(), Contact.ContactType.DEVICE_AND_APPLOZIC.getValue()); deleteContactByPhoneNumber(contact.getFormattedContactNumber(), Contact.ContactType.DEVICE.getValue()); deleteContactByPhoneNumber(contact.getFormattedContactNumber(), Contact.ContactType.APPLOZIC.getValue());
if (!TextUtils.isEmpty(contact.getFormattedContactNumber())) { contentValues.put(MobiComDatabaseHelper.CONTACT_NO, contact.getFormattedContactNumber());
statusIcon = context.getResources().getDrawable(R.drawable.applozic_ic_action_message_read); } else { statusIcon = (message.getDelivered() || (contact != null && new Support(context).isSupportNumber(contact.getFormattedContactNumber())) ? deliveredIcon : (message.getScheduledAt() != null ? scheduledIcon : sentIcon));
@Override public void upsert(Contact contact) { if (Applozic.getInstance(context).isDeviceContactSync()) { contact.processContactNumbers(context); if (contact.getDeviceContactType() == null || TextUtils.isEmpty(contact.getFormattedContactNumber())) { if (contactDatabase.getContactById(contact.getUserId()) == null) { contactDatabase.addContact(contact); } else { contactDatabase.updateContact(contact); } } else { //Need to check if contact no exist if (contactDatabase.getContactByPhoneNo(contact.getFormattedContactNumber()) != null) { contactDatabase.updateContactByPhoneNumber(contact); } else if (contactDatabase.getContactById(contact.getUserId()) == null) { contactDatabase.addContact(contact); } else { contactDatabase.updateContact(contact); } } } else { if (contactDatabase.getContactById(contact.getUserId()) == null) { contactDatabase.addContact(contact); } else { contactDatabase.updateContact(contact); } } }
public void createEmptyMessage(Contact contact) { Message sms = new Message(); MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(context); sms.setContactIds(contact.getFormattedContactNumber()); sms.setTo(contact.getContactNumber()); sms.setCreatedAtTime(0L); sms.setStoreOnDevice(Boolean.TRUE); sms.setSendToDevice(Boolean.FALSE); sms.setType(Message.MessageType.MT_OUTBOX.getValue()); sms.setDeviceKeyString(userPreferences.getDeviceKeyString()); sms.setSource(Message.Source.MT_MOBILE_APP.getValue()); messageDatabaseService.createMessage(sms); }