Fix display name updating issue
This commit is contained in:
parent
7fc9678987
commit
746f3e34bd
|
@ -3,6 +3,7 @@
|
|||
#import "ProfileManagerProtocol.h"
|
||||
#import "SignalRecipient.h"
|
||||
#import "SSKEnvironment.h"
|
||||
#import "TSThread.h"
|
||||
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
|
@ -27,6 +28,6 @@
|
|||
|
||||
#pragma mark Settings
|
||||
- (uint)ttl { return (uint)[LKTTLUtilities getTTLFor:LKMessageTypeFriendRequest]; }
|
||||
- (BOOL)shouldSyncTranscript { return NO; }
|
||||
- (BOOL)shouldSyncTranscript { return self.thread.isNoteToSelf; }
|
||||
|
||||
@end
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@import Foundation;
|
||||
|
||||
#import "TSOutgoingMessage.h"
|
||||
#import "NSString+SSK.h"
|
||||
#import "OWSContact.h"
|
||||
|
@ -1097,7 +1099,13 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt
|
|||
// Loki: Set display name & profile picture (exclude the profile picture if this is a friend request
|
||||
// to prevent unsolicited content from being sent)
|
||||
id<ProfileManagerProtocol> profileManager = SSKEnvironment.shared.profileManager;
|
||||
NSString *displayName = profileManager.localProfileName;
|
||||
NSString *displayName;
|
||||
NSString *masterHexEncodedPublicKey = [NSUserDefaults.standardUserDefaults stringForKey:@"masterDeviceHexEncodedPublicKey"];
|
||||
if (masterHexEncodedPublicKey != nil) {
|
||||
displayName = [profileManager profileNameForRecipientWithID:masterHexEncodedPublicKey];
|
||||
} else {
|
||||
displayName = profileManager.localProfileName;
|
||||
}
|
||||
NSString *profilePictureURL = profileManager.profilePictureURL;
|
||||
SSKProtoDataMessageLokiProfileBuilder *profileBuilder = [SSKProtoDataMessageLokiProfile builder];
|
||||
[profileBuilder setDisplayName:displayName];
|
||||
|
|
|
@ -1549,6 +1549,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
|
||||
failure(error);
|
||||
}];
|
||||
|
||||
if ([LKMultiDeviceProtocol isMultiDeviceRequiredForMessage:message]) { // Avoid the write transaction if possible
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.primaryStorage.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
|
|
Loading…
Reference in New Issue