|
|
|
@ -27,13 +27,7 @@ public final class SessionMetaProtocol : NSObject {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static func getDestinationsForOutgoingSyncMessage() -> Set<String> {
|
|
|
|
|
var result: Set<String> = []
|
|
|
|
|
storage.dbReadConnection.read { transaction in
|
|
|
|
|
// Aim the message at all linked devices, including this one
|
|
|
|
|
// TODO: Should we exclude the current device?
|
|
|
|
|
result = LokiDatabaseUtilities.getLinkedDeviceHexEncodedPublicKeys(for: getUserHexEncodedPublicKey(), in: transaction)
|
|
|
|
|
}
|
|
|
|
|
return result
|
|
|
|
|
return MultiDeviceProtocol.getUserLinkedDevices()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@objc(getDestinationsForOutgoingGroupMessage:inThread:)
|
|
|
|
@ -53,7 +47,9 @@ public final class SessionMetaProtocol : NSObject {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = Set(outgoingGroupMessage.sendingRecipientIds()).intersection(thread.groupModel.groupMemberIds) // This is what Signal does
|
|
|
|
|
result = Set(outgoingGroupMessage.sendingRecipientIds())
|
|
|
|
|
.intersection(thread.groupModel.groupMemberIds)
|
|
|
|
|
.subtracting(MultiDeviceProtocol.getUserLinkedDevices())
|
|
|
|
|
}
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
@ -73,6 +69,7 @@ public final class SessionMetaProtocol : NSObject {
|
|
|
|
|
// MARK: Transcripts
|
|
|
|
|
@objc(shouldSendTranscriptForMessage:in:)
|
|
|
|
|
public static func shouldSendTranscript(for message: TSOutgoingMessage, in thread: TSThread) -> Bool {
|
|
|
|
|
guard message.shouldSyncTranscript() else { return false }
|
|
|
|
|
let isOpenGroupMessage = (thread as? TSGroupThread)?.isPublicChat == true
|
|
|
|
|
let wouldSignalRequireTranscript = (AreRecipientUpdatesEnabled() || !message.hasSyncedTranscript)
|
|
|
|
|
guard wouldSignalRequireTranscript && !isOpenGroupMessage else { return false }
|
|
|
|
@ -81,7 +78,7 @@ public final class SessionMetaProtocol : NSObject {
|
|
|
|
|
usesMultiDevice = !storage.getDeviceLinks(for: getUserHexEncodedPublicKey(), in: transaction).isEmpty
|
|
|
|
|
|| UserDefaults.standard[.masterHexEncodedPublicKey] != nil
|
|
|
|
|
}
|
|
|
|
|
return usesMultiDevice && isThreadNoteToSelf(thread)
|
|
|
|
|
return usesMultiDevice
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Typing Indicators
|
|
|
|
|