mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Inline forum improvements
This commit is contained in:
parent
787b8483c4
commit
a98e69cfa0
@ -366,7 +366,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
case let .known(offset):
|
case let .known(offset):
|
||||||
let isFirstFilter = strongSelf.chatListDisplayNode.containerNode.currentItemNode.chatListFilter == strongSelf.chatListDisplayNode.containerNode.availableFilters.first?.filter
|
let isFirstFilter = strongSelf.chatListDisplayNode.containerNode.currentItemNode.chatListFilter == strongSelf.chatListDisplayNode.containerNode.availableFilters.first?.filter
|
||||||
|
|
||||||
if offset <= navigationBarSearchContentHeight + 1.0 && !isFirstFilter {
|
if offset <= navigationBarSearchContentHeight + 1.0 && strongSelf.chatListDisplayNode.inlineStackContainerNode != nil {
|
||||||
|
strongSelf.setInlineChatList(location: nil)
|
||||||
|
} else if offset <= navigationBarSearchContentHeight + 1.0 && !isFirstFilter {
|
||||||
let firstFilter = strongSelf.chatListDisplayNode.containerNode.availableFilters.first ?? .all
|
let firstFilter = strongSelf.chatListDisplayNode.containerNode.availableFilters.first ?? .all
|
||||||
let targetTab: ChatListFilterTabEntryId
|
let targetTab: ChatListFilterTabEntryId
|
||||||
switch firstFilter {
|
switch firstFilter {
|
||||||
@ -380,11 +382,15 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
if let searchContentNode = strongSelf.searchContentNode {
|
if let searchContentNode = strongSelf.searchContentNode {
|
||||||
searchContentNode.updateExpansionProgress(1.0, animated: true)
|
searchContentNode.updateExpansionProgress(1.0, animated: true)
|
||||||
}
|
}
|
||||||
|
if let inlineStackContainerNode = strongSelf.chatListDisplayNode.inlineStackContainerNode {
|
||||||
|
inlineStackContainerNode.currentItemNode.scrollToPosition(.top)
|
||||||
|
} else {
|
||||||
strongSelf.chatListDisplayNode.containerNode.currentItemNode.scrollToPosition(.top)
|
strongSelf.chatListDisplayNode.containerNode.currentItemNode.scrollToPosition(.top)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.badgeDisposable = (combineLatest(renderedTotalUnreadCount(accountManager: context.sharedContext.accountManager, engine: context.engine), self.presentationDataValue.get()) |> deliverOnMainQueue).start(next: { [weak self] count, presentationData in
|
self.badgeDisposable = (combineLatest(renderedTotalUnreadCount(accountManager: context.sharedContext.accountManager, engine: context.engine), self.presentationDataValue.get()) |> deliverOnMainQueue).start(next: { [weak self] count, presentationData in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
@ -949,7 +955,11 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
if case let .channel(channel) = peer, channel.flags.contains(.isForum), threadId == nil {
|
if case let .channel(channel) = peer, channel.flags.contains(.isForum), threadId == nil {
|
||||||
strongSelf.chatListDisplayNode.clearHighlightAnimated(true)
|
strongSelf.chatListDisplayNode.clearHighlightAnimated(true)
|
||||||
|
|
||||||
|
if strongSelf.chatListDisplayNode.inlineStackContainerNode?.location == .forum(peerId: channel.id) {
|
||||||
|
strongSelf.setInlineChatList(location: nil)
|
||||||
|
} else {
|
||||||
strongSelf.setInlineChatList(location: .forum(peerId: channel.id))
|
strongSelf.setInlineChatList(location: .forum(peerId: channel.id))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if let threadId = threadId {
|
if let threadId = threadId {
|
||||||
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .never).start()
|
let _ = strongSelf.context.sharedContext.navigateToForumThread(context: strongSelf.context, peerId: peer.id, threadId: threadId, messageId: nil, navigationController: navigationController, activateInput: nil, keepStack: .never).start()
|
||||||
@ -2633,6 +2643,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
if strongSelf.chatListDisplayNode.containerNode.currentItemNode.chatListFilter?.id == updatedFilter?.id {
|
if strongSelf.chatListDisplayNode.containerNode.currentItemNode.chatListFilter?.id == updatedFilter?.id {
|
||||||
strongSelf.scrollToTop?()
|
strongSelf.scrollToTop?()
|
||||||
} else {
|
} else {
|
||||||
|
if strongSelf.chatListDisplayNode.inlineStackContainerNode != nil {
|
||||||
|
strongSelf.setInlineChatList(location: nil)
|
||||||
|
}
|
||||||
strongSelf.chatListDisplayNode.containerNode.switchToFilter(id: updatedFilter.flatMap { .filter($0.id) } ?? .all)
|
strongSelf.chatListDisplayNode.containerNode.switchToFilter(id: updatedFilter.flatMap { .filter($0.id) } ?? .all)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1702,6 +1702,8 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
|||||||
func scrollToTop() {
|
func scrollToTop() {
|
||||||
if let searchDisplayController = self.searchDisplayController {
|
if let searchDisplayController = self.searchDisplayController {
|
||||||
searchDisplayController.contentNode.scrollToTop()
|
searchDisplayController.contentNode.scrollToTop()
|
||||||
|
} else if let inlineStackContainerNode = self.inlineStackContainerNode {
|
||||||
|
inlineStackContainerNode.scrollToTop()
|
||||||
} else {
|
} else {
|
||||||
self.containerNode.scrollToTop()
|
self.containerNode.scrollToTop()
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ final class ChatListBadgeNode: ASDisplayNode {
|
|||||||
|
|
||||||
let backgroundFrame = CGRect(x: 0.0, y: 0.0, width: badgeWidth, height: strongSelf.backgroundNode.image?.size.height ?? 0.0)
|
let backgroundFrame = CGRect(x: 0.0, y: 0.0, width: badgeWidth, height: strongSelf.backgroundNode.image?.size.height ?? 0.0)
|
||||||
if let (textLayout, _) = textLayoutAndApply {
|
if let (textLayout, _) = textLayoutAndApply {
|
||||||
let badgeTextFrame = CGRect(origin: CGPoint(x: backgroundFrame.midX - textLayout.size.width / 2.0, y: backgroundFrame.minY + floorToScreenPixels((backgroundFrame.height - textLayout.size.height) / 2.0)), size: textLayout.size)
|
let badgeTextFrame = CGRect(origin: CGPoint(x: backgroundFrame.midX - textLayout.size.width / 2.0, y: backgroundFrame.minY + UIScreenPixel + floorToScreenPixels((backgroundFrame.height - textLayout.size.height) / 2.0)), size: textLayout.size)
|
||||||
strongSelf.textNode.position = badgeTextFrame.center
|
strongSelf.textNode.position = badgeTextFrame.center
|
||||||
strongSelf.textNode.bounds = CGRect(origin: CGPoint(), size: badgeTextFrame.size)
|
strongSelf.textNode.bounds = CGRect(origin: CGPoint(), size: badgeTextFrame.size)
|
||||||
if animateTextNode {
|
if animateTextNode {
|
||||||
|
@ -790,6 +790,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
let contextContainer: ContextControllerSourceNode
|
let contextContainer: ContextControllerSourceNode
|
||||||
let mainContentContainerNode: ASDisplayNode
|
let mainContentContainerNode: ASDisplayNode
|
||||||
|
|
||||||
|
let avatarContainerNode: ASDisplayNode
|
||||||
let avatarNode: AvatarNode
|
let avatarNode: AvatarNode
|
||||||
var avatarIconView: ComponentHostView<Empty>?
|
var avatarIconView: ComponentHostView<Empty>?
|
||||||
var avatarIconComponent: EmojiStatusComponent?
|
var avatarIconComponent: EmojiStatusComponent?
|
||||||
@ -1037,6 +1038,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
self.backgroundNode.isLayerBacked = true
|
self.backgroundNode.isLayerBacked = true
|
||||||
self.backgroundNode.displaysAsynchronously = false
|
self.backgroundNode.displaysAsynchronously = false
|
||||||
|
|
||||||
|
self.avatarContainerNode = ASDisplayNode()
|
||||||
self.avatarNode = AvatarNode(font: avatarPlaceholderFont(size: 26.0))
|
self.avatarNode = AvatarNode(font: avatarPlaceholderFont(size: 26.0))
|
||||||
|
|
||||||
self.highlightedBackgroundNode = ASDisplayNode()
|
self.highlightedBackgroundNode = ASDisplayNode()
|
||||||
@ -1096,7 +1098,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
self.addSubnode(self.contextContainer)
|
self.addSubnode(self.contextContainer)
|
||||||
self.contextContainer.addSubnode(self.mainContentContainerNode)
|
self.contextContainer.addSubnode(self.mainContentContainerNode)
|
||||||
|
|
||||||
self.contextContainer.addSubnode(self.avatarNode)
|
self.avatarContainerNode.addSubnode(self.avatarNode)
|
||||||
|
self.contextContainer.addSubnode(self.avatarContainerNode)
|
||||||
self.contextContainer.addSubnode(self.onlineNode)
|
self.contextContainer.addSubnode(self.onlineNode)
|
||||||
|
|
||||||
self.mainContentContainerNode.addSubnode(self.titleNode)
|
self.mainContentContainerNode.addSubnode(self.titleNode)
|
||||||
@ -1122,10 +1125,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if item.interaction.inlineNavigationLocation != nil {
|
if item.interaction.inlineNavigationLocation != nil {
|
||||||
return false
|
strongSelf.contextContainer.targetNodeForActivationProgress = strongSelf.avatarContainerNode
|
||||||
}
|
} else if let value = strongSelf.hitTest(location, with: nil), value === strongSelf.compoundTextButtonNode?.view {
|
||||||
|
|
||||||
if let value = strongSelf.hitTest(location, with: nil), value === strongSelf.compoundTextButtonNode?.view {
|
|
||||||
strongSelf.contextContainer.targetNodeForActivationProgress = strongSelf.compoundHighlightingNode
|
strongSelf.contextContainer.targetNodeForActivationProgress = strongSelf.compoundHighlightingNode
|
||||||
} else {
|
} else {
|
||||||
strongSelf.contextContainer.targetNodeForActivationProgress = nil
|
strongSelf.contextContainer.targetNodeForActivationProgress = nil
|
||||||
@ -1293,6 +1294,9 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
reallyHighlighted = true
|
reallyHighlighted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if item.interaction.inlineNavigationLocation != nil {
|
||||||
|
reallyHighlighted = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return reallyHighlighted
|
return reallyHighlighted
|
||||||
}
|
}
|
||||||
@ -1944,7 +1948,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
} else {
|
} else {
|
||||||
let badgeTextColor: UIColor
|
let badgeTextColor: UIColor
|
||||||
if unreadCount.muted {
|
if unreadCount.muted {
|
||||||
if unreadCount.isProvisonal {
|
if unreadCount.isProvisonal, case .forum = item.chatListLocation {
|
||||||
badgeTextColor = theme.unreadBadgeInactiveBackgroundColor
|
badgeTextColor = theme.unreadBadgeInactiveBackgroundColor
|
||||||
currentBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactiveProvisional(item.presentationData.theme, diameter: badgeDiameter)
|
currentBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactiveProvisional(item.presentationData.theme, diameter: badgeDiameter)
|
||||||
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactiveProvisional(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactiveProvisional(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
||||||
@ -1954,7 +1958,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactive(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundInactive(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if unreadCount.isProvisonal {
|
if unreadCount.isProvisonal, case .forum = item.chatListLocation {
|
||||||
badgeTextColor = theme.unreadBadgeActiveBackgroundColor
|
badgeTextColor = theme.unreadBadgeActiveBackgroundColor
|
||||||
currentBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundActiveProvisional(item.presentationData.theme, diameter: badgeDiameter)
|
currentBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundActiveProvisional(item.presentationData.theme, diameter: badgeDiameter)
|
||||||
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundActiveProvisional(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
currentAvatarBadgeBackgroundImage = PresentationResourcesChatList.badgeBackgroundActiveProvisional(item.presentationData.theme, diameter: avatarBadgeDiameter)
|
||||||
@ -2187,8 +2191,17 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
maxTitleLines = 1
|
maxTitleLines = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var titleLeftCutout: CGFloat = 0.0
|
||||||
|
if item.interaction.isInlineMode {
|
||||||
|
titleLeftCutout = 22.0
|
||||||
|
}
|
||||||
|
|
||||||
let titleRectWidth = rawContentWidth - dateLayout.size.width - 10.0 - statusWidth - titleIconsWidth
|
let titleRectWidth = rawContentWidth - dateLayout.size.width - 10.0 - statusWidth - titleIconsWidth
|
||||||
let (titleLayout, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: maxTitleLines, truncationType: .end, constrainedSize: CGSize(width: titleRectWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
var titleCutout: TextNodeCutout?
|
||||||
|
if !titleLeftCutout.isZero {
|
||||||
|
titleCutout = TextNodeCutout(topLeft: CGSize(width: titleLeftCutout, height: 10.0), topRight: nil, bottomRight: nil)
|
||||||
|
}
|
||||||
|
let (titleLayout, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: maxTitleLines, truncationType: .end, constrainedSize: CGSize(width: titleRectWidth, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: titleCutout, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
var inputActivitiesSize: CGSize?
|
var inputActivitiesSize: CGSize?
|
||||||
var inputActivitiesApply: (() -> Void)?
|
var inputActivitiesApply: (() -> Void)?
|
||||||
@ -2221,8 +2234,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let peerRevealOptions: [ItemListRevealOption]
|
var peerRevealOptions: [ItemListRevealOption]
|
||||||
let peerLeftRevealOptions: [ItemListRevealOption]
|
var peerLeftRevealOptions: [ItemListRevealOption]
|
||||||
switch item.content {
|
switch item.content {
|
||||||
case let .peer(_, renderedPeer, _, _, _, presence, _, _, _, _, _, _, displayAsMessage, _, _, _):
|
case let .peer(_, renderedPeer, _, _, _, presence, _, _, _, _, _, _, displayAsMessage, _, _, _):
|
||||||
if !displayAsMessage {
|
if !displayAsMessage {
|
||||||
@ -2300,6 +2313,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
peerLeftRevealOptions = []
|
peerLeftRevealOptions = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if item.interaction.inlineNavigationLocation != nil {
|
||||||
|
peerRevealOptions = []
|
||||||
|
peerLeftRevealOptions = []
|
||||||
|
}
|
||||||
|
|
||||||
let (onlineLayout, onlineApply) = onlineLayout(online, onlineIsVoiceChat)
|
let (onlineLayout, onlineApply) = onlineLayout(online, onlineIsVoiceChat)
|
||||||
var animateContent = false
|
var animateContent = false
|
||||||
if let currentItem = currentItem, currentItem.content.chatLocation == item.content.chatLocation {
|
if let currentItem = currentItem, currentItem.content.chatLocation == item.content.chatLocation {
|
||||||
@ -2466,7 +2484,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
let targetAvatarScaleOffset: CGFloat = -(avatarFrame.width - avatarFrame.width * avatarScale) * 0.5
|
let targetAvatarScaleOffset: CGFloat = -(avatarFrame.width - avatarFrame.width * avatarScale) * 0.5
|
||||||
avatarScaleOffset = targetAvatarScaleOffset * inlineNavigationLocation.progress
|
avatarScaleOffset = targetAvatarScaleOffset * inlineNavigationLocation.progress
|
||||||
}
|
}
|
||||||
transition.updatePosition(node: strongSelf.avatarNode, position: avatarFrame.center.offsetBy(dx: avatarScaleOffset, dy: 0.0))
|
transition.updateFrame(node: strongSelf.avatarContainerNode, frame: avatarFrame)
|
||||||
|
transition.updatePosition(node: strongSelf.avatarNode, position: avatarFrame.offsetBy(dx: -avatarFrame.minX, dy: -avatarFrame.minY).center.offsetBy(dx: avatarScaleOffset, dy: 0.0))
|
||||||
transition.updateBounds(node: strongSelf.avatarNode, bounds: CGRect(origin: CGPoint(), size: avatarFrame.size))
|
transition.updateBounds(node: strongSelf.avatarNode, bounds: CGRect(origin: CGPoint(), size: avatarFrame.size))
|
||||||
transition.updateTransformScale(node: strongSelf.avatarNode, scale: avatarScale)
|
transition.updateTransformScale(node: strongSelf.avatarNode, scale: avatarScale)
|
||||||
strongSelf.avatarNode.updateSize(size: avatarFrame.size)
|
strongSelf.avatarNode.updateSize(size: avatarFrame.size)
|
||||||
@ -2610,9 +2629,9 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if case .forum = item.index {
|
if case .forum = item.index {
|
||||||
strongSelf.avatarNode.isHidden = true
|
strongSelf.avatarContainerNode.isHidden = true
|
||||||
} else {
|
} else {
|
||||||
strongSelf.avatarNode.isHidden = false
|
strongSelf.avatarContainerNode.isHidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
let onlineFrame: CGRect
|
let onlineFrame: CGRect
|
||||||
@ -2623,6 +2642,10 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
transition.updateFrame(node: strongSelf.onlineNode, frame: onlineFrame)
|
transition.updateFrame(node: strongSelf.onlineNode, frame: onlineFrame)
|
||||||
|
|
||||||
|
let onlineInlineNavigationFraction: CGFloat = item.interaction.inlineNavigationLocation?.progress ?? 0.0
|
||||||
|
transition.updateAlpha(node: strongSelf.onlineNode, alpha: 1.0 - onlineInlineNavigationFraction)
|
||||||
|
transition.updateSublayerTransformScale(node: strongSelf.onlineNode, scale: (1.0 - onlineInlineNavigationFraction) * 1.0 + onlineInlineNavigationFraction * 0.001)
|
||||||
|
|
||||||
let onlineIcon: UIImage?
|
let onlineIcon: UIImage?
|
||||||
if strongSelf.reallyHighlighted {
|
if strongSelf.reallyHighlighted {
|
||||||
onlineIcon = PresentationResourcesChatList.recentStatusOnlineIcon(item.presentationData.theme, state: .highlighted, voiceChat: onlineIsVoiceChat)
|
onlineIcon = PresentationResourcesChatList.recentStatusOnlineIcon(item.presentationData.theme, state: .highlighted, voiceChat: onlineIsVoiceChat)
|
||||||
@ -2726,9 +2749,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var titleOffset: CGFloat = 0.0
|
var titleOffset: CGFloat = 0.0
|
||||||
if item.interaction.isInlineMode {
|
|
||||||
titleOffset += 22.0
|
|
||||||
}
|
|
||||||
if let currentSecretIconImage = currentSecretIconImage {
|
if let currentSecretIconImage = currentSecretIconImage {
|
||||||
let iconNode: ASImageNode
|
let iconNode: ASImageNode
|
||||||
if let current = strongSelf.secretIconNode {
|
if let current = strongSelf.secretIconNode {
|
||||||
@ -3039,7 +3059,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if let currentMutedIconImage = currentMutedIconImage {
|
if let currentMutedIconImage = currentMutedIconImage {
|
||||||
strongSelf.mutedIconNode.image = currentMutedIconImage
|
strongSelf.mutedIconNode.image = currentMutedIconImage
|
||||||
strongSelf.mutedIconNode.isHidden = false
|
strongSelf.mutedIconNode.isHidden = false
|
||||||
transition.updateFrame(node: strongSelf.mutedIconNode, frame: CGRect(origin: CGPoint(x: nextTitleIconOrigin - 5.0, y: titleFrame.minY - 1.0 - UIScreenPixel), size: currentMutedIconImage.size))
|
transition.updateFrame(node: strongSelf.mutedIconNode, frame: CGRect(origin: CGPoint(x: nextTitleIconOrigin - 5.0, y: titleFrame.maxY - currentMutedIconImage.size.height + 0.0 + UIScreenPixel), size: currentMutedIconImage.size))
|
||||||
nextTitleIconOrigin += currentMutedIconImage.size.width + 1.0
|
nextTitleIconOrigin += currentMutedIconImage.size.width + 1.0
|
||||||
} else {
|
} else {
|
||||||
strongSelf.mutedIconNode.image = nil
|
strongSelf.mutedIconNode.image = nil
|
||||||
|
@ -260,12 +260,6 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate {
|
|||||||
|
|
||||||
OngoingCallContext.setupAudioSession()
|
OngoingCallContext.setupAudioSession()
|
||||||
|
|
||||||
/*do {
|
|
||||||
try AVAudioSession.sharedInstance().setMode(.voiceChat)
|
|
||||||
} catch let e {
|
|
||||||
print("AVAudioSession.sharedInstance().setMode(.voiceChat) error \(e)")
|
|
||||||
}*/
|
|
||||||
|
|
||||||
self.provider.reportNewIncomingCall(with: uuid, update: update, completion: { error in
|
self.provider.reportNewIncomingCall(with: uuid, update: update, completion: { error in
|
||||||
completion?(error as NSError?)
|
completion?(error as NSError?)
|
||||||
})
|
})
|
||||||
|
@ -536,6 +536,8 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#else
|
||||||
if let audioSessionControl = audioSessionControl, previous == nil || previousControl == nil {
|
if let audioSessionControl = audioSessionControl, previous == nil || previousControl == nil {
|
||||||
if let callKitIntegration = self.callKitIntegration {
|
if let callKitIntegration = self.callKitIntegration {
|
||||||
callKitIntegration.applyVoiceChatOutputMode(outputMode: .custom(self.currentAudioOutputValue))
|
callKitIntegration.applyVoiceChatOutputMode(outputMode: .custom(self.currentAudioOutputValue))
|
||||||
@ -544,6 +546,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
audioSessionControl.setup(synchronous: true)
|
audioSessionControl.setup(synchronous: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
let mappedVideoState: PresentationCallState.VideoState
|
let mappedVideoState: PresentationCallState.VideoState
|
||||||
let mappedRemoteVideoState: PresentationCallState.RemoteVideoState
|
let mappedRemoteVideoState: PresentationCallState.RemoteVideoState
|
||||||
@ -866,9 +869,13 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
}
|
}
|
||||||
if tone != self.toneRenderer?.tone {
|
if tone != self.toneRenderer?.tone {
|
||||||
if let tone = tone {
|
if let tone = tone {
|
||||||
|
#if DEBUG
|
||||||
|
let _ = tone
|
||||||
|
#else
|
||||||
let toneRenderer = PresentationCallToneRenderer(tone: tone)
|
let toneRenderer = PresentationCallToneRenderer(tone: tone)
|
||||||
self.toneRenderer = toneRenderer
|
self.toneRenderer = toneRenderer
|
||||||
toneRenderer.setAudioSessionActive(self.isAudioSessionActive)
|
toneRenderer.setAudioSessionActive(self.isAudioSessionActive)
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
self.toneRenderer = nil
|
self.toneRenderer = nil
|
||||||
}
|
}
|
||||||
@ -1045,6 +1052,8 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
|> delay(1.0, queue: Queue.mainQueue())
|
|> delay(1.0, queue: Queue.mainQueue())
|
||||||
))
|
))
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#else
|
||||||
if let audioSessionControl = self.audioSessionControl {
|
if let audioSessionControl = self.audioSessionControl {
|
||||||
if let callKitIntegration = self.callKitIntegration {
|
if let callKitIntegration = self.callKitIntegration {
|
||||||
callKitIntegration.applyVoiceChatOutputMode(outputMode: .custom(self.currentAudioOutputValue))
|
callKitIntegration.applyVoiceChatOutputMode(outputMode: .custom(self.currentAudioOutputValue))
|
||||||
@ -1052,6 +1061,7 @@ public final class PresentationCallImpl: PresentationCall {
|
|||||||
audioSessionControl.setOutputMode(.custom(output))
|
audioSessionControl.setOutputMode(.custom(output))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public func debugInfo() -> Signal<(String, String), NoError> {
|
public func debugInfo() -> Signal<(String, String), NoError> {
|
||||||
|
@ -326,11 +326,17 @@ public final class ChatListHeaderComponent: Component {
|
|||||||
})
|
})
|
||||||
transition.setAlpha(view: self.rightButtonOffsetContainer, alpha: pow(1.0 - fraction, 2.0))
|
transition.setAlpha(view: self.rightButtonOffsetContainer, alpha: pow(1.0 - fraction, 2.0))
|
||||||
|
|
||||||
|
if let backButtonView = self.backButtonView {
|
||||||
|
transition.setBounds(view: backButtonView, bounds: CGRect(origin: CGPoint(x: fraction * self.bounds.width * 0.5, y: 0.0), size: backButtonView.bounds.size), completion: { _ in
|
||||||
|
completion()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if let chatListTitleView = self.chatListTitleView, let nextBackButtonView = nextView.backButtonView {
|
if let chatListTitleView = self.chatListTitleView, let nextBackButtonView = nextView.backButtonView {
|
||||||
let titleFrame = chatListTitleView.titleNode.view.convert(chatListTitleView.titleNode.bounds, to: self.titleOffsetContainer)
|
let titleFrame = chatListTitleView.titleNode.view.convert(chatListTitleView.titleNode.bounds, to: self.titleOffsetContainer)
|
||||||
let backButtonTitleFrame = nextBackButtonView.convert(nextBackButtonView.titleView.frame, to: nextView)
|
let backButtonTitleFrame = nextBackButtonView.convert(nextBackButtonView.titleView.frame, to: nextView)
|
||||||
|
|
||||||
let totalOffset = titleFrame.midX - backButtonTitleFrame.midX
|
let totalOffset = titleFrame.minX - backButtonTitleFrame.minX
|
||||||
|
|
||||||
transition.setBounds(view: self.titleOffsetContainer, bounds: CGRect(origin: CGPoint(x: totalOffset * fraction, y: 0.0), size: self.titleOffsetContainer.bounds.size))
|
transition.setBounds(view: self.titleOffsetContainer, bounds: CGRect(origin: CGPoint(x: totalOffset * fraction, y: 0.0), size: self.titleOffsetContainer.bounds.size))
|
||||||
transition.setAlpha(view: self.titleOffsetContainer, alpha: (1.0 - fraction))
|
transition.setAlpha(view: self.titleOffsetContainer, alpha: (1.0 - fraction))
|
||||||
@ -350,7 +356,7 @@ public final class ChatListHeaderComponent: Component {
|
|||||||
let previousTitleFrame = previousChatListTitleView.titleNode.view.convert(previousChatListTitleView.titleNode.bounds, to: previousView.titleOffsetContainer)
|
let previousTitleFrame = previousChatListTitleView.titleNode.view.convert(previousChatListTitleView.titleNode.bounds, to: previousView.titleOffsetContainer)
|
||||||
let backButtonTitleFrame = backButtonView.convert(backButtonView.titleView.frame, to: self)
|
let backButtonTitleFrame = backButtonView.convert(backButtonView.titleView.frame, to: self)
|
||||||
|
|
||||||
let totalOffset = previousTitleFrame.midX - backButtonTitleFrame.midX
|
let totalOffset = previousTitleFrame.minX - backButtonTitleFrame.minX
|
||||||
|
|
||||||
transition.setBounds(view: backButtonView.titleOffsetContainer, bounds: CGRect(origin: CGPoint(x: -totalOffset * (1.0 - fraction), y: 0.0), size: backButtonView.titleOffsetContainer.bounds.size))
|
transition.setBounds(view: backButtonView.titleOffsetContainer, bounds: CGRect(origin: CGPoint(x: -totalOffset * (1.0 - fraction), y: 0.0), size: backButtonView.titleOffsetContainer.bounds.size))
|
||||||
transition.setAlpha(view: backButtonView.titleOffsetContainer, alpha: fraction)
|
transition.setAlpha(view: backButtonView.titleOffsetContainer, alpha: fraction)
|
||||||
|
@ -890,11 +890,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
|
|||||||
|
|
||||||
#ifdef WEBRTC_IOS
|
#ifdef WEBRTC_IOS
|
||||||
RTCAudioSessionConfiguration *sharedConfiguration = [RTCAudioSessionConfiguration webRTCConfiguration];
|
RTCAudioSessionConfiguration *sharedConfiguration = [RTCAudioSessionConfiguration webRTCConfiguration];
|
||||||
if (useManualAudioSessionControl) {
|
|
||||||
sharedConfiguration.mode = AVAudioSessionModeVoiceChat;
|
sharedConfiguration.mode = AVAudioSessionModeVoiceChat;
|
||||||
} else {
|
|
||||||
sharedConfiguration.mode = AVAudioSessionModeVoiceChat;
|
|
||||||
}
|
|
||||||
sharedConfiguration.categoryOptions |= AVAudioSessionCategoryOptionMixWithOthers;
|
sharedConfiguration.categoryOptions |= AVAudioSessionCategoryOptionMixWithOthers;
|
||||||
sharedConfiguration.categoryOptions |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;
|
sharedConfiguration.categoryOptions |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;
|
||||||
sharedConfiguration.outputNumberOfChannels = 1;
|
sharedConfiguration.outputNumberOfChannels = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user