mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
908 B
Swift
17 lines
908 B
Swift
|
|
public final class MessageSenderDelegate : SharedSenderKeysDelegate {
|
|
|
|
public static let shared = MessageSenderDelegate()
|
|
|
|
public func requestSenderKey(for groupPublicKey: String, senderPublicKey: String, using transaction: Any) {
|
|
print("[Loki] Requesting sender key for group public key: \(groupPublicKey), sender public key: \(senderPublicKey).")
|
|
let transaction = transaction as! YapDatabaseReadWriteTransaction
|
|
let thread = TSContactThread.getOrCreateThread(withContactId: senderPublicKey, transaction: transaction)
|
|
thread.save(with: transaction)
|
|
let closedGroupUpdateKind = ClosedGroupUpdate.Kind.senderKeyRequest(groupPublicKey: Data(hex: groupPublicKey))
|
|
let closedGroupUpdate = ClosedGroupUpdate()
|
|
closedGroupUpdate.kind = closedGroupUpdateKind
|
|
MessageSender.send(closedGroupUpdate, in: thread, using: transaction)
|
|
}
|
|
}
|