Debug
This commit is contained in:
parent
f59816af7d
commit
2e8663a1b0
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit 1b860835167058d16fb18db2416f8482d08b982c
|
||||
Subproject commit 62dbf6a4090b77d62b3e073eed44b4b36b866797
|
|
@ -155,6 +155,7 @@ final class ConversationCell : UITableViewCell {
|
|||
let randomUsers = users.sorted().prefix(2) // Sort to provide a level of stability
|
||||
profilePictureView.hexEncodedPublicKey = randomUsers.count >= 1 ? randomUsers[0] : ""
|
||||
profilePictureView.additionalHexEncodedPublicKey = randomUsers.count >= 2 ? randomUsers[1] : ""
|
||||
profilePictureView.isRSSFeed = false
|
||||
}
|
||||
} else { // A one-on-one chat
|
||||
profilePictureView.hexEncodedPublicKey = threadViewModel.contactIdentifier!
|
||||
|
|
|
@ -75,6 +75,7 @@ extern const NSUInteger kOWSProfileManager_MaxAvatarDiameter;
|
|||
- (nullable OWSAES256Key *)profileKeyForRecipientId:(NSString *)recipientId;
|
||||
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID;
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
- (nullable UIImage *)profileAvatarForRecipientId:(NSString *)recipientId;
|
||||
- (nullable NSData *)profileAvatarDataForRecipientId:(NSString *)recipientId;
|
||||
|
|
|
@ -176,13 +176,12 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|||
|
||||
#pragma mark - Local Profile
|
||||
|
||||
- (OWSUserProfile *)localUserProfile
|
||||
- (OWSUserProfile *)getLocalUserProfileWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
@synchronized(self)
|
||||
{
|
||||
if (!_localUserProfile) {
|
||||
_localUserProfile = [OWSUserProfile getOrBuildUserProfileForRecipientId:kLocalProfileUniqueId
|
||||
dbConnection:self.dbConnection];
|
||||
_localUserProfile = [OWSUserProfile getOrBuildUserProfileForRecipientId:kLocalProfileUniqueId transaction:transaction];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1023,13 +1022,22 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|||
}
|
||||
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID
|
||||
{
|
||||
__block NSString *result;
|
||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
result = [self profileNameForRecipientWithID:recipientID transaction:transaction];
|
||||
} error:nil];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
OWSAssertDebug(recipientID.length > 0);
|
||||
|
||||
// For "local reads", use the local user profile.
|
||||
OWSUserProfile *userProfile = ([self.tsAccountManager.localNumber isEqualToString:recipientID]
|
||||
? self.localUserProfile
|
||||
: [OWSUserProfile getOrBuildUserProfileForRecipientId:recipientID dbConnection:self.dbConnection]);
|
||||
OWSUserProfile *userProfile = [self.tsAccountManager.localNumber isEqualToString:recipientID]
|
||||
? [self getLocalUserProfileWithTransaction:transaction]
|
||||
: [OWSUserProfile getOrBuildUserProfileForRecipientId:recipientID transaction:transaction];
|
||||
|
||||
return userProfile.profileName;
|
||||
}
|
||||
|
|
|
@ -86,13 +86,13 @@ public extension LokiAPI {
|
|||
let parameters: [String:Any] = [ "pubKey" : hexEncodedPublicKey ]
|
||||
return getRandomSnode().then2 {
|
||||
invoke(.getSwarm, on: $0, associatedWith: hexEncodedPublicKey, parameters: parameters)
|
||||
}.map2 {
|
||||
parseTargets(from: $0)
|
||||
}.get2 { swarm in
|
||||
}.map2 { rawSnodes in
|
||||
let swarm = parseTargets(from: rawSnodes)
|
||||
swarmCache[hexEncodedPublicKey] = swarm
|
||||
try! Storage.writeSync { transaction in
|
||||
storage.setSwarm(swarm, for: hexEncodedPublicKey, in: transaction)
|
||||
}
|
||||
return swarm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ public final class LokiPoller : NSObject {
|
|||
}
|
||||
|
||||
private func poll(_ target: LokiAPITarget, seal longTermSeal: Resolver<Void>) -> Promise<Void> {
|
||||
guard !hasStopped else { return Promise { $0.fulfill(()) } }
|
||||
return LokiAPI.getRawMessages(from: target, usingLongPolling: false).then2 { [weak self] rawResponse -> Promise<Void> in
|
||||
guard let strongSelf = self, !strongSelf.hasStopped else { return Promise { $0.fulfill(()) } }
|
||||
let messages = LokiAPI.parseRawMessagesResponse(rawResponse, from: target)
|
||||
|
|
|
@ -237,7 +237,7 @@ public final class SyncMessagesProtocol : NSObject {
|
|||
}
|
||||
|
||||
@objc(handleOpenGroupSyncMessageIfNeeded:wrappedIn:using:)
|
||||
public static func handleOpenGroupSyncMessageIfNeeded(_ syncMessage: SSKProtoSyncMessage, wrappedIn envelope: SSKProtoEnvelope, using transaction: YapDatabaseReadTransaction) {
|
||||
public static func handleOpenGroupSyncMessageIfNeeded(_ syncMessage: SSKProtoSyncMessage, wrappedIn envelope: SSKProtoEnvelope, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
let hexEncodedPublicKey = envelope.source! // Set during UD decryption
|
||||
let linkedDevices = LokiDatabaseUtilities.getLinkedDeviceHexEncodedPublicKeys(for: hexEncodedPublicKey, in: transaction)
|
||||
let wasSentByLinkedDevice = linkedDevices.contains(hexEncodedPublicKey)
|
||||
|
@ -249,7 +249,7 @@ public final class SyncMessagesProtocol : NSObject {
|
|||
let openGroupManager = LokiPublicChatManager.shared
|
||||
guard openGroupManager.getChat(server: openGroup.url, channel: openGroup.channel) == nil else { return }
|
||||
let userPublicKey = UserDefaults.standard[.masterHexEncodedPublicKey] ?? getUserHexEncodedPublicKey()
|
||||
let displayName = SSKEnvironment.shared.profileManager.profileNameForRecipient(withID: userPublicKey)
|
||||
let displayName = SSKEnvironment.shared.profileManager.profileNameForRecipient(withID: userPublicKey, transaction: transaction)
|
||||
LokiPublicChatAPI.setDisplayName(to: displayName, on: openGroup.url)
|
||||
openGroupManager.addChat(server: openGroup.url, channel: openGroup.channel)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (nullable NSString *)localProfileName;
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID;
|
||||
- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
- (nullable NSString *)profilePictureURL;
|
||||
|
||||
- (nullable NSData *)profileKeyDataForRecipientId:(NSString *)recipientId;
|
||||
|
|
Loading…
Reference in New Issue