mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
fix: Cached recipient values not updating approved flags, remove unused static recipient settings map in RecipientProvider (#860)
This commit is contained in:
parent
2445418e3e
commit
712deebb42
@ -209,6 +209,8 @@ public class Recipient implements RecipientModifiedListener {
|
||||
Recipient.this.callRingtone = result.callRingtone;
|
||||
Recipient.this.mutedUntil = result.mutedUntil;
|
||||
Recipient.this.blocked = result.blocked;
|
||||
Recipient.this.approved = result.approved;
|
||||
Recipient.this.approvedMe = result.approvedMe;
|
||||
Recipient.this.messageVibrate = result.messageVibrateState;
|
||||
Recipient.this.callVibrate = result.callVibrateState;
|
||||
Recipient.this.expireMessages = result.expireMessages;
|
||||
@ -259,6 +261,8 @@ public class Recipient implements RecipientModifiedListener {
|
||||
this.mutedUntil = details.mutedUntil;
|
||||
this.notifyType = details.notifyType;
|
||||
this.blocked = details.blocked;
|
||||
this.approved = details.approved;
|
||||
this.approvedMe = details.approvedMe;
|
||||
this.messageVibrate = details.messageVibrateState;
|
||||
this.callVibrate = details.callVibrateState;
|
||||
this.expireMessages = details.expireMessages;
|
||||
|
@ -37,7 +37,6 @@ import org.session.libsession.utilities.recipients.Recipient.UnidentifiedAccessM
|
||||
import org.session.libsession.utilities.recipients.Recipient.VibrateState;
|
||||
import org.session.libsignal.utilities.guava.Optional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -53,10 +52,6 @@ class RecipientProvider {
|
||||
private static final RecipientCache recipientCache = new RecipientCache();
|
||||
private static final ExecutorService asyncRecipientResolver = Util.newSingleThreadedLifoExecutor();
|
||||
|
||||
private static final Map<String, RecipientDetails> STATIC_DETAILS = new HashMap<String, RecipientDetails>() {{
|
||||
put("262966", new RecipientDetails("Amazon", null, false, false, null, null));
|
||||
}};
|
||||
|
||||
@NonNull Recipient getRecipient(@NonNull Context context, @NonNull Address address, @NonNull Optional<RecipientSettings> settings, @NonNull Optional<GroupRecord> groupRecord, boolean asynchronous) {
|
||||
Recipient cachedRecipient = recipientCache.get(address);
|
||||
|
||||
@ -117,13 +112,9 @@ class RecipientProvider {
|
||||
settings = Optional.fromNullable(MessagingModuleConfiguration.shared.getStorage().getRecipientSettings(address));
|
||||
}
|
||||
|
||||
if (!settings.isPresent() && STATIC_DETAILS.containsKey(address.serialize())) {
|
||||
return STATIC_DETAILS.get(address.serialize());
|
||||
} else {
|
||||
boolean systemContact = settings.isPresent() && !TextUtils.isEmpty(settings.get().getSystemDisplayName());
|
||||
boolean isLocalNumber = address.serialize().equals(TextSecurePreferences.getLocalNumber(context));
|
||||
return new RecipientDetails(null, null, systemContact, isLocalNumber, settings.orNull(), null);
|
||||
}
|
||||
boolean systemContact = settings.isPresent() && !TextUtils.isEmpty(settings.get().getSystemDisplayName());
|
||||
boolean isLocalNumber = address.serialize().equals(TextSecurePreferences.getLocalNumber(context));
|
||||
return new RecipientDetails(null, null, systemContact, isLocalNumber, settings.orNull(), null);
|
||||
}
|
||||
|
||||
private @NonNull RecipientDetails getGroupRecipientDetails(Context context, Address groupId, Optional<GroupRecord> groupRecord, Optional<RecipientSettings> settings, boolean asynchronous) {
|
||||
|
Loading…
Reference in New Issue
Block a user