From 42ca1332ec9035481ce88b94d1c15cf340795a4d Mon Sep 17 00:00:00 2001 From: jubb Date: Mon, 26 Apr 2021 15:44:31 +1000 Subject: [PATCH] fix: update prof pic and name and use new profile instead of existing recipient --- .../messaging/sending_receiving/MessageReceiverHandler.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt index d8d136ca2d..cabb92b8c7 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/MessageReceiverHandler.kt @@ -158,9 +158,10 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage, proto: SignalS if (userPublicKey == message.sender && displayName.isNotEmpty()) { // Update the user's local name if the message came from their master device TextSecurePreferences.setProfileName(context, displayName) + } else if (displayName.isNotEmpty()) { + profileManager.setDisplayName(context, recipient, displayName) } - profileManager.setDisplayName(context, recipient, displayName) - if (recipient.profileKey?.isNotEmpty() == true && !MessageDigest.isEqual(recipient.profileKey, newProfile.profileKey)) { + if (newProfile.profileKey?.isNotEmpty() == true && !MessageDigest.isEqual(recipient.profileKey, newProfile.profileKey)) { profileManager.setProfileKey(context, recipient, newProfile.profileKey!!) profileManager.setUnidentifiedAccessMode(context, recipient, Recipient.UnidentifiedAccessMode.UNKNOWN) val newUrl = newProfile.profilePictureURL