mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-26 23:39:12 +00:00
no message
This commit is contained in:
parent
a9c96e7712
commit
6b542e9029
@ -33,8 +33,6 @@ static void *CATracingLayerTraceablInfoKey = &CATracingLayerTraceablInfoKey;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void traceLayerSurfaces(int depth, CALayer * _Nonnull layer, NSMutableDictionary<NSNumber *, NSMutableArray<CALayer *> *> *layersByDepth) {
|
static void traceLayerSurfaces(int depth, CALayer * _Nonnull layer, NSMutableDictionary<NSNumber *, NSMutableArray<CALayer *> *> *layersByDepth) {
|
||||||
NSMutableArray<CALayer *> *result = nil;
|
|
||||||
|
|
||||||
bool hadTraceableSublayers = false;
|
bool hadTraceableSublayers = false;
|
||||||
for (CALayer *sublayer in layer.sublayers.reverseObjectEnumerator) {
|
for (CALayer *sublayer in layer.sublayers.reverseObjectEnumerator) {
|
||||||
if ([sublayer traceableInfo] != nil) {
|
if ([sublayer traceableInfo] != nil) {
|
||||||
|
@ -18,6 +18,8 @@ public final class ContextMenuController: ViewController {
|
|||||||
|
|
||||||
private var layout: ContainerViewLayout?
|
private var layout: ContainerViewLayout?
|
||||||
|
|
||||||
|
public var dismissed: (() -> Void)?
|
||||||
|
|
||||||
public init(actions: [ContextMenuAction]) {
|
public init(actions: [ContextMenuAction]) {
|
||||||
self.actions = actions
|
self.actions = actions
|
||||||
|
|
||||||
@ -30,6 +32,7 @@ public final class ContextMenuController: ViewController {
|
|||||||
|
|
||||||
open override func loadDisplayNode() {
|
open override func loadDisplayNode() {
|
||||||
self.displayNode = ContextMenuNode(actions: self.actions, dismiss: { [weak self] in
|
self.displayNode = ContextMenuNode(actions: self.actions, dismiss: { [weak self] in
|
||||||
|
self?.dismissed?()
|
||||||
self?.contextMenuNode.animateOut { [weak self] in
|
self?.contextMenuNode.animateOut { [weak self] in
|
||||||
self?.presentingViewController?.dismiss(animated: false)
|
self?.presentingViewController?.dismiss(animated: false)
|
||||||
}
|
}
|
||||||
@ -48,6 +51,7 @@ public final class ContextMenuController: ViewController {
|
|||||||
super.containerLayoutUpdated(layout, transition: transition)
|
super.containerLayoutUpdated(layout, transition: transition)
|
||||||
|
|
||||||
if self.layout != nil && self.layout! != layout {
|
if self.layout != nil && self.layout! != layout {
|
||||||
|
self.dismissed?()
|
||||||
self.contextMenuNode.animateOut { [weak self] in
|
self.contextMenuNode.animateOut { [weak self] in
|
||||||
self?.presentingViewController?.dismiss(animated: false)
|
self?.presentingViewController?.dismiss(animated: false)
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1158,7 @@ open class ListView: ASDisplayNode, UIScrollViewDelegate, UIGestureRecognizerDel
|
|||||||
let beginReplay = { [weak self] in
|
let beginReplay = { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.replayOperations(animated: animated, animateAlpha: options.contains(.AnimateAlpha), animateTopItemVerticalOrigin: options.contains(.AnimateTopItemPosition), operations: updatedOperations, requestItemInsertionAnimationsIndices: options.contains(.RequestItemInsertionAnimations) ? insertedIndexSet : Set(), scrollToItem: scrollToItem, updateSizeAndInsets: updateSizeAndInsets, stationaryItemIndex: stationaryItemIndex, updateOpaqueState: updateOpaqueState, completion: {
|
strongSelf.replayOperations(animated: animated, animateAlpha: options.contains(.AnimateAlpha), animateTopItemVerticalOrigin: options.contains(.AnimateTopItemPosition), operations: updatedOperations, requestItemInsertionAnimationsIndices: options.contains(.RequestItemInsertionAnimations) ? insertedIndexSet : Set(), scrollToItem: scrollToItem, updateSizeAndInsets: updateSizeAndInsets, stationaryItemIndex: stationaryItemIndex, updateOpaqueState: updateOpaqueState, completion: {
|
||||||
if options.contains(.PreferSynchronousResourceLoading) {
|
if options.contains(.PreferSynchronousDrawing) {
|
||||||
let startTime = CACurrentMediaTime()
|
let startTime = CACurrentMediaTime()
|
||||||
self?.recursivelyEnsureDisplaySynchronously(true)
|
self?.recursivelyEnsureDisplaySynchronously(true)
|
||||||
let deltaTime = CACurrentMediaTime() - startTime
|
let deltaTime = CACurrentMediaTime() - startTime
|
||||||
|
@ -122,7 +122,8 @@ public struct ListViewDeleteAndInsertOptions: OptionSet {
|
|||||||
public static let Synchronous = ListViewDeleteAndInsertOptions(rawValue: 8)
|
public static let Synchronous = ListViewDeleteAndInsertOptions(rawValue: 8)
|
||||||
public static let RequestItemInsertionAnimations = ListViewDeleteAndInsertOptions(rawValue: 16)
|
public static let RequestItemInsertionAnimations = ListViewDeleteAndInsertOptions(rawValue: 16)
|
||||||
public static let AnimateTopItemPosition = ListViewDeleteAndInsertOptions(rawValue: 32)
|
public static let AnimateTopItemPosition = ListViewDeleteAndInsertOptions(rawValue: 32)
|
||||||
public static let PreferSynchronousResourceLoading = ListViewDeleteAndInsertOptions(rawValue: 64)
|
public static let PreferSynchronousDrawing = ListViewDeleteAndInsertOptions(rawValue: 64)
|
||||||
|
public static let PreferSynchronousResourceLoading = ListViewDeleteAndInsertOptions(rawValue: 128)
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ListViewUpdateSizeAndInsets {
|
public struct ListViewUpdateSizeAndInsets {
|
||||||
|
@ -234,6 +234,12 @@ open class ListViewItemNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var contentBounds: CGRect {
|
||||||
|
let bounds = self.bounds
|
||||||
|
let effectiveInsets = self.insets
|
||||||
|
return CGRect(origin: CGPoint(x: 0.0, y: bounds.origin.y + effectiveInsets.top), size: CGSize(width: bounds.size.width, height: bounds.size.height - effectiveInsets.top - effectiveInsets.bottom))
|
||||||
|
}
|
||||||
|
|
||||||
open override var position: CGPoint {
|
open override var position: CGPoint {
|
||||||
get {
|
get {
|
||||||
return self._position
|
return self._position
|
||||||
|
@ -254,6 +254,14 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func popToRoot(animated: Bool) {
|
||||||
|
var controllers = self.viewControllers
|
||||||
|
while controllers.count > 1 {
|
||||||
|
controllers.removeLast()
|
||||||
|
}
|
||||||
|
self.setViewControllers(controllers, animated: animated)
|
||||||
|
}
|
||||||
|
|
||||||
open override func popViewController(animated: Bool) -> UIViewController? {
|
open override func popViewController(animated: Bool) -> UIViewController? {
|
||||||
var controller: UIViewController?
|
var controller: UIViewController?
|
||||||
var controllers = self.viewControllers
|
var controllers = self.viewControllers
|
||||||
|
@ -2,9 +2,48 @@ import Foundation
|
|||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
|
|
||||||
open class SwitchNode: ASDisplayNode {
|
open class SwitchNode: ASDisplayNode {
|
||||||
|
public var valueUpdated: ((Bool) -> Void)?
|
||||||
|
|
||||||
|
private var _isOn: Bool = false
|
||||||
|
public var isOn: Bool {
|
||||||
|
get {
|
||||||
|
return self._isOn
|
||||||
|
} set(value) {
|
||||||
|
if (value != self._isOn) {
|
||||||
|
self._isOn = value
|
||||||
|
if self.isNodeLoaded {
|
||||||
|
(self.view as! UISwitch).setOn(value, animated: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override public init() {
|
override public init() {
|
||||||
super.init(viewBlock: {
|
super.init(viewBlock: {
|
||||||
return UISwitch()
|
return UISwitch()
|
||||||
}, didLoad: nil)
|
}, didLoad: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override open func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
|
||||||
|
(self.view as! UISwitch).setOn(self._isOn, animated: false)
|
||||||
|
|
||||||
|
(self.view as! UISwitch).addTarget(self, action: #selector(switchValueChanged(_:)), for: .valueChanged)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func setOn(_ value: Bool, animated: Bool) {
|
||||||
|
self._isOn = value
|
||||||
|
if self.isNodeLoaded {
|
||||||
|
(self.view as! UISwitch).setOn(value, animated: animated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
|
||||||
|
return CGSize(width: 51.0, height: 31.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func switchValueChanged(_ view: UISwitch) {
|
||||||
|
self.valueUpdated?(view.isOn)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,4 +118,16 @@ open class TabBarController: ViewController {
|
|||||||
currentController.containerLayoutUpdated(layout.addedInsets(insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 49.0, right: 0.0)), transition: transition)
|
currentController.containerLayoutUpdated(layout.addedInsets(insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 49.0, right: 0.0)), transition: transition)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override open func viewDidAppear(_ animated: Bool) {
|
||||||
|
if let currentController = self.currentController {
|
||||||
|
currentController.viewDidAppear(animated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override open func viewDidDisappear(_ animated: Bool) {
|
||||||
|
if let currentController = self.currentController {
|
||||||
|
currentController.viewDidDisappear(animated)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,7 @@ CABasicAnimation * _Nonnull makeSpringAnimation(NSString * _Nonnull keyPath) {
|
|||||||
springAnimation.mass = 3.0f;
|
springAnimation.mass = 3.0f;
|
||||||
springAnimation.stiffness = 1000.0f;
|
springAnimation.stiffness = 1000.0f;
|
||||||
springAnimation.damping = 500.0f;
|
springAnimation.damping = 500.0f;
|
||||||
springAnimation.initialVelocity = 0.0f;
|
springAnimation.duration = 0.5;
|
||||||
springAnimation.duration = 0.5;//springAnimation.settlingDuration;
|
|
||||||
springAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
springAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||||
return springAnimation;
|
return springAnimation;
|
||||||
}
|
}
|
||||||
@ -47,7 +46,14 @@ CABasicAnimation * _Nonnull makeSpringBounceAnimation(NSString * _Nonnull keyPat
|
|||||||
springAnimation.mass = 5.0f;
|
springAnimation.mass = 5.0f;
|
||||||
springAnimation.stiffness = 900.0f;
|
springAnimation.stiffness = 900.0f;
|
||||||
springAnimation.damping = 88.0f;
|
springAnimation.damping = 88.0f;
|
||||||
springAnimation.initialVelocity = initialVelocity;
|
static bool canSetInitialVelocity = true;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
canSetInitialVelocity = [springAnimation respondsToSelector:@selector(setInitialVelocity:)];
|
||||||
|
});
|
||||||
|
if (canSetInitialVelocity) {
|
||||||
|
springAnimation.initialVelocity = initialVelocity;
|
||||||
|
}
|
||||||
springAnimation.duration = springAnimation.settlingDuration;
|
springAnimation.duration = springAnimation.settlingDuration;
|
||||||
springAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
springAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||||
return springAnimation;
|
return springAnimation;
|
||||||
|
@ -119,6 +119,10 @@ public extension UIImage {
|
|||||||
private func makeSubtreeSnapshot(layer: CALayer) -> UIView? {
|
private func makeSubtreeSnapshot(layer: CALayer) -> UIView? {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.layer.contents = layer.contents
|
view.layer.contents = layer.contents
|
||||||
|
view.layer.contentsRect = layer.contentsRect
|
||||||
|
view.layer.contentsScale = layer.contentsScale
|
||||||
|
view.layer.contentsCenter = layer.contentsCenter
|
||||||
|
view.layer.contentsGravity = layer.contentsGravity
|
||||||
if let sublayers = layer.sublayers {
|
if let sublayers = layer.sublayers {
|
||||||
for sublayer in sublayers {
|
for sublayer in sublayers {
|
||||||
let subtree = makeSubtreeSnapshot(layer: sublayer)
|
let subtree = makeSubtreeSnapshot(layer: sublayer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user