mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix joining to voice chats of legacy groups from Calls screen
Add account selection when joining voice chats from Calls screen
This commit is contained in:
parent
745c6e81a5
commit
efaffc6459
@ -26,6 +26,7 @@ swift_library(
|
||||
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
|
||||
"//submodules/PeerOnlineMarkerNode:PeerOnlineMarkerNode",
|
||||
"//submodules/ContextUI:ContextUI",
|
||||
"//submodules/TelegramBaseController:TelegramBaseController",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -14,6 +14,7 @@ import AlertUI
|
||||
import AppBundle
|
||||
import LocalizedPeerData
|
||||
import ContextUI
|
||||
import TelegramBaseController
|
||||
|
||||
public enum CallListControllerMode {
|
||||
case tab
|
||||
@ -65,7 +66,7 @@ private final class DeleteAllButtonNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public final class CallListController: ViewController {
|
||||
public final class CallListController: TelegramBaseController {
|
||||
private var controllerNode: CallListControllerNode {
|
||||
return self.displayNode as! CallListControllerNode
|
||||
}
|
||||
@ -98,7 +99,7 @@ public final class CallListController: ViewController {
|
||||
|
||||
self.segmentedTitleView = ItemListControllerSegmentedTitleView(theme: self.presentationData.theme, segments: [self.presentationData.strings.Calls_All, self.presentationData.strings.Calls_Missed], selectedIndex: 0)
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
|
||||
super.init(context: context, navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData), mediaAccessoryPanelVisibility: .none, locationBroadcastPanelSource: .none, groupCallPanelSource: .none)
|
||||
|
||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||
|
||||
@ -199,6 +200,10 @@ public final class CallListController: ViewController {
|
||||
if let strongSelf = self {
|
||||
strongSelf.call(peerId, isVideo: isVideo)
|
||||
}
|
||||
}, joinGroupCall: { [weak self] peerId, activeCall in
|
||||
if let strongSelf = self {
|
||||
strongSelf.joinGroupCall(peerId: peerId, invite: nil, activeCall: activeCall)
|
||||
}
|
||||
}, openInfo: { [weak self] peerId, messages in
|
||||
if let strongSelf = self {
|
||||
let _ = (strongSelf.context.account.postbox.loadedPeerWithId(peerId)
|
||||
|
@ -199,6 +199,7 @@ final class CallListControllerNode: ASDisplayNode {
|
||||
private let emptyTextNode: ASTextNode
|
||||
|
||||
private let call: (PeerId, Bool) -> Void
|
||||
private let joinGroupCall: (PeerId, CachedChannelData.ActiveCall) -> Void
|
||||
private let openInfo: (PeerId, [Message]) -> Void
|
||||
private let emptyStateUpdated: (Bool) -> Void
|
||||
|
||||
@ -207,12 +208,13 @@ final class CallListControllerNode: ASDisplayNode {
|
||||
|
||||
private let openGroupCallDisposable = MetaDisposable()
|
||||
|
||||
init(controller: CallListController, context: AccountContext, mode: CallListControllerMode, presentationData: PresentationData, call: @escaping (PeerId, Bool) -> Void, openInfo: @escaping (PeerId, [Message]) -> Void, emptyStateUpdated: @escaping (Bool) -> Void) {
|
||||
init(controller: CallListController, context: AccountContext, mode: CallListControllerMode, presentationData: PresentationData, call: @escaping (PeerId, Bool) -> Void, joinGroupCall: @escaping (PeerId, CachedChannelData.ActiveCall) -> Void, openInfo: @escaping (PeerId, [Message]) -> Void, emptyStateUpdated: @escaping (Bool) -> Void) {
|
||||
self.controller = controller
|
||||
self.context = context
|
||||
self.mode = mode
|
||||
self.presentationData = presentationData
|
||||
self.call = call
|
||||
self.joinGroupCall = joinGroupCall
|
||||
self.openInfo = openInfo
|
||||
self.emptyStateUpdated = emptyStateUpdated
|
||||
|
||||
@ -330,7 +332,13 @@ final class CallListControllerNode: ASDisplayNode {
|
||||
|
||||
let account = strongSelf.context.account
|
||||
var signal: Signal<CachedChannelData.ActiveCall?, NoError> = strongSelf.context.account.postbox.transaction { transaction -> CachedChannelData.ActiveCall? in
|
||||
return (transaction.getPeerCachedData(peerId: peerId) as? CachedChannelData)?.activeCall
|
||||
let cachedData = transaction.getPeerCachedData(peerId: peerId)
|
||||
if let cachedData = cachedData as? CachedChannelData {
|
||||
return cachedData.activeCall
|
||||
} else if let cachedData = cachedData as? CachedGroupData {
|
||||
return cachedData.activeCall
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|> mapToSignal { activeCall -> Signal<CachedChannelData.ActiveCall?, NoError> in
|
||||
if let activeCall = activeCall {
|
||||
|
@ -1374,7 +1374,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
var removedPhotoResourceIds = Set<String>()
|
||||
func update(peer: Peer?, item: PeerInfoAvatarListItem?, theme: PresentationTheme, avatarSize: CGFloat, isExpanded: Bool) {
|
||||
func update(peer: Peer?, item: PeerInfoAvatarListItem?, theme: PresentationTheme, avatarSize: CGFloat, isExpanded: Bool, isSettings: Bool) {
|
||||
if let peer = peer {
|
||||
let previousItem = self.item
|
||||
var item = item
|
||||
@ -1434,7 +1434,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
self.containerNode.isGestureEnabled = true
|
||||
self.containerNode.isGestureEnabled = !isSettings
|
||||
|
||||
if let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [])]))
|
||||
@ -1780,6 +1780,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
final class PeerInfoAvatarListNode: ASDisplayNode {
|
||||
private let isSettings: Bool
|
||||
let avatarContainerNode: PeerInfoAvatarTransformContainerNode
|
||||
let listContainerTransformNode: ASDisplayNode
|
||||
let listContainerNode: PeerInfoAvatarListContainerNode
|
||||
@ -1791,7 +1792,9 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
|
||||
|
||||
var itemsUpdated: (([PeerInfoAvatarListItem]) -> Void)?
|
||||
|
||||
init(context: AccountContext, readyWhenGalleryLoads: Bool) {
|
||||
init(context: AccountContext, readyWhenGalleryLoads: Bool, isSettings: Bool) {
|
||||
self.isSettings = isSettings
|
||||
|
||||
self.avatarContainerNode = PeerInfoAvatarTransformContainerNode(context: context)
|
||||
self.listContainerTransformNode = ASDisplayNode()
|
||||
self.listContainerNode = PeerInfoAvatarListContainerNode(context: context)
|
||||
@ -1840,7 +1843,7 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
|
||||
strongSelf.item = items.first
|
||||
strongSelf.itemsUpdated?(items)
|
||||
if let (peer, theme, avatarSize, isExpanded) = strongSelf.arguments {
|
||||
strongSelf.avatarContainerNode.update(peer: peer, item: strongSelf.item, theme: theme, avatarSize: avatarSize, isExpanded: isExpanded)
|
||||
strongSelf.avatarContainerNode.update(peer: peer, item: strongSelf.item, theme: theme, avatarSize: avatarSize, isExpanded: isExpanded, isSettings: strongSelf.isSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1848,7 +1851,7 @@ final class PeerInfoAvatarListNode: ASDisplayNode {
|
||||
|
||||
func update(size: CGSize, avatarSize: CGFloat, isExpanded: Bool, peer: Peer?, theme: PresentationTheme, transition: ContainedViewLayoutTransition) {
|
||||
self.arguments = (peer, theme, avatarSize, isExpanded)
|
||||
self.avatarContainerNode.update(peer: peer, item: self.item, theme: theme, avatarSize: avatarSize, isExpanded: isExpanded)
|
||||
self.avatarContainerNode.update(peer: peer, item: self.item, theme: theme, avatarSize: avatarSize, isExpanded: isExpanded, isSettings: self.isSettings)
|
||||
}
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
@ -2654,7 +2657,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
self.isSettings = isSettings
|
||||
self.videoCallsEnabled = VideoCallsConfiguration(appConfiguration: context.currentAppConfiguration.with { $0 }).areVideoCallsEnabled
|
||||
|
||||
self.avatarListNode = PeerInfoAvatarListNode(context: context, readyWhenGalleryLoads: avatarInitiallyExpanded)
|
||||
self.avatarListNode = PeerInfoAvatarListNode(context: context, readyWhenGalleryLoads: avatarInitiallyExpanded, isSettings: isSettings)
|
||||
|
||||
self.titleNodeContainer = ASDisplayNode()
|
||||
self.titleNodeRawContainer = ASDisplayNode()
|
||||
|
Loading…
x
Reference in New Issue
Block a user