mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Re-order files
This commit is contained in:
parent
bb6f4d8c2c
commit
f0e5a1c1ef
3 changed files with 8 additions and 7 deletions
|
@ -6,7 +6,7 @@ public extension OWSPrimaryStorage {
|
|||
}
|
||||
|
||||
public func setDeviceLinks(_ deviceLinks: Set<DeviceLink>, in transaction: YapDatabaseReadWriteTransaction) {
|
||||
// FIXME: Clear collections first?
|
||||
// TODO: Clear collections first?
|
||||
deviceLinks.forEach { addDeviceLink($0, in: transaction) } // TODO: Check the performance impact of this
|
||||
}
|
||||
|
||||
|
|
|
@ -17,29 +17,30 @@ public final class ClosedGroupsProtocol : NSObject {
|
|||
// MARK: - Receiving
|
||||
@objc(shouldIgnoreClosedGroupMessage:inThread:wrappedIn:using:)
|
||||
public static func shouldIgnoreClosedGroupMessage(_ dataMessage: SSKProtoDataMessage, in thread: TSThread, wrappedIn envelope: SSKProtoEnvelope, using transaction: YapDatabaseReadTransaction) -> Bool {
|
||||
// The envelope source is set during UD decryption
|
||||
let hexEncodedPublicKey = envelope.source!
|
||||
guard let thread = thread as? TSGroupThread, thread.groupModel.groupType == .closedGroup,
|
||||
dataMessage.group?.type == .deliver else { return false }
|
||||
// The envelope source is set during UD decryption
|
||||
let hexEncodedPublicKey = envelope.source!
|
||||
return !thread.isUser(inGroup: hexEncodedPublicKey, transaction: transaction)
|
||||
}
|
||||
|
||||
@objc(shouldIgnoreClosedGroupUpdateMessage:in:using:)
|
||||
public static func shouldIgnoreClosedGroupUpdateMessage(_ envelope: SSKProtoEnvelope, in thread: TSGroupThread?, using transaction: YapDatabaseReadTransaction) -> Bool {
|
||||
guard let thread = thread else { return false }
|
||||
// The envelope source is set during UD decryption
|
||||
let hexEncodedPublicKey = envelope.source!
|
||||
guard let thread = thread else { return false }
|
||||
return !thread.isUserAdmin(inGroup: hexEncodedPublicKey, transaction: transaction) // TODO: I wonder how this was happening in the first place?
|
||||
}
|
||||
|
||||
@objc(establishSessionsIfNeededWithClosedGroupMembers:in:using:)
|
||||
public static func establishSessionsIfNeeded(with closedGroupMembers: [String], in thread: TSGroupThread, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
for member in closedGroupMembers {
|
||||
guard member != getUserHexEncodedPublicKey() else { continue }
|
||||
closedGroupMembers.forEach { member in
|
||||
guard member != getUserHexEncodedPublicKey() else { return }
|
||||
let hasSession = storage.containsSession(member, deviceId: 1, protocolContext: transaction) // TODO: Instead of 1 we should use the primary device ID thingy
|
||||
if hasSession { continue }
|
||||
if hasSession { return }
|
||||
let thread = TSContactThread.getOrCreateThread(withContactId: member, transaction: transaction)
|
||||
let sessionRequestMessage = SessionRequestMessage(thread: thread)
|
||||
// TODO: I don't think this works correctly with multi device
|
||||
let messageSenderJobQueue = SSKEnvironment.shared.messageSenderJobQueue
|
||||
messageSenderJobQueue.add(message: sessionRequestMessage, transaction: transaction)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue