mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Add animation plist key
This commit is contained in:
@@ -1793,6 +1793,8 @@ plist_fragment(
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
""".format(
|
||||
telegram_bundle_id = telegram_bundle_id,
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@ import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import UIKitRuntimeUtils
|
||||
import ObjCRuntimeUtils
|
||||
|
||||
private let infiniteScrollSize: CGFloat = 10000.0
|
||||
private let insertionAnimationDuration: Double = 0.4
|
||||
@@ -822,12 +823,28 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
||||
}
|
||||
|
||||
private var generalAccumulatedDeltaY: CGFloat = 0.0
|
||||
private var previousDidScrollTimestamp: Double = 0.0
|
||||
|
||||
private func updateScrollViewDidScroll(_ scrollView: UIScrollView, synchronous: Bool) {
|
||||
if self.ignoreScrollingEvents || scroller !== self.scroller {
|
||||
return
|
||||
}
|
||||
|
||||
/*let timestamp = CACurrentMediaTime()
|
||||
if !self.previousDidScrollTimestamp.isZero {
|
||||
let delta = timestamp - self.previousDidScrollTimestamp
|
||||
if delta < 0.1 {
|
||||
print("Scrolling delta: \(delta)")
|
||||
}
|
||||
}
|
||||
self.previousDidScrollTimestamp = timestamp
|
||||
|
||||
if let displayLink = self.scroller.getIvarValue("_scrollHeartbeat") as? CADisplayLink {
|
||||
if #available(iOS 10.0, *) {
|
||||
displayLink.preferredFramesPerSecond = 120
|
||||
}
|
||||
}*/
|
||||
|
||||
//CATransaction.begin()
|
||||
//CATransaction.setDisableActions(true)
|
||||
|
||||
@@ -854,7 +871,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
||||
self.trackingOffset += -deltaY
|
||||
}
|
||||
|
||||
self.enqueueUpdateVisibleItems(synchronous: synchronous)
|
||||
self.enqueueUpdateVisibleItems(synchronous: true)
|
||||
|
||||
var useScrollDynamics = false
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ typedef enum {
|
||||
- (id _Nullable)associatedObjectForKey:(void const * _Nonnull)key;
|
||||
- (bool)checkObjectIsKindOfClass:(Class _Nonnull)targetClass;
|
||||
- (void)setClass:(Class _Nonnull)newClass;
|
||||
+ (NSArray<NSString *> * _Nonnull)getIvarList:(Class _Nonnull)classValue;
|
||||
- (id _Nullable)getIvarValue:(NSString * _Nonnull)name;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -98,27 +98,34 @@
|
||||
object_setClass(self, newClass);
|
||||
}
|
||||
|
||||
static Class freedomMakeClass(Class superclass, Class subclass, SEL *copySelectors, int copySelectorsCount)
|
||||
{
|
||||
if (superclass == Nil || subclass == Nil)
|
||||
+ (NSArray<NSString *> * _Nonnull)getIvarList:(Class _Nonnull)classValue {
|
||||
NSMutableArray<NSString *> *result = [[NSMutableArray alloc] init];
|
||||
|
||||
unsigned int varCount;
|
||||
|
||||
Ivar *vars = class_copyIvarList(classValue, &varCount);
|
||||
|
||||
for (int i = 0; i < varCount; i++) {
|
||||
Ivar var = vars[i];
|
||||
|
||||
const char* name = ivar_getName(var);
|
||||
const char* typeEncoding = ivar_getTypeEncoding(var);
|
||||
|
||||
[result addObject:[NSString stringWithFormat:@"%s: %s", name, typeEncoding]];
|
||||
}
|
||||
|
||||
free(vars);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id _Nullable)getIvarValue:(NSString * _Nonnull)name {
|
||||
Ivar ivar = class_getInstanceVariable([self class], [name UTF8String]);
|
||||
if (!ivar){
|
||||
return nil;
|
||||
|
||||
Class decoratedClass = objc_allocateClassPair(superclass, [[NSString alloc] initWithFormat:@"%@_%@", NSStringFromClass(superclass), NSStringFromClass(subclass)].UTF8String, 0);
|
||||
|
||||
unsigned int count = 0;
|
||||
Method *methodList = class_copyMethodList(subclass, &count);
|
||||
if (methodList != NULL) {
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
SEL methodName = method_getName(methodList[i]);
|
||||
class_addMethod(decoratedClass, methodName, method_getImplementation(methodList[i]), method_getTypeEncoding(methodList[i]));
|
||||
}
|
||||
|
||||
free(methodList);
|
||||
}
|
||||
|
||||
objc_registerClassPair(decoratedClass);
|
||||
|
||||
return decoratedClass;
|
||||
id value = object_getIvar(self, ivar);
|
||||
return value;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -20,8 +20,8 @@ public struct ChatTheme: PostboxCoding, Equatable {
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.emoji = decoder.decodeStringForKey("e", orElse: "")
|
||||
self.theme = decoder.decodeObjectForKey("t") as! TelegramTheme
|
||||
self.darkTheme = decoder.decodeObjectForKey("dt") as! TelegramTheme
|
||||
self.theme = decoder.decodeObjectForKey("t", decoder: { TelegramTheme(decoder: $0) }) as! TelegramTheme
|
||||
self.darkTheme = decoder.decodeObjectForKey("dt", decoder: { TelegramTheme(decoder: $0) }) as! TelegramTheme
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
|
||||
@@ -1067,6 +1067,8 @@ final class PeerInfoVisualMediaPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScro
|
||||
self.updateHeaderFlashing(animated: true)
|
||||
}
|
||||
|
||||
private var previousDidScrollTimestamp: Double = 0.0
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let (size, sideInset, bottomInset, visibleHeight, _, _, presentationData) = self.currentParams {
|
||||
self.updateVisibleItems(size: size, sideInset: sideInset, bottomInset: bottomInset, visibleHeight: visibleHeight, theme: presentationData.theme, strings: presentationData.strings, synchronousLoad: false)
|
||||
|
||||
Reference in New Issue
Block a user