mirror of
https://github.com/signalapp/Signal-iOS.git
synced 2025-12-07 01:21:08 +00:00
22 lines
581 B
Swift
22 lines
581 B
Swift
//
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import Foundation
|
|
public import SDWebImage
|
|
|
|
public extension SDAnimatedImage {
|
|
|
|
/// SDAnimatedImageView's duration sometimes returns 0 duration even when this extended method works.
|
|
var animationDuration: TimeInterval? {
|
|
let frameCount = self.animatedImageFrameCount
|
|
guard frameCount > 0 else {
|
|
return nil
|
|
}
|
|
return (0..<frameCount).reduce(0, { sum, frame in
|
|
return sum + self.animatedImageDuration(at: frame)
|
|
})
|
|
}
|
|
}
|