From 55e49a79aa98ec024688d676b4f8c5dd1081e14d Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 6 Aug 2021 16:19:53 +0300 Subject: [PATCH 1/3] New strings --- Riot/Assets/en.lproj/Vector.strings | 3 ++- Riot/Generated/Strings.swift | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 4193d23ca..e46028bc4 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -848,7 +848,8 @@ Tap the + to start adding people."; "event_formatter_message_edited_mention" = "(edited)"; "event_formatter_call_connecting" = "Connecting…"; "event_formatter_call_ringing" = "Ringing…"; -"event_formatter_call_has_ended" = "Call ended %@"; +"event_formatter_call_has_ended" = "Call ended"; +"event_formatter_call_has_ended_with_time" = "Call ended • %@"; "event_formatter_call_incoming_voice" = "Incoming voice call"; "event_formatter_call_incoming_video" = "Incoming video call"; "event_formatter_call_active_voice" = "Active voice call"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 3598c2003..680cd7848 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -1274,9 +1274,13 @@ internal enum VectorL10n { internal static var eventFormatterCallEndCall: String { return VectorL10n.tr("Vector", "event_formatter_call_end_call") } - /// Call ended %@ - internal static func eventFormatterCallHasEnded(_ p1: String) -> String { - return VectorL10n.tr("Vector", "event_formatter_call_has_ended", p1) + /// Call ended + internal static var eventFormatterCallHasEnded: String { + return VectorL10n.tr("Vector", "event_formatter_call_has_ended") + } + /// Call ended • %@ + internal static func eventFormatterCallHasEndedWithTime(_ p1: String) -> String { + return VectorL10n.tr("Vector", "event_formatter_call_has_ended_with_time", p1) } /// Incoming video call internal static var eventFormatterCallIncomingVideo: String { From 01d8d55d51241a9c003fee2c2ba8d3c1383c4c6a Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 6 Aug 2021 16:20:10 +0300 Subject: [PATCH 2/3] Use new strings for ended calls --- .../RoomDirectCallStatusBubbleCell.swift | 28 ++++++++++++------- .../Group/RoomGroupCallStatusBubbleCell.swift | 14 ++++++++-- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift index 8ed4af78f..103296014 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Call/Direct/RoomDirectCallStatusBubbleCell.swift @@ -220,27 +220,27 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell { .remoteHangup, .answeredElseWhere: viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() case .missed: if call.isIncoming { viewState = .missed statusText = isVideoCall ? VectorL10n.eventFormatterCallMissedVideo : VectorL10n.eventFormatterCallMissedVoice } else { - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() } case .busy: configureForRejectedCall(call: call) @unknown default: viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() } case .inviteExpired, .answeredElseWhere: viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() @unknown default: viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() } } @@ -261,21 +261,21 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell { statusText = VectorL10n.eventFormatterCallYouDeclined } else { viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() } } private func configureForHangupCall(withEvent event: MXEvent) { guard let hangupEventContent = MXCallHangupEventContent(fromJSON: event.content) else { viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() return } switch hangupEventContent.reasonType { case .userHangup: viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() default: viewState = .failed statusText = VectorL10n.eventFormatterCallConnectionFailed @@ -290,7 +290,15 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell { } else { // outgoing unanswered call viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() + } + } + + private func updateStatusTextForEndedCall() { + if callDurationString.count > 0 { + statusText = VectorL10n.eventFormatterCallHasEndedWithTime(callDurationString) + } else { + statusText = VectorL10n.eventFormatterCallHasEnded } } @@ -404,7 +412,7 @@ class RoomDirectCallStatusBubbleCell: RoomBaseCallBubbleCell { // there is no reject or hangup event, we can just say this call has ended viewState = .ended - statusText = VectorL10n.eventFormatterCallHasEnded(callDurationString) + updateStatusTextForEndedCall() return } diff --git a/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift b/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift index e7a74a70b..2a37dccf6 100644 --- a/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift +++ b/Riot/Modules/Room/Views/BubbleCells/Call/Group/RoomGroupCallStatusBubbleCell.swift @@ -158,6 +158,14 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell { } } + private func updateStatusTextForEndedCall() { + if callDurationString.count > 0 { + statusText = VectorL10n.eventFormatterCallHasEndedWithTime(callDurationString) + } else { + statusText = VectorL10n.eventFormatterCallHasEnded + } + } + // MARK: - Actions @objc @@ -265,7 +273,7 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell { in: room, with: roomState) else { self.viewState = .ended - self.statusText = VectorL10n.eventFormatterCallHasEnded(self.callDurationString) + self.updateStatusTextForEndedCall() return } @@ -277,7 +285,7 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell { guard let widget = widgets.first(where: { $0.widgetId == widgetId }) else { self.viewState = .ended - self.statusText = VectorL10n.eventFormatterCallHasEnded(self.callDurationString) + self.updateStatusTextForEndedCall() return } @@ -301,7 +309,7 @@ class RoomGroupCallStatusBubbleCell: RoomBaseCallBubbleCell { } } else { self.viewState = .ended - self.statusText = VectorL10n.eventFormatterCallHasEnded(self.callDurationString) + self.updateStatusTextForEndedCall() } } } From 5b8ca9f448c058e9cd052808e9124ee19fd80d0f Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Fri, 6 Aug 2021 16:21:24 +0300 Subject: [PATCH 3/3] Update CHANGES.rst --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4109d36bb..78d4b4692 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,7 @@ Changes to be released in next version * Voice messages: Allow voice message playback control from the iOS lock screen and control center (#4655) * Voice messages: Improve audio recording quality * Voice messages: Remove labs setting and enable them by default + * VoIP: Additional changes on call tiles (#4642). 🐛 Bugfix *