mirror of https://github.com/oxen-io/session-ios
Restructure
parent
d01e732515
commit
add2c467e4
@ -0,0 +1,40 @@
|
||||
import SessionProtocolKit
|
||||
import PromiseKit
|
||||
|
||||
extension MessageSender {
|
||||
|
||||
@objc(send:withAttachments:inThread:usingTransaction:)
|
||||
public static func send(_ message: VisibleMessage, with attachments: [SignalAttachment], in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
prep(attachments, for: message, using: transaction)
|
||||
send(message, in: thread, using: transaction)
|
||||
}
|
||||
|
||||
@objc(send:inThread:usingTransaction:)
|
||||
public static func send(_ message: Message, in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) {
|
||||
message.threadID = thread.uniqueId!
|
||||
let destination = Message.Destination.from(thread)
|
||||
let job = MessageSendJob(message: message, destination: destination)
|
||||
JobQueue.shared.add(job, using: transaction)
|
||||
}
|
||||
|
||||
@objc(sendNonDurably:withAttachments:inThread:usingTransaction:)
|
||||
public static func objc_sendNonDurably(_ message: VisibleMessage, with attachments: [SignalAttachment], in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) -> AnyPromise {
|
||||
return AnyPromise.from(sendNonDurably(message, with: attachments, in: thread, using: transaction))
|
||||
}
|
||||
|
||||
@objc(sendNonDurably:inThread:usingTransaction:)
|
||||
public static func objc_sendNonDurably(_ message: Message, in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) -> AnyPromise {
|
||||
return AnyPromise.from(sendNonDurably(message, in: thread, using: transaction))
|
||||
}
|
||||
|
||||
public static func sendNonDurably(_ message: VisibleMessage, with attachments: [SignalAttachment], in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) -> Promise<Void> {
|
||||
prep(attachments, for: message, using: transaction)
|
||||
return sendNonDurably(message, in: thread, using: transaction)
|
||||
}
|
||||
|
||||
public static func sendNonDurably(_ message: Message, in thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) -> Promise<Void> {
|
||||
message.threadID = thread.uniqueId!
|
||||
let destination = Message.Destination.from(thread)
|
||||
return MessageSender.send(message, to: destination, using: transaction)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue