mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Conference update
This commit is contained in:
parent
0a499f4e2b
commit
157692bc48
@ -658,6 +658,8 @@ public final class PresentationCallImpl: PresentationCall {
|
||||
self.sharedAudioContext = nil
|
||||
self.sessionState = nil
|
||||
self.callContextState = nil
|
||||
let debugLogValue = Promise<String?>()
|
||||
self.ongoingContext?.stop(sendDebugLogs: false, debugLogValue: debugLogValue)
|
||||
self.ongoingContext = nil
|
||||
self.ongoingContextStateDisposable?.dispose()
|
||||
self.ongoingContextStateDisposable = nil
|
||||
|
@ -973,10 +973,6 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
||||
return .joined
|
||||
}
|
||||
|
||||
public func switchToConference(call: PresentationCall) {
|
||||
|
||||
}
|
||||
|
||||
private func startGroupCall(
|
||||
accountContext: AccountContext,
|
||||
peerId: PeerId,
|
||||
|
@ -5,6 +5,7 @@ import ComponentFlow
|
||||
import TelegramPresentationData
|
||||
import TelegramCore
|
||||
import LottieComponent
|
||||
import BundleIconComponent
|
||||
|
||||
final class VideoChatParticipantStatusComponent: Component {
|
||||
let muteState: GroupCallParticipantsContext.Participant.MuteState?
|
||||
@ -222,3 +223,74 @@ final class VideoChatParticipantStatusComponent: Component {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
final class VideoChatParticipantInvitedStatusComponent: Component {
|
||||
let theme: PresentationTheme
|
||||
|
||||
init(theme: PresentationTheme) {
|
||||
self.theme = theme
|
||||
}
|
||||
|
||||
static func ==(lhs: VideoChatParticipantInvitedStatusComponent, rhs: VideoChatParticipantInvitedStatusComponent) -> Bool {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private var icon = ComponentView<Empty>()
|
||||
|
||||
private var component: VideoChatParticipantInvitedStatusComponent?
|
||||
private var isUpdating: Bool = false
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
}
|
||||
|
||||
func update(component: VideoChatParticipantInvitedStatusComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.isUpdating = true
|
||||
defer {
|
||||
self.isUpdating = false
|
||||
}
|
||||
|
||||
let size = CGSize(width: 44.0, height: 44.0)
|
||||
|
||||
let iconTintColor = UIColor(white: 1.0, alpha: 0.4)
|
||||
let iconSize = self.icon.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(BundleIconComponent(
|
||||
name: "Call/GroupPeerInvited",
|
||||
tintColor: iconTintColor
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: size
|
||||
)
|
||||
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) * 0.5) - 2.0, y: floor((size.height - iconSize.height) * 0.5)), size: iconSize)
|
||||
if let iconView = self.icon.view {
|
||||
if iconView.superview == nil {
|
||||
self.addSubview(iconView)
|
||||
}
|
||||
transition.setFrame(view: iconView, frame: iconFrame)
|
||||
}
|
||||
|
||||
return size
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View()
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
@ -1258,7 +1258,7 @@ final class VideoChatParticipantsComponent: Component {
|
||||
subtitle: subtitle,
|
||||
subtitleAccessory: .none,
|
||||
presence: nil,
|
||||
rightAccessoryComponent: rightAccessoryComponent,
|
||||
rightAccessoryComponent: AnyComponentWithIdentity(id: 0, component: rightAccessoryComponent),
|
||||
selectionState: .none,
|
||||
hasNext: false,
|
||||
extractedTheme: PeerListItemComponent.ExtractedTheme(
|
||||
@ -1295,6 +1295,10 @@ final class VideoChatParticipantsComponent: Component {
|
||||
subtitle = PeerListItemComponent.Subtitle(text: "invited", color: .neutral)
|
||||
}
|
||||
|
||||
let rightAccessoryComponent: AnyComponent<Empty> = AnyComponent(VideoChatParticipantInvitedStatusComponent(
|
||||
theme: component.theme
|
||||
))
|
||||
|
||||
peerItemComponent = PeerListItemComponent(
|
||||
context: component.call.accountContext,
|
||||
theme: component.theme,
|
||||
@ -1313,7 +1317,7 @@ final class VideoChatParticipantsComponent: Component {
|
||||
subtitle: subtitle,
|
||||
subtitleAccessory: .none,
|
||||
presence: nil,
|
||||
rightAccessoryComponent: nil,
|
||||
rightAccessoryComponent: AnyComponentWithIdentity(id: 1, component: rightAccessoryComponent),
|
||||
selectionState: .none,
|
||||
hasNext: false,
|
||||
extractedTheme: PeerListItemComponent.ExtractedTheme(
|
||||
|
@ -271,11 +271,17 @@ extension VideoChatScreenComponent.View {
|
||||
guard let self, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
guard let peerId = groupCall.peerId else {
|
||||
return
|
||||
|
||||
let chatPeer: Signal<EnginePeer?, NoError>
|
||||
if let peerId = groupCall.peerId {
|
||||
chatPeer = groupCall.accountContext.engine.data.get(
|
||||
TelegramEngine.EngineData.Item.Peer.Peer(id: peerId)
|
||||
)
|
||||
} else {
|
||||
chatPeer = .single(nil)
|
||||
}
|
||||
|
||||
let _ = (groupCall.accountContext.account.postbox.loadedPeerWithId(peerId)
|
||||
let _ = (chatPeer
|
||||
|> deliverOnMainQueue).start(next: { [weak self] chatPeer in
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
@ -286,7 +292,9 @@ extension VideoChatScreenComponent.View {
|
||||
var items: [ActionSheetItem] = []
|
||||
|
||||
let nameDisplayOrder = presentationData.nameDisplayOrder
|
||||
items.append(DeleteChatPeerActionSheetItem(context: groupCall.accountContext, peer: EnginePeer(peer), chatPeer: EnginePeer(chatPeer), action: .removeFromGroup, strings: environment.strings, nameDisplayOrder: nameDisplayOrder))
|
||||
if let chatPeer {
|
||||
items.append(DeleteChatPeerActionSheetItem(context: groupCall.accountContext, peer: EnginePeer(peer), chatPeer: chatPeer, action: .removeFromGroup, strings: environment.strings, nameDisplayOrder: nameDisplayOrder))
|
||||
}
|
||||
|
||||
items.append(ActionSheetButtonItem(title: environment.strings.VoiceChat_RemovePeerRemove, color: .destructive, action: { [weak self, weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
@ -294,16 +302,15 @@ extension VideoChatScreenComponent.View {
|
||||
guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else {
|
||||
return
|
||||
}
|
||||
guard let callPeerId = groupCall.peerId else {
|
||||
return
|
||||
}
|
||||
|
||||
let _ = groupCall.accountContext.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: groupCall.accountContext.engine, peerId: callPeerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start()
|
||||
if groupCall.isConference {
|
||||
groupCall.kickPeer(id: peer.id)
|
||||
} else {
|
||||
if let callPeerId = groupCall.peerId {
|
||||
let _ = groupCall.accountContext.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: groupCall.accountContext.engine, peerId: callPeerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start()
|
||||
groupCall.removedPeer(peer.id)
|
||||
}
|
||||
}
|
||||
|
||||
self.presentUndoOverlay(content: .banned(text: environment.strings.VoiceChat_RemovedPeerText(EnginePeer(peer).displayTitle(strings: environment.strings, displayOrder: nameDisplayOrder)).string), action: { _ in return false })
|
||||
}))
|
||||
|
@ -235,7 +235,7 @@ public final class PeerListItemComponent: Component {
|
||||
let subtitleAccessory: SubtitleAccessory
|
||||
let presence: EnginePeer.Presence?
|
||||
let rightAccessory: RightAccessory
|
||||
let rightAccessoryComponent: AnyComponent<Empty>?
|
||||
let rightAccessoryComponent: AnyComponentWithIdentity<Empty>?
|
||||
let reaction: Reaction?
|
||||
let story: EngineStoryItem?
|
||||
let message: EngineMessage?
|
||||
@ -266,7 +266,7 @@ public final class PeerListItemComponent: Component {
|
||||
subtitleAccessory: SubtitleAccessory,
|
||||
presence: EnginePeer.Presence?,
|
||||
rightAccessory: RightAccessory = .none,
|
||||
rightAccessoryComponent: AnyComponent<Empty>? = nil,
|
||||
rightAccessoryComponent: AnyComponentWithIdentity<Empty>? = nil,
|
||||
reaction: Reaction? = nil,
|
||||
story: EngineStoryItem? = nil,
|
||||
message: EngineMessage? = nil,
|
||||
@ -764,8 +764,13 @@ public final class PeerListItemComponent: Component {
|
||||
}
|
||||
}
|
||||
|
||||
if let rightAccessoryComponentView = self.rightAccessoryComponentView, component.rightAccessoryComponent?.id != previousComponent?.rightAccessoryComponent?.id {
|
||||
self.rightAccessoryComponentView = nil
|
||||
rightAccessoryComponentView.view?.removeFromSuperview()
|
||||
}
|
||||
|
||||
var rightAccessoryComponentSize: CGSize?
|
||||
if let rightAccessoryComponent = component.rightAccessoryComponent {
|
||||
if let rightAccessoryComponent = component.rightAccessoryComponent?.component {
|
||||
var rightAccessoryComponentTransition = transition
|
||||
let rightAccessoryComponentView: ComponentView<Empty>
|
||||
if let current = self.rightAccessoryComponentView {
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "invited.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/invited.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/invited.pdf
vendored
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
Subproject commit fd1cfbd8151b2c32d5471a4f5431faa6274ce421
|
||||
Subproject commit 579cae3c3c70c6ed8bc0d88cc41de28bd50a7f1b
|
Loading…
x
Reference in New Issue
Block a user