pull/560/head
Ryan Zhao 3 years ago
parent 9e6c81d28b
commit 35f75490a4

@ -1,26 +1,5 @@
public extension TSIncomingMessage {
static func from(_ callMessage: CallMessage, associatedWith thread: TSThread) -> TSIncomingMessage {
let sender = callMessage.sender!
let result = TSIncomingMessage(
timestamp: callMessage.sentTimestamp!,
in: thread,
authorId: sender,
sourceDeviceId: 1,
messageBody: NSLocalizedString("call_incoming", comment: ""),
attachmentIds: [],
expiresInSeconds: 0,
quotedMessage: nil,
linkPreview: nil,
wasReceivedByUD: true,
openGroupInvitationName: nil,
openGroupInvitationURL: nil,
serverHash: callMessage.serverHash
)
result.isCallMessage = true
return result
}
static func from(_ visibleMessage: VisibleMessage, quotedMessage: TSQuotedMessage?, linkPreview: OWSLinkPreview?, associatedWith thread: TSThread) -> TSIncomingMessage {
let sender = visibleMessage.sender!

@ -30,7 +30,7 @@
guard self.messageType == .call else { return }
self.callState = newCallState
var contactName: String = ""
if let contactThread = self.thread as? TSContactThread {
if let contactThread = self.thread(with: transaction) as? TSContactThread {
let sessionID = contactThread.contactSessionID()
contactName = Storage.shared.getContact(with: sessionID)?.displayName(for: Contact.Context.regular) ?? sessionID
}

@ -2,13 +2,6 @@ import SessionUtilitiesKit
@objc public extension TSOutgoingMessage {
@objc(fromCallOffer:associatedWith:)
static func from(_ callMessage: CallMessage, associatedWith thread: TSThread) -> TSOutgoingMessage {
let outgoingMessage = TSOutgoingMessage(in: thread, messageBody: NSLocalizedString("call_outgoing", comment: ""), attachmentId: nil)
outgoingMessage.isCallMessage = true
return outgoingMessage
}
@objc(from:associatedWith:)
static func from(_ visibleMessage: VisibleMessage, associatedWith thread: TSThread) -> TSOutgoingMessage {
return from(visibleMessage, associatedWith: thread, using: nil)

Loading…
Cancel
Save