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.Info" = "Please help us by telling what is wrong with the message you have selected.";
"Report.Send" = "Send Report";
f

View File

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

View File

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

View File

@ -1193,17 +1193,17 @@ final class VideoChatParticipantsComponent: Component {
let subtitle: PeerListItemComponent.Subtitle
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) {
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 {
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 {
subtitle = PeerListItemComponent.Subtitle(text: about, color: .neutral)
} else {
subtitle = PeerListItemComponent.Subtitle(text: "listening", color: .neutral)
subtitle = PeerListItemComponent.Subtitle(text: component.strings.VoiceChat_StatusListening, color: .neutral)
}
let rightAccessoryComponent: AnyComponent<Empty> = AnyComponent(VideoChatParticipantStatusComponent(
@ -1667,12 +1667,12 @@ final class VideoChatParticipantsComponent: Component {
if let participants = component.participants, let inviteType = participants.inviteType {
switch inviteType {
case .invite:
inviteText = "Invite Members"
inviteText = component.strings.VoiceChat_InviteMember
case .shareLink:
inviteText = "Share Invite Link"
inviteText = component.strings.VoiceChat_Share
}
} else {
inviteText = "Invite Members"
inviteText = component.strings.VoiceChat_InviteMember
}
let inviteListItemSize = self.inviteListItemView.update(
transition: transition,

View File

@ -123,7 +123,7 @@ final class VideoChatScheduledInfoComponent: Component {
let titleSize = self.title.update(
transition: .immediate,
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: {},
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 {
idleTitleStatusText = environment.strings.VoiceChat_Panel_Members(Int32(max(1, members.totalCount)))
} else if callState.scheduleTimestamp != nil {
idleTitleStatusText = "scheduled"
idleTitleStatusText = environment.strings.VoiceChat_Scheduled
} else {
idleTitleStatusText = "connecting..."
idleTitleStatusText = environment.strings.VoiceChat_Connecting
}
} else {
idleTitleStatusText = " "
@ -1686,6 +1686,7 @@ final class VideoChatScreenComponent: Component {
transition: transition,
component: AnyComponent(VideoChatMicButtonComponent(
call: component.call,
strings: environment.strings,
content: micButtonContent,
isCollapsed: areButtonsCollapsed,
updateUnmutedStateIsPushToTalk: { [weak self] unmutedStateIsPushToTalk in