Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2022-02-28 18:42:24 +04:00
commit 612f5eeef1
3 changed files with 32 additions and 10 deletions

View File

@ -355,12 +355,18 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
let membersText: String
if data.participantCount == 0 {
membersText = self.strings.VoiceChat_Panel_TapToJoin
} else if let groupCall = data.groupCall, groupCall.isStream {
membersText = self.strings.LiveStream_ViewerCount(Int32(data.participantCount))
} else {
membersText = self.strings.VoiceChat_Panel_Members(Int32(data.participantCount))
}
self.currentText = membersText
self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { EnginePeer($0.peer) }, animated: false)
if data.info.isStream {
self.avatarsContent = self.avatarsContext.update(peers: [], animated: false)
} else {
self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { EnginePeer($0.peer) }, animated: false)
}
self.textNode.attributedText = NSAttributedString(string: membersText, font: Font.regular(13.0), textColor: self.theme.chat.inputPanel.secondaryTextColor)
@ -385,8 +391,12 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
membersText = strongSelf.strings.VoiceChat_Panel_Members(Int32(summaryState.participantCount))
}
strongSelf.currentText = membersText
strongSelf.avatarsContent = strongSelf.avatarsContext.update(peers: summaryState.topParticipants.map { EnginePeer($0.peer) }, animated: false)
if let info = summaryState.info, info.isStream {
strongSelf.avatarsContent = strongSelf.avatarsContext.update(peers: [], animated: false)
} else {
strongSelf.avatarsContent = strongSelf.avatarsContext.update(peers: summaryState.topParticipants.map { EnginePeer($0.peer) }, animated: false)
}
if let (size, leftInset, rightInset) = strongSelf.validLayout {
strongSelf.updateLayout(size: size, leftInset: leftInset, rightInset: rightInset, transition: .immediate)
@ -458,12 +468,18 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
let membersText: String
if data.participantCount == 0 {
membersText = self.strings.VoiceChat_Panel_TapToJoin
} else if data.info.isStream {
membersText = self.strings.LiveStream_ViewerCount(Int32(data.participantCount))
} else {
membersText = self.strings.VoiceChat_Panel_Members(Int32(data.participantCount))
}
self.currentText = membersText
self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { EnginePeer($0.peer) }, animated: false)
if data.info.isStream {
self.avatarsContent = self.avatarsContext.update(peers: [], animated: false)
} else {
self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { EnginePeer($0.peer) }, animated: false)
}
updateAudioLevels = true
}

View File

@ -149,7 +149,7 @@ public final class VoiceChatJoinScreen: ViewController {
strongSelf.dismiss()
strongSelf.join(activeCall)
} else {
strongSelf.controllerNode.setPeer(call: activeCall, peer: peer, title: call.info.title, memberCount: call.info.participantCount)
strongSelf.controllerNode.setPeer(call: activeCall, peer: peer, title: call.info.title, memberCount: call.info.participantCount, isStream: call.info.isStream)
}
} else {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
@ -632,7 +632,7 @@ public final class VoiceChatJoinScreen: ViewController {
}))
}
func setPeer(call: CachedChannelData.ActiveCall, peer: Peer, title: String?, memberCount: Int) {
func setPeer(call: CachedChannelData.ActiveCall, peer: Peer, title: String?, memberCount: Int, isStream: Bool) {
self.call = call
let transition = ContainedViewLayoutTransition.animated(duration: 0.22, curve: .easeInOut)
@ -643,7 +643,7 @@ public final class VoiceChatJoinScreen: ViewController {
self.actionButtonNode.isEnabled = true
self.actionButtonNode.setTitle(self.asSpeaker ? self.presentationData.strings.Invitation_JoinVoiceChatAsSpeaker : self.presentationData.strings.Invitation_JoinVoiceChatAsListener, with: Font.medium(20.0), with: self.presentationData.theme.actionSheet.standardActionTextColor, for: .normal)
self.transitionToContentNode(VoiceChatPreviewContentNode(context: self.context, peer: peer, title: title, memberCount: memberCount, theme: self.presentationData.theme, strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder))
self.transitionToContentNode(VoiceChatPreviewContentNode(context: self.context, peer: peer, title: title, memberCount: memberCount, isStream: isStream, theme: self.presentationData.theme, strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder))
}
}
}
@ -657,7 +657,7 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod
private let titleNode: ImmediateTextNode
private let countNode: ImmediateTextNode
init(context: AccountContext, peer: Peer, title: String?, memberCount: Int, theme: PresentationTheme, strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) {
init(context: AccountContext, peer: Peer, title: String?, memberCount: Int, isStream: Bool, theme: PresentationTheme, strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) {
self.avatarNode = AvatarNode(font: avatarFont)
self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 4
@ -677,7 +677,13 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod
self.addSubnode(self.countNode)
self.countNode.isHidden = memberCount == 0
self.countNode.attributedText = NSAttributedString(string: memberCount == 0 ? "" : strings.VoiceChat_Panel_Members(Int32(memberCount)), font: Font.regular(16.0), textColor: theme.actionSheet.secondaryTextColor)
let text: String
if isStream {
text = memberCount == 0 ? "" : strings.LiveStream_ViewerCount(Int32(memberCount))
} else {
text = memberCount == 0 ? "" : strings.VoiceChat_Panel_Members(Int32(memberCount))
}
self.countNode.attributedText = NSAttributedString(string: text, font: Font.regular(16.0), textColor: theme.actionSheet.secondaryTextColor)
}
func activate() {

@ -1 +1 @@
Subproject commit 5dfa5925449e5279ba7e1b0a401b0678dea86dcc
Subproject commit a5da9369d138bbcf6d435808fd599a59cedabe4c