Show name of message sender for groups in conversation list.

This commit is contained in:
Alan Evans
2021-01-27 11:53:31 -04:00
committed by GitHub
parent b5237848e9
commit 23303e5407
8 changed files with 147 additions and 49 deletions

View File

@@ -34,6 +34,7 @@ public final class LiveRecipient {
private final Context context;
private final MutableLiveData<Recipient> liveData;
private final LiveData<Recipient> observableLiveData;
private final LiveData<Recipient> observableLiveDataResolved;
private final Set<RecipientForeverObserver> observers;
private final Observer<Recipient> foreverObserver;
private final AtomicReference<Recipient> recipient;
@@ -53,10 +54,11 @@ public final class LiveRecipient {
o.onRecipientChanged(recipient);
}
};
this.refreshForceNotify = new MutableLiveData<>(System.currentTimeMillis());
this.refreshForceNotify = new MutableLiveData<>(new Object());
this.observableLiveData = LiveDataUtil.combineLatest(LiveDataUtil.distinctUntilChanged(liveData, Recipient::hasSameContent),
refreshForceNotify,
(recipient, force) -> recipient);
this.observableLiveDataResolved = LiveDataUtil.filter(this.observableLiveData, r -> !r.isResolving());
}
public @NonNull RecipientId getId() {
@@ -183,6 +185,10 @@ public final class LiveRecipient {
return observableLiveData;
}
public @NonNull LiveData<Recipient> getLiveDataResolved() {
return observableLiveDataResolved;
}
private @NonNull Recipient fetchAndCacheRecipientFromDisk(@NonNull RecipientId id) {
RecipientSettings settings = recipientDatabase.getRecipientSettings(id);
RecipientDetails details = settings.getGroupId() != null ? getGroupRecipientDetails(settings)

View File

@@ -285,13 +285,13 @@ public final class ManageRecipientViewModel extends ViewModel {
String profileKeyBase64 = recipient.getProfileKey() != null ? Base64.encodeBytes(recipient.getProfileKey()) : "None";
String profileKeyHex = recipient.getProfileKey() != null ? Hex.toStringCondensed(recipient.getProfileKey()) : "None";
return String.format("-- Profile Name --\n%s\n\n" +
return String.format("-- Profile Name --\n[%s] [%s]\n\n" +
"-- Profile Sharing --\n%s\n\n" +
"-- Profile Key (Base64) --\n%s\n\n" +
"-- Profile Key (Hex) --\n%s\n\n" +
"-- UUID --\n%s\n\n" +
"-- RecipientId --\n%s",
recipient.getProfileName().toString(),
recipient.getProfileName().getGivenName(), recipient.getProfileName().getFamilyName(),
recipient.isProfileSharing(),
profileKeyBase64,
profileKeyHex,