diff --git a/SignalServiceKit/src/Loki/Database/OWSPrimaryStorage+Loki.m b/SignalServiceKit/src/Loki/Database/OWSPrimaryStorage+Loki.m index 313e90d95..0f6e2781f 100644 --- a/SignalServiceKit/src/Loki/Database/OWSPrimaryStorage+Loki.m +++ b/SignalServiceKit/src/Loki/Database/OWSPrimaryStorage+Loki.m @@ -122,6 +122,7 @@ - (void)setPreKeyBundle:(PreKeyBundle *)bundle forContact:(NSString *)pubKey transaction:(YapDatabaseReadWriteTransaction *)transaction { [transaction setObject:bundle forKey:pubKey inCollection:LKPreKeyBundleCollection]; + [transaction.connection flushTransactionsWithCompletionQueue:dispatch_get_main_queue() completionBlock:^{ }]; } - (void)removePreKeyBundleForContact:(NSString *)pubKey transaction:(YapDatabaseReadWriteTransaction *)transaction { diff --git a/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift b/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift index 8b76e226c..ff41607f3 100644 --- a/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift +++ b/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift @@ -9,7 +9,7 @@ public final class DisplayNameUtilities : NSObject { } private static var userDisplayName: String? { - return SSKEnvironment.shared.profileManager.localProfileName()! + return SSKEnvironment.shared.profileManager.localProfileName() } @objc public static func getPrivateChatDisplayName(for hexEncodedPublicKey: String) -> String? { diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index 455907a0c..21a818a8b 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -678,7 +678,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; [OWSPrimaryStorage.sharedManager.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { isNoteToSelf = [LKDatabaseUtilities isUserLinkedDevice:((TSContactThread *)thread).contactIdentifier in:transaction]; }]; - if (isNoteToSelf) { + if (isNoteToSelf && message.shouldSyncTranscript) { [self sendSyncTranscriptForMessage:message isRecipientUpdate:NO success:^{ } failure:^(NSError *error) { }]; successHandler(); return; @@ -1674,7 +1674,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; // Loki: Both for friend request messages and device link messages we don't require a session BOOL isFriendRequest = [messageSend.message isKindOfClass:LKFriendRequestMessage.class]; BOOL isDeviceLinkMessage = [messageSend.message isKindOfClass:LKDeviceLinkMessage.class]; - if (!isFriendRequest && !isDeviceLinkMessage) { + if (!isFriendRequest && !(isDeviceLinkMessage && ((LKDeviceLinkMessage *)messageSend.message).kind == LKDeviceLinkMessageKindRequest)) { [self throws_ensureRecipientHasSessionForMessageSend:messageSend recipientID:recipientID deviceId:@(OWSDevicePrimaryDeviceId)]; } @@ -1919,7 +1919,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; // Loki: Both for friend request messages and device link messages we use fallback encryption as we don't necessarily have a session yet BOOL isFriendRequest = [messageSend.message isKindOfClass:LKFriendRequestMessage.class]; BOOL isDeviceLinkMessage = [messageSend.message isKindOfClass:LKDeviceLinkMessage.class]; - if (isFriendRequest || isDeviceLinkMessage) { + if (isFriendRequest || (isDeviceLinkMessage && ((LKDeviceLinkMessage *)messageSend.message).kind == LKDeviceLinkMessageKindRequest)) { return [self throws_encryptedFriendRequestOrDeviceLinkMessageForMessageSend:messageSend deviceId:@(OWSDevicePrimaryDeviceId) plainText:plainText]; }