mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix undo timer animation
This commit is contained in:
parent
91c2d46777
commit
9f7186fac9
@ -120,7 +120,7 @@ private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: Presentat
|
||||
24 * 60 * 60,
|
||||
24 * 60 * 60 * 7
|
||||
]
|
||||
if isDebug || true {
|
||||
if isDebug {
|
||||
availableValues[1] = 5
|
||||
availableValues[2] = 5 * 60
|
||||
}
|
||||
|
@ -646,6 +646,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
}
|
||||
|
||||
private func checkTimer() {
|
||||
let previousRemainingSeconds = Int(self.remainingSeconds)
|
||||
if self.timer != nil {
|
||||
self.remainingSeconds -= 0.5
|
||||
}
|
||||
@ -653,6 +654,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
let _ = self.action(.commit)
|
||||
self.dismiss()
|
||||
} else {
|
||||
if Int(self.remainingSeconds) != previousRemainingSeconds || (self.timerTextNode.attributedText?.string ?? "").isEmpty {
|
||||
if !self.timerTextNode.bounds.size.width.isZero, let snapshot = self.timerTextNode.view.snapshotContentTree() {
|
||||
self.panelNode.view.insertSubview(snapshot, aboveSubview: self.timerTextNode.view)
|
||||
snapshot.frame = self.timerTextNode.frame
|
||||
@ -667,6 +669,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
if let validLayout = self.validLayout {
|
||||
self.containerLayoutUpdated(layout: validLayout, transition: .immediate)
|
||||
}
|
||||
}
|
||||
let timer = SwiftSignalKit.Timer(timeout: 0.5, repeat: false, completion: { [weak self] in
|
||||
self?.checkTimer()
|
||||
}, queue: .mainQueue())
|
||||
|
Loading…
x
Reference in New Issue
Block a user