mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 12:48:33 +00:00
Remove the Canonical Address Database
This was a holdover from Signal's origins as a pure SMS app. It causes problems, depends on undefined device specific behavior, and should no longer be necessary now that we have all the information we need to E164 all numbers. // FREEBIE
This commit is contained in:
@@ -10,9 +10,10 @@ import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientsFormatter;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public class ContactSelectionListItem extends LinearLayout implements Recipients.RecipientsModifiedListener {
|
||||
@@ -53,9 +54,10 @@ public class ContactSelectionListItem extends LinearLayout implements Recipients
|
||||
|
||||
if (type == ContactsDatabase.NEW_TYPE) {
|
||||
this.recipients = null;
|
||||
this.contactPhotoImage.setAvatar(Recipient.getUnknownRecipient(), false);
|
||||
this.contactPhotoImage.setAvatar(RecipientFactory.getRecipientFor(getContext(), Address.UNKNOWN, true), false);
|
||||
} else if (!TextUtils.isEmpty(number)) {
|
||||
this.recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true);
|
||||
Address address = Address.fromExternal(getContext(), number);
|
||||
this.recipients = RecipientFactory.getRecipientsFor(getContext(), new Address[] {address}, true);
|
||||
|
||||
if (this.recipients.getPrimaryRecipient() != null &&
|
||||
this.recipients.getPrimaryRecipient().getName() != null)
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
@@ -102,8 +103,8 @@ public class ContactsCursorLoader extends CursorLoader {
|
||||
ContactsDatabase.LABEL_COLUMN,
|
||||
ContactsDatabase.CONTACT_TYPE_COLUMN});
|
||||
while (cursor.moveToNext()) {
|
||||
final String number = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_COLUMN));
|
||||
final Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true);
|
||||
final String number = cursor.getString(cursor.getColumnIndexOrThrow(ContactsDatabase.NUMBER_COLUMN));
|
||||
final Recipients recipients = RecipientFactory.getRecipientsFor(getContext(), new Address[]{Address.fromExternal(getContext(), number)}, true);
|
||||
|
||||
if (DirectoryHelper.getUserCapabilities(getContext(), recipients)
|
||||
.getTextCapability() != Capability.SUPPORTED)
|
||||
|
||||
@@ -128,9 +128,9 @@ public class RecipientsEditor extends AppCompatMultiAutoCompleteTextView {
|
||||
return mTokenizer.getNumbers();
|
||||
}
|
||||
|
||||
public Recipients constructContactsFromInput() {
|
||||
return RecipientFactory.getRecipientsFromString(mContext, mTokenizer.getRawString(), false);
|
||||
}
|
||||
// public Recipients constructContactsFromInput() {
|
||||
// return RecipientFactory.getRecipientsFromString(mContext, mTokenizer.getRawString(), false);
|
||||
// }
|
||||
|
||||
private boolean isValidAddress(String number, boolean isMms) {
|
||||
/*if (isMms) {
|
||||
@@ -191,7 +191,7 @@ public class RecipientsEditor extends AppCompatMultiAutoCompleteTextView {
|
||||
|
||||
public static CharSequence contactToToken(Recipient c) {
|
||||
String name = c.getName();
|
||||
String number = c.getNumber();
|
||||
String number = c.getAddress().serialize();
|
||||
SpannableString s = new SpannableString(RecipientsFormatter.formatNameAndNumber(name, number));
|
||||
int len = s.length();
|
||||
|
||||
@@ -199,7 +199,7 @@ public class RecipientsEditor extends AppCompatMultiAutoCompleteTextView {
|
||||
return s;
|
||||
}
|
||||
|
||||
s.setSpan(new Annotation("number", c.getNumber()), 0, len,
|
||||
s.setSpan(new Annotation("number", c.getAddress().serialize()), 0, len,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user