mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '00c8eab23eb332bd4d5fb527e8fdc9cd4f613aeb'
This commit is contained in:
commit
c569a07429
@ -5971,12 +5971,14 @@ Sorry for the inconvenience.";
|
|||||||
"VoiceChat.Panel.Members_3_10" = "%@ members";
|
"VoiceChat.Panel.Members_3_10" = "%@ members";
|
||||||
"VoiceChat.Panel.Members_many" = "%@ members";
|
"VoiceChat.Panel.Members_many" = "%@ members";
|
||||||
"VoiceChat.Panel.Members_any" = "%@ members";
|
"VoiceChat.Panel.Members_any" = "%@ members";
|
||||||
"VoiceChat.Panel.MembersSpeaking_0" = "%@ members speaking";
|
|
||||||
"VoiceChat.Panel.MembersSpeaking_1" = "%@ member speaking";
|
"VoiceChat.Status.Members_0" = "[%@]members";
|
||||||
"VoiceChat.Panel.MembersSpeaking_2" = "%@ members speaking";
|
"VoiceChat.Status.Members_1" = "[%@]member";
|
||||||
"VoiceChat.Panel.MembersSpeaking_3_10" = "%@ members speaking";
|
"VoiceChat.Status.Members_2" = "[%@]members";
|
||||||
"VoiceChat.Panel.MembersSpeaking_many" = "%@ members speaking";
|
"VoiceChat.Status.Members_3_10" = "[%@]members";
|
||||||
"VoiceChat.Panel.MembersSpeaking_any" = "%@ members speaking";
|
"VoiceChat.Status.Members_many" = "[%@]members";
|
||||||
|
"VoiceChat.Status.Members_any" = "[%@]members";
|
||||||
|
"VoiceChat.Status.MembersFormat" = "%1$@ %2$@";
|
||||||
|
|
||||||
"ChannelInfo.CreateVoiceChat" = "Start Voice Chat";
|
"ChannelInfo.CreateVoiceChat" = "Start Voice Chat";
|
||||||
|
|
||||||
|
@ -962,7 +962,11 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||||||
let resolvedStatusBarStyle: NavigationStatusBarStyle
|
let resolvedStatusBarStyle: NavigationStatusBarStyle
|
||||||
switch statusBarStyle {
|
switch statusBarStyle {
|
||||||
case .Ignore, .Hide:
|
case .Ignore, .Hide:
|
||||||
resolvedStatusBarStyle = self.theme.statusBar
|
if self.inCallStatusBar != nil {
|
||||||
|
resolvedStatusBarStyle = .white
|
||||||
|
} else {
|
||||||
|
resolvedStatusBarStyle = self.theme.statusBar
|
||||||
|
}
|
||||||
case .Black:
|
case .Black:
|
||||||
resolvedStatusBarStyle = .black
|
resolvedStatusBarStyle = .black
|
||||||
case .White:
|
case .White:
|
||||||
|
@ -189,12 +189,12 @@ final class NavigationModalContainer: ASDisplayNode, UIScrollViewDelegate, UIGes
|
|||||||
@objc func dimTapGesture(_ recognizer: UITapGestureRecognizer) {
|
@objc func dimTapGesture(_ recognizer: UITapGestureRecognizer) {
|
||||||
if case .ended = recognizer.state {
|
if case .ended = recognizer.state {
|
||||||
if !self.isDismissed {
|
if !self.isDismissed {
|
||||||
self.dismisWithAnimation()
|
self.dismissWithAnimation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func dismisWithAnimation() {
|
private func dismissWithAnimation() {
|
||||||
let scrollView = self.scrollNode.view
|
let scrollView = self.scrollNode.view
|
||||||
let targetOffset: CGFloat
|
let targetOffset: CGFloat
|
||||||
let duration = 0.3
|
let duration = 0.3
|
||||||
|
@ -279,6 +279,9 @@ class ChannelMembersSearchControllerNode: ASDisplayNode {
|
|||||||
if peer.id == context.account.peerId {
|
if peer.id == context.account.peerId {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if let user = peer as? TelegramUser, user.botInfo != nil || user.flags.contains(.isSupport) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
for filter in filters {
|
for filter in filters {
|
||||||
switch filter {
|
switch filter {
|
||||||
case let .exclude(ids):
|
case let .exclude(ids):
|
||||||
@ -399,6 +402,9 @@ class ChannelMembersSearchControllerNode: ASDisplayNode {
|
|||||||
if participant.peer.id == context.account.peerId {
|
if participant.peer.id == context.account.peerId {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if let user = participant.peer as? TelegramUser, user.botInfo != nil || user.flags.contains(.isSupport) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
for filter in filters {
|
for filter in filters {
|
||||||
switch filter {
|
switch filter {
|
||||||
case let .exclude(ids):
|
case let .exclude(ids):
|
||||||
|
@ -147,7 +147,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||||||
private let backgroundNode: CallStatusBarBackgroundNode
|
private let backgroundNode: CallStatusBarBackgroundNode
|
||||||
private let microphoneNode: VoiceChatMicrophoneNode
|
private let microphoneNode: VoiceChatMicrophoneNode
|
||||||
private let titleNode: ImmediateTextNode
|
private let titleNode: ImmediateTextNode
|
||||||
private let subtitleNode: ImmediateTextNode
|
private let subtitleNode: ImmediateAnimatedCountLabelNode
|
||||||
|
|
||||||
private let audioLevelDisposable = MetaDisposable()
|
private let audioLevelDisposable = MetaDisposable()
|
||||||
private let stateDisposable = MetaDisposable()
|
private let stateDisposable = MetaDisposable()
|
||||||
@ -169,7 +169,7 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||||||
self.backgroundNode = CallStatusBarBackgroundNode()
|
self.backgroundNode = CallStatusBarBackgroundNode()
|
||||||
self.microphoneNode = VoiceChatMicrophoneNode()
|
self.microphoneNode = VoiceChatMicrophoneNode()
|
||||||
self.titleNode = ImmediateTextNode()
|
self.titleNode = ImmediateTextNode()
|
||||||
self.subtitleNode = ImmediateTextNode()
|
self.subtitleNode = ImmediateAnimatedCountLabelNode()
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
@ -267,6 +267,10 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||||||
var title: String = ""
|
var title: String = ""
|
||||||
var subtitle: String = ""
|
var subtitle: String = ""
|
||||||
|
|
||||||
|
let textFont = Font.regular(13.0)
|
||||||
|
let textColor = UIColor.white
|
||||||
|
var segments: [AnimatedCountLabelNode.Segment] = []
|
||||||
|
|
||||||
if let strings = self.strings {
|
if let strings = self.strings {
|
||||||
if let currentPeer = self.currentPeer {
|
if let currentPeer = self.currentPeer {
|
||||||
title = currentPeer.displayTitle(strings: strings, displayOrder: self.nameDisplayOrder)
|
title = currentPeer.displayTitle(strings: strings, displayOrder: self.nameDisplayOrder)
|
||||||
@ -277,18 +281,58 @@ public class CallStatusBarNodeImpl: CallStatusBarNode {
|
|||||||
} else if let content = self.currentContent, case .groupCall = content {
|
} else if let content = self.currentContent, case .groupCall = content {
|
||||||
membersCount = 1
|
membersCount = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if let membersCount = membersCount {
|
if let membersCount = membersCount {
|
||||||
subtitle = strings.VoiceChat_Panel_Members(membersCount)
|
var membersPart = strings.VoiceChat_Status_Members(membersCount)
|
||||||
|
if let startIndex = membersPart.firstIndex(of: "["), let endIndex = membersPart.firstIndex(of: "]") {
|
||||||
|
membersPart.removeSubrange(startIndex ... endIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
let rawTextAndRanges = strings.VoiceChat_Status_MembersFormat("\(membersCount)", membersPart)
|
||||||
|
|
||||||
|
let (rawText, ranges) = rawTextAndRanges
|
||||||
|
var textIndex = 0
|
||||||
|
var latestIndex = 0
|
||||||
|
for (index, range) in ranges {
|
||||||
|
var lowerSegmentIndex = range.lowerBound
|
||||||
|
if index != 0 {
|
||||||
|
lowerSegmentIndex = min(lowerSegmentIndex, latestIndex)
|
||||||
|
} else {
|
||||||
|
if latestIndex < range.lowerBound {
|
||||||
|
let part = String(rawText[rawText.index(rawText.startIndex, offsetBy: latestIndex) ..< rawText.index(rawText.startIndex, offsetBy: range.lowerBound)])
|
||||||
|
segments.append(.text(textIndex, NSAttributedString(string: part, font: textFont, textColor: textColor)))
|
||||||
|
textIndex += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
latestIndex = range.upperBound
|
||||||
|
|
||||||
|
let part = String(rawText[rawText.index(rawText.startIndex, offsetBy: lowerSegmentIndex) ..< rawText.index(rawText.startIndex, offsetBy: range.upperBound)])
|
||||||
|
if index == 0 {
|
||||||
|
segments.append(.number(Int(membersCount), NSAttributedString(string: part, font: textFont, textColor: textColor)))
|
||||||
|
} else {
|
||||||
|
segments.append(.text(textIndex, NSAttributedString(string: part, font: textFont, textColor: textColor)))
|
||||||
|
textIndex += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if latestIndex < rawText.count {
|
||||||
|
let part = String(rawText[rawText.index(rawText.startIndex, offsetBy: latestIndex)...])
|
||||||
|
segments.append(.text(textIndex, NSAttributedString(string: part, font: textFont, textColor: textColor)))
|
||||||
|
textIndex += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(13.0), textColor: .white)
|
|
||||||
self.subtitleNode.attributedText = NSAttributedString(string: subtitle, font: Font.regular(13.0), textColor: .white)
|
|
||||||
|
|
||||||
|
if self.subtitleNode.segments != segments {
|
||||||
|
self.subtitleNode.segments = segments
|
||||||
|
}
|
||||||
|
|
||||||
|
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.semibold(13.0), textColor: .white)
|
||||||
|
|
||||||
let animationSize: CGFloat = 25.0
|
let animationSize: CGFloat = 25.0
|
||||||
let iconSpacing: CGFloat = 0.0
|
let iconSpacing: CGFloat = 0.0
|
||||||
let spacing: CGFloat = 5.0
|
let spacing: CGFloat = 5.0
|
||||||
let titleSize = self.titleNode.updateLayout(CGSize(width: 160.0, height: size.height))
|
let titleSize = self.titleNode.updateLayout(CGSize(width: 160.0, height: size.height))
|
||||||
let subtitleSize = self.subtitleNode.updateLayout(CGSize(width: 160.0, height: size.height))
|
let subtitleSize = self.subtitleNode.updateLayout(size: CGSize(width: 160.0, height: size.height), animated: true)
|
||||||
|
|
||||||
let totalWidth = animationSize + iconSpacing + titleSize.width + spacing + subtitleSize.width
|
let totalWidth = animationSize + iconSpacing + titleSize.width + spacing + subtitleSize.width
|
||||||
let horizontalOrigin: CGFloat = floor((size.width - totalWidth) / 2.0)
|
let horizontalOrigin: CGFloat = floor((size.width - totalWidth) / 2.0)
|
||||||
|
@ -1054,6 +1054,9 @@ public final class VoiceChatController: ViewController {
|
|||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
super.didLoad()
|
super.didLoad()
|
||||||
|
|
||||||
|
self.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||||
|
self.view.disablesInteractiveModalDismiss = true
|
||||||
|
|
||||||
self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture(_:))))
|
self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture(_:))))
|
||||||
|
|
||||||
let longTapRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.actionButtonPressGesture(_:)))
|
let longTapRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.actionButtonPressGesture(_:)))
|
||||||
@ -1065,17 +1068,6 @@ public final class VoiceChatController: ViewController {
|
|||||||
panRecognizer.delegate = self
|
panRecognizer.delegate = self
|
||||||
panRecognizer.delaysTouchesBegan = false
|
panRecognizer.delaysTouchesBegan = false
|
||||||
panRecognizer.cancelsTouchesInView = true
|
panRecognizer.cancelsTouchesInView = true
|
||||||
// panRecognizer.shouldBegin = { [weak self] point in
|
|
||||||
// guard let strongSelf = self else {
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
// if strongSelf.topPanelNode.bounds.contains(strongSelf.view.convert(point, to: strongSelf.topPanelNode.view)) {
|
|
||||||
// if strongSelf.topPanelNode.frame.maxY <= strongSelf.listNode.frame.minY {
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
self.view.addGestureRecognizer(panRecognizer)
|
self.view.addGestureRecognizer(panRecognizer)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,14 +1121,13 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
self.updateMembers(muteState: self.effectiveMuteState, callMembers: self.currentCallMembers ?? [], invitedPeers: self.currentInvitedPeers ?? [], speakingPeers: self.currentSpeakingPeers ?? Set())
|
self.updateMembers(muteState: self.effectiveMuteState, callMembers: self.currentCallMembers ?? [], invitedPeers: self.currentInvitedPeers ?? [], speakingPeers: self.currentSpeakingPeers ?? Set())
|
||||||
case .ended, .cancelled:
|
case .ended, .cancelled:
|
||||||
self.hapticFeedback.impact(.light)
|
|
||||||
|
|
||||||
self.pushingToTalk = false
|
self.pushingToTalk = false
|
||||||
self.actionButton.pressing = false
|
self.actionButton.pressing = false
|
||||||
let timestamp = CACurrentMediaTime()
|
let timestamp = CACurrentMediaTime()
|
||||||
if timestamp - self.actionButtonPressGestureStartTime < 0.2 {
|
if timestamp - self.actionButtonPressGestureStartTime < 0.2 {
|
||||||
self.call.toggleIsMuted()
|
self.call.toggleIsMuted()
|
||||||
} else {
|
} else {
|
||||||
|
self.hapticFeedback.impact(.light)
|
||||||
self.call.setIsMuted(action: .muted(isPushToTalkActive: false))
|
self.call.setIsMuted(action: .muted(isPushToTalkActive: false))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,8 +1340,6 @@ public final class VoiceChatController: ViewController {
|
|||||||
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
||||||
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: listSize, insets: insets, duration: duration, curve: curve)
|
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: listSize, insets: insets, duration: duration, curve: curve)
|
||||||
|
|
||||||
// let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: listFrame.size, insets: UIEdgeInsets(top: -1.0, left: -6.0, bottom: -1.0, right: -6.0), scrollIndicatorInsets: UIEdgeInsets(top: 10.0, left: 0.0, bottom: 10.0, right: 0.0), duration: duration, curve: curve)
|
|
||||||
|
|
||||||
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous, .LowLatency], scrollToItem: nil, updateSizeAndInsets: updateSizeAndInsets, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous, .LowLatency], scrollToItem: nil, updateSizeAndInsets: updateSizeAndInsets, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||||
|
|
||||||
transition.updateFrame(node: self.topCornersNode, frame: CGRect(origin: CGPoint(x: sideInset, y: 63.0), size: CGSize(width: layout.size.width - sideInset * 2.0, height: 50.0)))
|
transition.updateFrame(node: self.topCornersNode, frame: CGRect(origin: CGPoint(x: sideInset, y: 63.0), size: CGSize(width: layout.size.width - sideInset * 2.0, height: 50.0)))
|
||||||
@ -1478,21 +1467,30 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func animateIn() {
|
func animateIn() {
|
||||||
self.layer.animateBoundsOriginYAdditive(from: -self.bounds.size.height, to: 0.0, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring)
|
guard let (layout, _) = self.validLayout else {
|
||||||
self.dimNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
return
|
||||||
self.dimNode.layer.animatePosition(from: CGPoint(x: 0.0, y: -self.bounds.size.height), to: CGPoint(), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: true, additive: true)
|
}
|
||||||
|
let transition = ContainedViewLayoutTransition.animated(duration: 0.4, curve: .spring)
|
||||||
|
|
||||||
|
let topPanelFrame = self.topPanelNode.view.convert(self.topPanelNode.bounds, to: self.view)
|
||||||
|
|
||||||
|
let initialBounds = self.contentContainer.bounds
|
||||||
|
self.contentContainer.bounds = initialBounds.offsetBy(dx: 0.0, dy: -(layout.size.height - topPanelFrame.minY))
|
||||||
|
transition.animateView {
|
||||||
|
self.contentContainer.view.bounds = initialBounds
|
||||||
|
}
|
||||||
|
self.dimNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func animateOut(completion: (() -> Void)?) {
|
func animateOut(completion: (() -> Void)?) {
|
||||||
var dimCompleted = false
|
|
||||||
var offsetCompleted = false
|
var offsetCompleted = false
|
||||||
let internalCompletion: () -> Void = { [weak self] in
|
let internalCompletion: () -> Void = { [weak self] in
|
||||||
if dimCompleted && offsetCompleted {
|
if offsetCompleted {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.layer.removeAllAnimations()
|
strongSelf.contentContainer.layer.removeAllAnimations()
|
||||||
strongSelf.dimNode.layer.removeAllAnimations()
|
strongSelf.dimNode.layer.removeAllAnimations()
|
||||||
|
|
||||||
var bounds = strongSelf.bounds
|
var bounds = strongSelf.contentContainer.bounds
|
||||||
bounds.origin.y = 0.0
|
bounds.origin.y = 0.0
|
||||||
strongSelf.contentContainer.bounds = bounds
|
strongSelf.contentContainer.bounds = bounds
|
||||||
}
|
}
|
||||||
@ -1500,15 +1498,11 @@ public final class VoiceChatController: ViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.layer.animateBoundsOriginYAdditive(from: self.bounds.origin.y, to: -self.bounds.size.height, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in
|
self.contentContainer.layer.animateBoundsOriginYAdditive(from: self.contentContainer.bounds.origin.y, to: -self.contentContainer.bounds.size.height, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in
|
||||||
offsetCompleted = true
|
offsetCompleted = true
|
||||||
internalCompletion()
|
internalCompletion()
|
||||||
})
|
})
|
||||||
self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
self.dimNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||||
self.dimNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -self.bounds.size.height), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true, completion: { _ in
|
|
||||||
dimCompleted = true
|
|
||||||
internalCompletion()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func enqueueTransition(_ transition: ListTransition) {
|
private func enqueueTransition(_ transition: ListTransition) {
|
||||||
@ -1678,8 +1672,8 @@ public final class VoiceChatController: ViewController {
|
|||||||
if (bounds.minY < -60.0 || velocity.y > 300.0) {
|
if (bounds.minY < -60.0 || velocity.y > 300.0) {
|
||||||
self.controller?.dismiss()
|
self.controller?.dismiss()
|
||||||
} else {
|
} else {
|
||||||
let previousBounds = self.bounds
|
var bounds = self.contentContainer.bounds
|
||||||
var bounds = self.bounds
|
let previousBounds = bounds
|
||||||
bounds.origin.y = 0.0
|
bounds.origin.y = 0.0
|
||||||
self.contentContainer.bounds = bounds
|
self.contentContainer.bounds = bounds
|
||||||
self.contentContainer.layer.animateBounds(from: previousBounds, to: self.contentContainer.bounds, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue)
|
self.contentContainer.layer.animateBounds(from: previousBounds, to: self.contentContainer.bounds, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue)
|
||||||
@ -1698,7 +1692,11 @@ public final class VoiceChatController: ViewController {
|
|||||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||||
let result = super.hitTest(point, with: event)
|
let result = super.hitTest(point, with: event)
|
||||||
|
|
||||||
if result === self.topPanelNode.view || result === self.bottomPanelNode.view {
|
if result === self.topPanelNode.view {
|
||||||
|
return self.listNode.view
|
||||||
|
}
|
||||||
|
|
||||||
|
if result === self.bottomPanelNode.view {
|
||||||
return self.view
|
return self.view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user