minor fix

pull/560/head
Ryan Zhao 3 years ago
parent 0c2027d7c8
commit e504e23f92

@ -69,6 +69,7 @@ public final class SessionCall: NSObject, WebRTCSessionDelegate {
case local case local
case remote case remote
case unanswered case unanswered
case answeredElsewhere
} }
// MARK: Audio I/O mode // MARK: Audio I/O mode
@ -245,6 +246,9 @@ public final class SessionCall: NSObject, WebRTCSessionDelegate {
newMessageBody = self.isOutgoing ? NSLocalizedString("call_rejected", comment: "") : NSLocalizedString("call_missing", comment: "") newMessageBody = self.isOutgoing ? NSLocalizedString("call_rejected", comment: "") : NSLocalizedString("call_missing", comment: "")
case .unanswered: case .unanswered:
newMessageBody = NSLocalizedString("call_timeout", comment: "") newMessageBody = NSLocalizedString("call_timeout", comment: "")
case .answeredElsewhere:
newMessageBody = messageToUpdate.body!
shouldMarkAsRead = true
} }
} }
messageToUpdate.updateCall(withNewBody: newMessageBody, transaction: transaction) messageToUpdate.updateCall(withNewBody: newMessageBody, transaction: transaction)

@ -105,8 +105,8 @@ public final class SessionCallManager: NSObject {
guard let call = currentCall else { return } guard let call = currentCall else { return }
if let reason = reason { if let reason = reason {
self.provider.reportCall(with: call.callID, endedAt: nil, reason: reason) self.provider.reportCall(with: call.callID, endedAt: nil, reason: reason)
if reason == .answeredElsewhere { return }
switch (reason) { switch (reason) {
case .answeredElsewhere: call.updateCallMessage(mode: .answeredElsewhere)
case .unanswered: call.updateCallMessage(mode: .unanswered) case .unanswered: call.updateCallMessage(mode: .unanswered)
case .declinedElsewhere: call.updateCallMessage(mode: .local) case .declinedElsewhere: call.updateCallMessage(mode: .local)
default: call.updateCallMessage(mode: .remote) default: call.updateCallMessage(mode: .remote)

@ -132,13 +132,13 @@ public final class MessageSender : NSObject {
guard message.isValid else { handleFailure(with: Error.invalidMessage, using: transaction); return promise } guard message.isValid else { handleFailure(with: Error.invalidMessage, using: transaction); return promise }
// Stop here if this is a self-send, unless it's: // Stop here if this is a self-send, unless it's:
// a configuration message // a configuration message
// a sync message (visible message or expiration timer update message) // a sync message
// a closed group control message of type `new` // a closed group control message of type `new`
// an unsend request // an unsend request
// a call message of type `answer` or `endCall` // a call message of type `answer` or `endCall`
guard !isSelfSend || shouldSyncMessage(message) else { guard !isSelfSend || isSyncMessage || shouldSyncMessage(message) else {
storage.write(with: { transaction in storage.write(with: { transaction in
MessageSender.handleSuccessfulMessageSend(message, to: destination, isSyncMessage: isSyncMessage, using: transaction) MessageSender.handleSuccessfulMessageSend(message, to: destination, using: transaction)
seal.fulfill(()) seal.fulfill(())
}, completion: { }) }, completion: { })
return promise return promise
@ -396,6 +396,6 @@ public final class MessageSender : NSObject {
} else { } else {
return false return false
} } ?? false } } ?? false
return isNewClosedGroupControlMessage || isCallControlMessage || message is ConfigurationMessage || message is UnsendRequest || message is VisibleMessage || message is ExpirationTimerUpdate return isNewClosedGroupControlMessage || isCallControlMessage || message is ConfigurationMessage || message is UnsendRequest
} }
} }

Loading…
Cancel
Save