mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 10:51:27 +01:00
Refactor LiveRecipient fetch to be more clear.
This commit is contained in:
@@ -150,16 +150,20 @@ public final class LiveRecipientCache {
|
||||
ACI localAci = SignalStore.account().getAci();
|
||||
String localE164 = SignalStore.account().getE164();
|
||||
|
||||
if (localAci != null) {
|
||||
selfId = recipientDatabase.getByServiceId(localAci).or(recipientDatabase.getByE164(localE164)).orNull();
|
||||
} else if (localE164 != null) {
|
||||
selfId = recipientDatabase.getByE164(localE164).orNull();
|
||||
} else {
|
||||
if (localAci == null && localE164 == null) {
|
||||
throw new IllegalStateException("Tried to call getSelf() before local data was set!");
|
||||
}
|
||||
|
||||
if (localAci != null) {
|
||||
selfId = recipientDatabase.getByServiceId(localAci).orNull();
|
||||
}
|
||||
|
||||
if (selfId == null && localE164 != null) {
|
||||
selfId = recipientDatabase.getByE164(localE164).orNull();
|
||||
}
|
||||
|
||||
if (selfId == null) {
|
||||
selfId = recipientDatabase.getAndPossiblyMerge(localAci, localE164, false);
|
||||
selfId = recipientDatabase.getAndPossiblyMerge(localAci, localE164, true);
|
||||
}
|
||||
|
||||
synchronized (localRecipientId) {
|
||||
|
||||
Reference in New Issue
Block a user