mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
0add36f341
commit
2292e8cac8
@ -98,7 +98,7 @@ public final class StatsGraphItem: ListViewItem, ItemListItem, ListItemComponent
|
|||||||
public var selectable: Bool = false
|
public var selectable: Bool = false
|
||||||
}
|
}
|
||||||
|
|
||||||
class StatsGraphItemNode: ListViewItemNode {
|
public final class StatsGraphItemNode: ListViewItemNode {
|
||||||
private let backgroundNode: ASDisplayNode
|
private let backgroundNode: ASDisplayNode
|
||||||
private let topStripeNode: ASDisplayNode
|
private let topStripeNode: ASDisplayNode
|
||||||
private let bottomStripeNode: ASDisplayNode
|
private let bottomStripeNode: ASDisplayNode
|
||||||
@ -139,7 +139,7 @@ class StatsGraphItemNode: ListViewItemNode {
|
|||||||
self.chartContainerNode.addSubnode(self.activityIndicator)
|
self.chartContainerNode.addSubnode(self.activityIndicator)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
public override func didLoad() {
|
||||||
super.didLoad()
|
super.didLoad()
|
||||||
|
|
||||||
self.view.interactiveTransitionGestureRecognizerTest = { point -> Bool in
|
self.view.interactiveTransitionGestureRecognizerTest = { point -> Bool in
|
||||||
@ -147,7 +147,7 @@ class StatsGraphItemNode: ListViewItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetInteraction() {
|
public func resetInteraction() {
|
||||||
self.chartNode.resetInteraction()
|
self.chartNode.resetInteraction()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,15 +313,15 @@ class StatsGraphItemNode: ListViewItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func animateInsertion(_ currentTimestamp: Double, duration: Double, options: ListViewItemAnimationOptions) {
|
public override func animateInsertion(_ currentTimestamp: Double, duration: Double, options: ListViewItemAnimationOptions) {
|
||||||
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.4)
|
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.4)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func animateAdded(_ currentTimestamp: Double, duration: Double) {
|
public override func animateAdded(_ currentTimestamp: Double, duration: Double) {
|
||||||
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func animateRemoved(_ currentTimestamp: Double, duration: Double) {
|
public override func animateRemoved(_ currentTimestamp: Double, duration: Double) {
|
||||||
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false)
|
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public final class ListItemComponentAdaptor: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class View: UIView {
|
public final class View: UIView {
|
||||||
private var itemNode: ListViewItemNode?
|
public var itemNode: ListViewItemNode?
|
||||||
|
|
||||||
func update(component: ListItemComponentAdaptor, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
func update(component: ListItemComponentAdaptor, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||||
let item = component.itemImpl()
|
let item = component.itemImpl()
|
||||||
|
@ -82,6 +82,35 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
return super.contentOffset
|
return super.contentOffset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||||
|
if let _ = otherGestureRecognizer as? UIPanGestureRecognizer {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||||
|
if gestureRecognizer is UIPanGestureRecognizer, let gestureRecognizers = gestureRecognizer.view?.gestureRecognizers {
|
||||||
|
for otherGestureRecognizer in gestureRecognizers {
|
||||||
|
if otherGestureRecognizer !== gestureRecognizer, let panGestureRecognizer = otherGestureRecognizer as? UIPanGestureRecognizer, panGestureRecognizer.minimumNumberOfTouches == 2 {
|
||||||
|
return gestureRecognizer.numberOfTouches < 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let view = gestureRecognizer.view?.hitTest(gestureRecognizer.location(in: gestureRecognizer.view), with: nil) as? UIControl {
|
||||||
|
return !view.isTracking
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class View: UIView, UIScrollViewDelegate {
|
class View: UIView, UIScrollViewDelegate {
|
||||||
@ -194,6 +223,10 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.updateScrolling(transition: .immediate)
|
self.updateScrolling(transition: .immediate)
|
||||||
|
|
||||||
|
if let view = self.chartView.view as? ListItemComponentAdaptor.View, let node = view.itemNode as? StatsGraphItemNode {
|
||||||
|
node.resetInteraction()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +365,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
transition.setBounds(view: titleView, bounds: CGRect(origin: .zero, size: titleSize))
|
transition.setBounds(view: titleView, bounds: CGRect(origin: .zero, size: titleSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
if let revenueGraph = starsState?.revenueGraph {
|
if let revenueGraph = self.starsState?.revenueGraph {
|
||||||
let chartSize = self.chartView.update(
|
let chartSize = self.chartView.update(
|
||||||
transition: .immediate,
|
transition: .immediate,
|
||||||
component: AnyComponent(ListSectionComponent(
|
component: AnyComponent(ListSectionComponent(
|
||||||
@ -348,7 +381,7 @@ final class StarsStatisticsScreenComponent: Component {
|
|||||||
footer: nil,
|
footer: nil,
|
||||||
items: [
|
items: [
|
||||||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor(
|
||||||
itemGenerator: StatsGraphItem(presentationData: ItemListPresentationData(presentationData), graph: revenueGraph, type: .stars, conversionRate: starsState?.usdRate ?? 0.0, sectionId: 0, style: .blocks),
|
itemGenerator: StatsGraphItem(presentationData: ItemListPresentationData(presentationData), graph: revenueGraph, type: .stars, noInitialZoom: true, conversionRate: starsState?.usdRate ?? 0.0, sectionId: 0, style: .blocks),
|
||||||
params: ListViewItemLayoutParams(width: availableSize.width - sideInsets, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
params: ListViewItemLayoutParams(width: availableSize.width - sideInsets, leftInset: 0.0, rightInset: 0.0, availableHeight: 10000.0, isStandalone: true)
|
||||||
))),
|
))),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user