Merge branch 'voip_design_updates' into voip_jitsi_remover

This commit is contained in:
ismailgulek
2021-04-27 14:51:19 +03:00
5 changed files with 56 additions and 13 deletions
@@ -44,6 +44,12 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
return self.className + ".decline"
}
/// Action identifier used when the user pressed "End call" button for an incoming call.
/// The `userInfo` dictionary contains an `MXEvent` object under the `kMXKRoomBubbleCellEventKey` key, representing the invite event of the call.
static var endCallAction: String {
return self.className + ".endCall"
}
private var callDurationString: String = ""
private var isVideoCall: Bool = false
private var isIncoming: Bool = false
@@ -112,7 +118,16 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
return view
case .active:
return nil
let view = HorizontalButtonsContainerView.loadFromNib()
view.secondButton.isHidden = true
view.firstButton.style = .negative
view.firstButton.setTitle(VectorL10n.eventFormatterCallEndCall, for: .normal)
view.firstButton.setImage(Asset.Images.voiceCallHangupIcon.image, for: .normal)
view.firstButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.firstButton.addTarget(self, action: #selector(endCallAction(_:)), for: .touchUpInside)
return view
case .declined:
let view = HorizontalButtonsContainerView.loadFromNib()
view.secondButton.isHidden = true
@@ -156,13 +171,18 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
case .fledgling,
.waitLocalMedia,
.createOffer,
.inviteSent,
.connecting:
viewState = .active
if call.isIncoming {
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
} else {
statusText = VectorL10n.eventFormatterCallYouStarted
statusText = VectorL10n.eventFormatterCallConnecting
}
case .inviteSent:
if call.isIncoming {
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
} else {
statusText = VectorL10n.eventFormatterCallRinging
}
case .createAnswer,
.connected,
@@ -283,6 +303,13 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
userInfo: actionUserInfo)
}
@objc
private func endCallAction(_ sender: CallTileActionButton) {
self.delegate?.cell(self,
didRecognizeAction: Self.endCallAction,
userInfo: actionUserInfo)
}
// MARK: - MXKCellRendering
override func render(_ cellData: MXKCellData!) {
@@ -62,7 +62,6 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell {
private enum Constants {
static let secondsToDisplayAnswerDeclineOptions: TimeInterval = 30
static let secondsToNotDisplayJoinForOutgoing: TimeInterval = 30
}
private enum ViewState {
@@ -284,11 +283,10 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell {
}
if widget.isActive {
if !self.isIncoming &&
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToNotDisplayJoinForOutgoing {
if !self.isIncoming {
self.viewState = .active
self.statusText = VectorL10n.eventFormatterCallYouStarted
} else if self.isIncoming && !self.isJoined &&
self.statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
} else if !self.isJoined &&
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToDisplayAnswerDeclineOptions {
if JitsiService.shared.isWidgetDeclined(withId: widgetId) {