Adapt string changes & new icons

This commit is contained in:
ismailgulek 2021-08-03 17:02:40 +03:00
parent 1bdecc6e2d
commit 8c23471e2d
No known key found for this signature in database
GPG key ID: E96336D42D9470A9
2 changed files with 28 additions and 19 deletions

View file

@ -57,6 +57,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
private var viewState: ViewState = .unknown {
didSet {
updateBottomContentView()
updateCallIcon()
}
}
@ -78,11 +79,24 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
return formatter
}
private func updateCallIcon() {
switch viewState {
case .missed:
innerContentView.callIconView.image = isVideoCall ?
Asset.Images.callMissedVideo.image :
Asset.Images.callMissedVoice.image
default:
innerContentView.callIconView.image = isVideoCall ?
Asset.Images.callVideoIcon.image :
Asset.Images.voiceCallHangonIcon.image
}
}
private func updateBottomContentView() {
bottomContentView = bottomView(for: viewState)
}
private var callTypeIcon: UIImage {
private var callButtonIcon: UIImage {
if isVideoCall {
return Asset.Images.callVideoIcon.image
} else {
@ -112,7 +126,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
view.secondButton.style = .positive
view.secondButton.setTitle(VectorL10n.eventFormatterCallAnswer, for: .normal)
view.secondButton.setImage(callTypeIcon, for: .normal)
view.secondButton.setImage(callButtonIcon, for: .normal)
view.secondButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.secondButton.addTarget(self, action: #selector(answerCallAction(_:)), for: .touchUpInside)
@ -134,7 +148,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
view.firstButton.style = .positive
view.firstButton.setTitle(VectorL10n.eventFormatterCallBack, for: .normal)
view.firstButton.setImage(callTypeIcon, for: .normal)
view.firstButton.setImage(callButtonIcon, for: .normal)
view.firstButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.firstButton.addTarget(self, action: #selector(callBackAction(_:)), for: .touchUpInside)
@ -145,7 +159,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
view.firstButton.style = .positive
view.firstButton.setTitle(VectorL10n.eventFormatterCallBack, for: .normal)
view.firstButton.setImage(callTypeIcon, for: .normal)
view.firstButton.setImage(callButtonIcon, for: .normal)
view.firstButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.firstButton.addTarget(self, action: #selector(callBackAction(_:)), for: .touchUpInside)
@ -158,7 +172,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
view.firstButton.style = .positive
view.firstButton.setTitle(VectorL10n.eventFormatterCallRetry, for: .normal)
view.firstButton.setImage(callTypeIcon, for: .normal)
view.firstButton.setImage(callButtonIcon, for: .normal)
view.firstButton.removeTarget(nil, action: nil, for: .touchUpInside)
view.firstButton.addTarget(self, action: #selector(callBackAction(_:)), for: .touchUpInside)
@ -174,13 +188,13 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
.connecting:
viewState = .active
if call.isIncoming {
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
statusText = isVideoCall ? VectorL10n.eventFormatterCallActiveVideo : VectorL10n.eventFormatterCallActiveVoice
} else {
statusText = VectorL10n.eventFormatterCallConnecting
}
case .inviteSent:
if call.isIncoming {
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
statusText = isVideoCall ? VectorL10n.eventFormatterCallActiveVideo : VectorL10n.eventFormatterCallActiveVoice
} else {
statusText = VectorL10n.eventFormatterCallRinging
}
@ -189,14 +203,14 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
.onHold,
.remotelyOnHold:
viewState = .active
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
statusText = isVideoCall ? VectorL10n.eventFormatterCallActiveVideo : VectorL10n.eventFormatterCallActiveVoice
case .ringing:
if call.isIncoming {
viewState = .ringing
statusText = nil
} else {
viewState = .active
statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
statusText = isVideoCall ? VectorL10n.eventFormatterCallActiveVideo : VectorL10n.eventFormatterCallActiveVoice
}
case .ended:
switch call.endReason {
@ -210,7 +224,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
case .missed:
if call.isIncoming {
viewState = .missed
statusText = VectorL10n.eventFormatterCallYouMissed
statusText = isVideoCall ? VectorL10n.eventFormatterCallMissedVideo : VectorL10n.eventFormatterCallMissedVoice
} else {
statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString)
}
@ -272,7 +286,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
if isIncoming {
// missed call
viewState = .missed
statusText = VectorL10n.eventFormatterCallYouMissed
statusText = isVideoCall ? VectorL10n.eventFormatterCallMissedVideo : VectorL10n.eventFormatterCallMissedVoice
} else {
// outgoing unanswered call
viewState = .ended
@ -366,11 +380,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell {
callDurationString = readableCallDuration(from: events)
isIncoming = inviteEvent.sender != bubbleCellData.mxSession.myUserId
callInviteEvent = inviteEvent
innerContentView.callIconView.image = self.callTypeIcon
innerContentView.callTypeLabel.text = isVideoCall ?
VectorL10n.eventFormatterCallVideo :
VectorL10n.eventFormatterCallVoice
updateCallIcon()
let callId = callInviteEventContent.callId
guard let call = bubbleCellData.mxSession.callManager.call(withCallId: callId) else {

View file

@ -224,7 +224,6 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell {
self.widgetEvent = widgetEvent
self.widgetId = widgetId
innerContentView.callIconView.image = Asset.Images.callVideoIcon.image
innerContentView.callTypeLabel.text = VectorL10n.eventFormatterCallVideo
if isIncoming && !isJoined &&
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToDisplayAnswerDeclineOptions {
@ -285,7 +284,7 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell {
if widget.isActive {
if !self.isIncoming {
self.viewState = .active
self.statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
self.statusText = VectorL10n.eventFormatterCallActiveVideo
} else if !self.isJoined &&
TimeInterval(widgetEvent.age)/MSEC_PER_SEC < Constants.secondsToDisplayAnswerDeclineOptions {
@ -298,7 +297,7 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell {
}
} else {
self.viewState = .active
self.statusText = VectorL10n.eventFormatterCallYouCurrentlyIn
self.statusText = VectorL10n.eventFormatterCallActiveVideo
}
} else {
self.viewState = .ended