mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -128,14 +128,21 @@ public final class LottieAnimationComponent: Component {
|
||||
}
|
||||
|
||||
public func playOnce() {
|
||||
guard let animationView = self.animationView else {
|
||||
guard let animationView = self.animationView, let component = self.component else {
|
||||
return
|
||||
}
|
||||
|
||||
animationView.stop()
|
||||
animationView.loopMode = .playOnce
|
||||
animationView.play { [weak self] _ in
|
||||
self?.currentCompletion?()
|
||||
|
||||
if let range = component.animation.range {
|
||||
animationView.play(fromProgress: range.0, toProgress: range.1, completion: { [weak self] _ in
|
||||
self?.currentCompletion?()
|
||||
})
|
||||
} else {
|
||||
animationView.play { [weak self] _ in
|
||||
self?.currentCompletion?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user