Merge commit '73657fc155095932f58a0ee19eee3283f2617737'

This commit is contained in:
Ali 2021-03-12 22:04:32 +04:00
commit 02258369b7
4 changed files with 65 additions and 33 deletions

View File

@ -429,7 +429,9 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
let contentHeight: CGFloat = 24.0 let contentHeight: CGFloat = 24.0
let verticalOrigin: CGFloat = size.height - contentHeight let verticalOrigin: CGFloat = size.height - contentHeight
let transition: ContainedViewLayoutTransition = wasEmpty ? .immediate : .animated(duration: 0.2, curve: .easeInOut) let sizeChanged = self.titleNode.frame.size.width != titleSize.width
let transition: ContainedViewLayoutTransition = wasEmpty || sizeChanged ? .immediate : .animated(duration: 0.2, curve: .easeInOut)
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin, y: verticalOrigin + floor((contentHeight - titleSize.height) / 2.0)), size: titleSize)) transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin, y: verticalOrigin + floor((contentHeight - titleSize.height) / 2.0)), size: titleSize))
transition.updateFrame(node: self.subtitleNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin + titleSize.width + spacing, y: verticalOrigin + floor((contentHeight - subtitleSize.height) / 2.0)), size: subtitleSize)) transition.updateFrame(node: self.subtitleNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin + titleSize.width + spacing, y: verticalOrigin + floor((contentHeight - subtitleSize.height) / 2.0)), size: subtitleSize))

View File

@ -76,7 +76,7 @@ public final class AccountGroupCallContextImpl: AccountGroupCallContext {
participantCount: 0, participantCount: 0,
clientParams: nil, clientParams: nil,
streamDcId: nil, streamDcId: nil,
title: nil, title: call.title,
recordingStartTimestamp: nil recordingStartTimestamp: nil
), ),
topParticipants: [], topParticipants: [],
@ -1531,6 +1531,16 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
strongSelf.stateValue.recordingStartTimestamp = state.recordingStartTimestamp strongSelf.stateValue.recordingStartTimestamp = state.recordingStartTimestamp
strongSelf.stateValue.title = state.title strongSelf.stateValue.title = state.title
strongSelf.summaryInfoState.set(.single(SummaryInfoState(info: GroupCallInfo(
id: callInfo.id,
accessHash: callInfo.accessHash,
participantCount: state.totalCount,
clientParams: nil,
streamDcId: nil,
title: state.title,
recordingStartTimestamp: state.recordingStartTimestamp
))))
strongSelf.summaryParticipantsState.set(.single(SummaryParticipantsState( strongSelf.summaryParticipantsState.set(.single(SummaryParticipantsState(
participantCount: state.totalCount, participantCount: state.totalCount,
topParticipants: topParticipants, topParticipants: topParticipants,

View File

@ -1262,33 +1262,45 @@ public final class VoiceChatController: ViewController {
return return
} }
let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData.withUpdated(theme: strongSelf.darkTheme)) let _ = (strongSelf.context.account.postbox.loadedPeerWithId(strongSelf.call.peerId)
var items: [ActionSheetItem] = [] |> deliverOnMainQueue).start(next: { [weak self] chatPeer in
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: peer, chatPeer: peer, action: .removeFromGroup, strings: strongSelf.presentationData.strings, nameDisplayOrder: strongSelf.presentationData.nameDisplayOrder))
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.VoiceChat_RemovePeerRemove, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
let _ = strongSelf.context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(account: strongSelf.context.account, peerId: strongSelf.call.peerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start() let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData.withUpdated(theme: strongSelf.darkTheme))
strongSelf.call.removedPeer(peer.id) var items: [ActionSheetItem] = []
strongSelf.presentUndoOverlay(content: .banned(text: strongSelf.presentationData.strings.VoiceChat_RemovedPeerText(peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).0), action: { _ in return false }) var action: DeleteChatPeerAction = .removeFromGroup
})) if let chatPeer = chatPeer as? TelegramChannel, case .broadcast = chatPeer.info {
action = .removeFromChannel
}
items.append(DeleteChatPeerActionSheetItem(context: strongSelf.context, peer: peer, chatPeer: peer, action: action, strings: strongSelf.presentationData.strings, nameDisplayOrder: strongSelf.presentationData.nameDisplayOrder))
actionSheet.setItemGroups([ items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.VoiceChat_RemovePeerRemove, color: .destructive, action: { [weak actionSheet] in
ActionSheetItemGroup(items: items), actionSheet?.dismissAnimated()
ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: strongSelf.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in guard let strongSelf = self else {
actionSheet?.dismissAnimated() return
}) }
let _ = strongSelf.context.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(account: strongSelf.context.account, peerId: strongSelf.call.peerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start()
strongSelf.call.removedPeer(peer.id)
strongSelf.presentUndoOverlay(content: .banned(text: strongSelf.presentationData.strings.VoiceChat_RemovedPeerText(peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).0), action: { _ in return false })
}))
actionSheet.setItemGroups([
ActionSheetItemGroup(items: items),
ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: strongSelf.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])
]) ])
]) strongSelf.controller?.present(actionSheet, in: .window(.root))
strongSelf.controller?.present(actionSheet, in: .window(.root)) })
}) })
}))) })))
} }

View File

@ -601,13 +601,17 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod
private var contentOffsetUpdated: ((CGFloat, ContainedViewLayoutTransition) -> Void)? private var contentOffsetUpdated: ((CGFloat, ContainedViewLayoutTransition) -> Void)?
private let avatarNode: AvatarNode private let avatarNode: AvatarNode
private let titleNode: ASTextNode private let titleNode: ImmediateTextNode
private let countNode: ASTextNode 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, theme: PresentationTheme, strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) {
self.avatarNode = AvatarNode(font: avatarFont) self.avatarNode = AvatarNode(font: avatarFont)
self.titleNode = ASTextNode() self.titleNode = ImmediateTextNode()
self.countNode = ASTextNode() self.titleNode.maximumNumberOfLines = 4
self.titleNode.textAlignment = .center
self.countNode = ImmediateTextNode()
self.countNode.textAlignment = .center
super.init() super.init()
@ -637,18 +641,22 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod
} }
func updateLayout(size: CGSize, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) { func updateLayout(size: CGSize, bottomInset: CGFloat, transition: ContainedViewLayoutTransition) {
let nodeHeight: CGFloat = self.countNode.isHidden ? 204.0 : 224.0 let sideInset: CGFloat = 16.0
let titleSize = self.titleNode.updateLayout(CGSize(width: size.width - sideInset * 2.0, height: size.height))
let countSize = self.countNode.updateLayout(CGSize(width: size.width - sideInset * 2.0, height: size.height))
var nodeHeight: CGFloat = 185.0 + titleSize.height
if !self.countNode.isHidden {
nodeHeight += 20.0
}
let verticalOrigin = size.height - nodeHeight let verticalOrigin = size.height - nodeHeight
let avatarSize: CGFloat = 75.0 let avatarSize: CGFloat = 75.0
transition.updateFrame(node: self.avatarNode, frame: CGRect(origin: CGPoint(x: floor((size.width - avatarSize) / 2.0), y: verticalOrigin + 22.0), size: CGSize(width: avatarSize, height: avatarSize))) transition.updateFrame(node: self.avatarNode, frame: CGRect(origin: CGPoint(x: floor((size.width - avatarSize) / 2.0), y: verticalOrigin + 22.0), size: CGSize(width: avatarSize, height: avatarSize)))
let titleSize = self.titleNode.measure(size)
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: verticalOrigin + 22.0 + avatarSize + 15.0), size: titleSize)) transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: verticalOrigin + 22.0 + avatarSize + 15.0), size: titleSize))
let countSize = self.countNode.measure(size)
transition.updateFrame(node: self.countNode, frame: CGRect(origin: CGPoint(x: floor((size.width - countSize.width) / 2.0), y: verticalOrigin + 22.0 + avatarSize + 15.0 + titleSize.height + 1.0), size: countSize)) transition.updateFrame(node: self.countNode, frame: CGRect(origin: CGPoint(x: floor((size.width - countSize.width) / 2.0), y: verticalOrigin + 22.0 + avatarSize + 15.0 + titleSize.height + 1.0), size: countSize))
self.contentOffsetUpdated?(-size.height + nodeHeight - 64.0, transition) self.contentOffsetUpdated?(-size.height + nodeHeight - 64.0, transition)