Video chat improvements

This commit is contained in:
Isaac 2024-10-05 20:18:25 +04:00
parent 9e1dc11997
commit a6dffb4e3e
6 changed files with 28 additions and 22 deletions

View File

@ -13051,3 +13051,5 @@ Sorry for the inconvenience.";
"Report.Comment.Placeholder.Optional" = "Add Comment (Optional)"; "Report.Comment.Placeholder.Optional" = "Add Comment (Optional)";
"Report.Comment.Info" = "Please help us by telling what is wrong with the message you have selected."; "Report.Comment.Info" = "Please help us by telling what is wrong with the message you have selected.";
"Report.Send" = "Send Report"; "Report.Send" = "Send Report";
f

View File

@ -164,7 +164,7 @@ final class VideoChatActionButtonComponent: Component {
} }
iconDiameter = 60.0 iconDiameter = 60.0
case let .video(isActive): case let .video(isActive):
titleText = "video" titleText = component.strings.VoiceChat_Video
switch component.microphoneState { switch component.microphoneState {
case .connecting: case .connecting:
backgroundColor = UIColor(white: 0.1, alpha: 1.0) backgroundColor = UIColor(white: 0.1, alpha: 1.0)
@ -177,7 +177,7 @@ final class VideoChatActionButtonComponent: Component {
} }
iconDiameter = 60.0 iconDiameter = 60.0
case .leave: case .leave:
titleText = "leave" titleText = component.strings.VoiceChat_Leave
backgroundColor = UIColor(rgb: 0x47191E) backgroundColor = UIColor(rgb: 0x47191E)
iconDiameter = 22.0 iconDiameter = 22.0
} }

View File

@ -189,6 +189,7 @@ final class VideoChatMicButtonComponent: Component {
} }
let call: PresentationGroupCall let call: PresentationGroupCall
let strings: PresentationStrings
let content: Content let content: Content
let isCollapsed: Bool let isCollapsed: Bool
let updateUnmutedStateIsPushToTalk: (Bool?) -> Void let updateUnmutedStateIsPushToTalk: (Bool?) -> Void
@ -197,6 +198,7 @@ final class VideoChatMicButtonComponent: Component {
init( init(
call: PresentationGroupCall, call: PresentationGroupCall,
strings: PresentationStrings,
content: Content, content: Content,
isCollapsed: Bool, isCollapsed: Bool,
updateUnmutedStateIsPushToTalk: @escaping (Bool?) -> Void, updateUnmutedStateIsPushToTalk: @escaping (Bool?) -> Void,
@ -204,6 +206,7 @@ final class VideoChatMicButtonComponent: Component {
scheduleAction: @escaping () -> Void scheduleAction: @escaping () -> Void
) { ) {
self.call = call self.call = call
self.strings = strings
self.content = content self.content = content
self.isCollapsed = isCollapsed self.isCollapsed = isCollapsed
self.updateUnmutedStateIsPushToTalk = updateUnmutedStateIsPushToTalk self.updateUnmutedStateIsPushToTalk = updateUnmutedStateIsPushToTalk
@ -327,29 +330,29 @@ final class VideoChatMicButtonComponent: Component {
var isEnabled = true var isEnabled = true
switch component.content { switch component.content {
case .connecting: case .connecting:
titleText = "Connecting..." titleText = component.strings.VoiceChat_Connecting
isEnabled = false isEnabled = false
case .muted: case .muted:
titleText = "Unmute" titleText = component.strings.VoiceChat_Unmute
case let .unmuted(isPushToTalk): case let .unmuted(isPushToTalk):
titleText = isPushToTalk ? "You are Live" : "Tap to Mute" titleText = isPushToTalk ? component.strings.VoiceChat_Live : component.strings.VoiceChat_Mute
case let .raiseHand(isRaised): case let .raiseHand(isRaised):
if isRaised { if isRaised {
titleText = "You asked to speak" titleText = component.strings.VoiceChat_AskedToSpeak
subtitleText = "We let the speakers know" subtitleText = component.strings.VoiceChat_AskedToSpeakHelp
} else { } else {
titleText = "Muted by Admin" titleText = component.strings.VoiceChat_MutedByAdmin
subtitleText = "Tap if you want to speak" subtitleText = component.strings.VoiceChat_MutedByAdminHelp
} }
case let .scheduled(state): case let .scheduled(state):
switch state { switch state {
case .start: case .start:
titleText = "Start Now" titleText = component.strings.VoiceChat_StartNow
case let .toggleSubscription(isSubscribed): case let .toggleSubscription(isSubscribed):
if isSubscribed { if isSubscribed {
titleText = "Clear Reminder" titleText = component.strings.VoiceChat_CancelReminder
} else { } else {
titleText = "Set Reminder" titleText = component.strings.VoiceChat_SetReminder
} }
} }
} }

View File

@ -1193,17 +1193,17 @@ final class VideoChatParticipantsComponent: Component {
let subtitle: PeerListItemComponent.Subtitle let subtitle: PeerListItemComponent.Subtitle
if participant.peer.id == component.call.accountContext.account.peerId { if participant.peer.id == component.call.accountContext.account.peerId {
subtitle = PeerListItemComponent.Subtitle(text: "this is you", color: .accent) subtitle = PeerListItemComponent.Subtitle(text: component.strings.VoiceChat_You, color: .accent)
} else if component.speakingParticipants.contains(participant.peer.id) { } else if component.speakingParticipants.contains(participant.peer.id) {
if let volume = participant.volume, volume / 100 != 100 { if let volume = participant.volume, volume / 100 != 100 {
subtitle = PeerListItemComponent.Subtitle(text: "\(volume / 100)% speaking", color: .constructive) subtitle = PeerListItemComponent.Subtitle(text: component.strings.VoiceChat_StatusSpeakingVolume("\(volume / 100)%").string, color: .constructive)
} else { } else {
subtitle = PeerListItemComponent.Subtitle(text: "speaking", color: .constructive) subtitle = PeerListItemComponent.Subtitle(text: component.strings.VoiceChat_StatusSpeaking, color: .constructive)
} }
} else if let about = participant.about, !about.isEmpty { } else if let about = participant.about, !about.isEmpty {
subtitle = PeerListItemComponent.Subtitle(text: about, color: .neutral) subtitle = PeerListItemComponent.Subtitle(text: about, color: .neutral)
} else { } else {
subtitle = PeerListItemComponent.Subtitle(text: "listening", color: .neutral) subtitle = PeerListItemComponent.Subtitle(text: component.strings.VoiceChat_StatusListening, color: .neutral)
} }
let rightAccessoryComponent: AnyComponent<Empty> = AnyComponent(VideoChatParticipantStatusComponent( let rightAccessoryComponent: AnyComponent<Empty> = AnyComponent(VideoChatParticipantStatusComponent(
@ -1667,12 +1667,12 @@ final class VideoChatParticipantsComponent: Component {
if let participants = component.participants, let inviteType = participants.inviteType { if let participants = component.participants, let inviteType = participants.inviteType {
switch inviteType { switch inviteType {
case .invite: case .invite:
inviteText = "Invite Members" inviteText = component.strings.VoiceChat_InviteMember
case .shareLink: case .shareLink:
inviteText = "Share Invite Link" inviteText = component.strings.VoiceChat_Share
} }
} else { } else {
inviteText = "Invite Members" inviteText = component.strings.VoiceChat_InviteMember
} }
let inviteListItemSize = self.inviteListItemView.update( let inviteListItemSize = self.inviteListItemView.update(
transition: transition, transition: transition,

View File

@ -123,7 +123,7 @@ final class VideoChatScheduledInfoComponent: Component {
let titleSize = self.title.update( let titleSize = self.title.update(
transition: .immediate, transition: .immediate,
component: AnyComponent(MultilineTextComponent( component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "Starts in", font: Font.with(size: 23.0, design: .round, weight: .semibold), textColor: .white)) text: .plain(NSAttributedString(string: component.strings.VoiceChat_StartsIn, font: Font.with(size: 23.0, design: .round, weight: .semibold), textColor: .white))
)), )),
environment: {}, environment: {},
containerSize: CGSize(width: availableSize.width - 16.0 * 2.0, height: 200.0) containerSize: CGSize(width: availableSize.width - 16.0 * 2.0, height: 200.0)

View File

@ -1270,9 +1270,9 @@ final class VideoChatScreenComponent: Component {
if callState.networkState == .connected, let members = self.members { if callState.networkState == .connected, let members = self.members {
idleTitleStatusText = environment.strings.VoiceChat_Panel_Members(Int32(max(1, members.totalCount))) idleTitleStatusText = environment.strings.VoiceChat_Panel_Members(Int32(max(1, members.totalCount)))
} else if callState.scheduleTimestamp != nil { } else if callState.scheduleTimestamp != nil {
idleTitleStatusText = "scheduled" idleTitleStatusText = environment.strings.VoiceChat_Scheduled
} else { } else {
idleTitleStatusText = "connecting..." idleTitleStatusText = environment.strings.VoiceChat_Connecting
} }
} else { } else {
idleTitleStatusText = " " idleTitleStatusText = " "
@ -1686,6 +1686,7 @@ final class VideoChatScreenComponent: Component {
transition: transition, transition: transition,
component: AnyComponent(VideoChatMicButtonComponent( component: AnyComponent(VideoChatMicButtonComponent(
call: component.call, call: component.call,
strings: environment.strings,
content: micButtonContent, content: micButtonContent,
isCollapsed: areButtonsCollapsed, isCollapsed: areButtonsCollapsed,
updateUnmutedStateIsPushToTalk: { [weak self] unmutedStateIsPushToTalk in updateUnmutedStateIsPushToTalk: { [weak self] unmutedStateIsPushToTalk in