diff --git a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift index 9ddd8ffbfb..5dbf6ecaf4 100644 --- a/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift +++ b/submodules/TelegramCallsUI/Sources/CallStatusBarNode.swift @@ -429,7 +429,9 @@ public class CallStatusBarNodeImpl: CallStatusBarNode { let contentHeight: CGFloat = 24.0 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.subtitleNode, frame: CGRect(origin: CGPoint(x: horizontalOrigin + titleSize.width + spacing, y: verticalOrigin + floor((contentHeight - subtitleSize.height) / 2.0)), size: subtitleSize)) diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index f9ee78dc1b..47be9af1dd 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -76,7 +76,7 @@ public final class AccountGroupCallContextImpl: AccountGroupCallContext { participantCount: 0, clientParams: nil, streamDcId: nil, - title: nil, + title: call.title, recordingStartTimestamp: nil ), topParticipants: [], @@ -1531,6 +1531,16 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.stateValue.recordingStartTimestamp = state.recordingStartTimestamp 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( participantCount: state.totalCount, topParticipants: topParticipants, diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index b3fe883908..c00ada7eab 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -1261,33 +1261,45 @@ public final class VoiceChatController: ViewController { return } - let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData.withUpdated(theme: strongSelf.darkTheme)) - var items: [ActionSheetItem] = [] - - 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() - + let _ = (strongSelf.context.account.postbox.loadedPeerWithId(strongSelf.call.peerId) + |> deliverOnMainQueue).start(next: { [weak self] chatPeer in guard let strongSelf = self else { 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) + let actionSheet = ActionSheetController(presentationData: strongSelf.presentationData.withUpdated(theme: strongSelf.darkTheme)) + 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([ - ActionSheetItemGroup(items: items), - ActionSheetItemGroup(items: [ - ActionSheetButtonItem(title: strongSelf.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in - actionSheet?.dismissAnimated() - }) + items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.VoiceChat_RemovePeerRemove, color: .destructive, action: { [weak actionSheet] in + actionSheet?.dismissAnimated() + + guard let strongSelf = self else { + 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)) + }) }) }))) } diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatJoinScreen.swift b/submodules/TelegramCallsUI/Sources/VoiceChatJoinScreen.swift index b841763a79..f77ac00fa2 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatJoinScreen.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatJoinScreen.swift @@ -601,13 +601,17 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod private var contentOffsetUpdated: ((CGFloat, ContainedViewLayoutTransition) -> Void)? private let avatarNode: AvatarNode - private let titleNode: ASTextNode - private let countNode: ASTextNode + private let titleNode: ImmediateTextNode + private let countNode: ImmediateTextNode init(context: AccountContext, peer: Peer, title: String?, memberCount: Int, theme: PresentationTheme, strings: PresentationStrings, displayOrder: PresentationPersonNameOrder) { self.avatarNode = AvatarNode(font: avatarFont) - self.titleNode = ASTextNode() - self.countNode = ASTextNode() + self.titleNode = ImmediateTextNode() + self.titleNode.maximumNumberOfLines = 4 + self.titleNode.textAlignment = .center + + self.countNode = ImmediateTextNode() + self.countNode.textAlignment = .center super.init() @@ -637,18 +641,22 @@ final class VoiceChatPreviewContentNode: ASDisplayNode, ShareContentContainerNod } 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 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))) - - 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)) - - 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)) self.contentOffsetUpdated?(-size.height + nodeHeight - 64.0, transition)