Fix display name updating issue
This commit is contained in:
parent
2968c3d64a
commit
7fc9678987
|
@ -182,7 +182,7 @@ typedef void (^BuildOutgoingMessageCompletionBlock)(TSOutgoingMessage *savedMess
|
|||
|
||||
// Loki: If we're not friends then always set the message to a friend request message.
|
||||
// If we're friends then the assumption is that we have the other user's pre key bundle.
|
||||
NSString *messageClassAsString = (thread.isContactFriend || thread.isGroupThread || thread.isNoteToSelf) ? @"TSOutgoingMessage" : @"LKFriendRequestMessage";
|
||||
NSString *messageClassAsString = (thread.isContactFriend || thread.isGroupThread) ? @"TSOutgoingMessage" : @"LKFriendRequestMessage";
|
||||
Class messageClass = NSClassFromString(messageClassAsString);
|
||||
|
||||
TSOutgoingMessage *message =
|
||||
|
|
|
@ -114,6 +114,7 @@ public final class SessionMetaProtocol : NSObject {
|
|||
@objc(updateDisplayNameIfNeededForHexEncodedPublicKey:using:appendingShortID:in:)
|
||||
public static func updateDisplayNameIfNeeded(for hexEncodedPublicKey: String, using dataMessage: SSKProtoDataMessage, appendingShortID appendShortID: Bool, in transaction: YapDatabaseReadWriteTransaction) {
|
||||
guard let profile = dataMessage.profile, let rawDisplayName = profile.displayName else { return }
|
||||
guard !rawDisplayName.isEmpty else { return }
|
||||
let displayName: String
|
||||
// TODO: Figure out why we sometimes don't append the short ID
|
||||
if appendShortID {
|
||||
|
@ -122,7 +123,6 @@ public final class SessionMetaProtocol : NSObject {
|
|||
} else {
|
||||
displayName = rawDisplayName
|
||||
}
|
||||
guard !displayName.isEmpty else { return }
|
||||
let profileManager = SSKEnvironment.shared.profileManager
|
||||
profileManager.updateProfileForContact(withID: hexEncodedPublicKey, displayName: displayName, with: transaction)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue