mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-31 08:56:16 +00:00
Fix matches logic in contact selection.
This commit is contained in:
committed by
Greyson Parrelli
parent
fe25d941bb
commit
c5e7300df2
@@ -43,13 +43,19 @@ public final class SelectedContact {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff any non-null property matches one on the other contact.
|
||||
* Returns true when non-null recipient ids match, and false if not.
|
||||
* <p>
|
||||
* If one or more recipient id is not set, then it returns true iff any other non-null property
|
||||
* matches one on the other contact.
|
||||
*/
|
||||
public boolean matches(@Nullable SelectedContact other) {
|
||||
if (other == null) return false;
|
||||
|
||||
return recipientId != null && recipientId.equals(other.recipientId) ||
|
||||
number != null && number .equals(other.number) ||
|
||||
username != null && username .equals(other.username);
|
||||
if (recipientId != null && other.recipientId != null) {
|
||||
return recipientId.equals(other.recipientId);
|
||||
}
|
||||
|
||||
return number != null && number .equals(other.number) ||
|
||||
username != null && username.equals(other.username);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user