From 8aecaa2ab13e252453fa454a4e5096967b01e87f Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Tue, 3 Aug 2021 17:02:40 +0300 Subject: [PATCH] Adapt string changes & new icons --- .../RoomDirectCallStatusBubbleCell.swift | 42 ++++++++++++------- .../Group/RoomGroupCallStatusBubbleCell.swift | 5 +-- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift index 6e6a1c42b..40c9866bb 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift @@ -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 { diff --git a/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift index 62cebfd70..e7a74a70b 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift @@ -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