From d516aa7ecbf18fd5580e0d6b15377865b4304568 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 3 May 2021 09:14:42 +1000 Subject: [PATCH] Fix profile updating bug --- .../Sending & Receiving/MessageReceiver+Handling.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift index 7bff37fff..78dad3a38 100644 --- a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift +++ b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift @@ -316,7 +316,7 @@ extension MessageReceiver { : OWSUserProfile.fetch(uniqueId: publicKey, transaction: transaction) // Old API let contact = Storage.shared.getContact(with: publicKey) ?? Contact(sessionID: publicKey) // New API // Name - if let name = name, name != owsProfile?.profileName { + if let name = name, (name != owsProfile?.profileName || contact.name != owsProfile?.profileName) { let shouldUpdate: Bool if isCurrentUser { shouldUpdate = given(userDefaults[.lastDisplayNameUpdate]) { sentTimestamp > UInt64($0.timeIntervalSince1970 * 1000) } ?? true @@ -335,7 +335,7 @@ extension MessageReceiver { } // Profile picture & profile key if let profileKey = profileKey, let profilePictureURL = profilePictureURL, profileKey.keyData.count == kAES256_KeyByteLength, - profileKey != owsProfile?.profileKey { + (profileKey != owsProfile?.profileKey || contact.profilePictureEncryptionKey != owsProfile?.profileKey) { let shouldUpdate: Bool if isCurrentUser { shouldUpdate = given(userDefaults[.lastProfilePictureUpdate]) { sentTimestamp > UInt64($0.timeIntervalSince1970 * 1000) } ?? true