Merge branch 'feature/remove_freebee' into 'develop'
remove freebee See merge request BPHV_MIPS/mvm_core_ui!580
This commit is contained in:
commit
dc3a2c87ab
@ -8,20 +8,24 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
enum MFTransparentGIFViewError: Error {
|
||||
case gifNotFoundError
|
||||
}
|
||||
|
||||
@objcMembers public class MFTransparentGIFView: FLAnimatedImageView {
|
||||
var imageData: Data?
|
||||
|
||||
/** Creates the GIF display view with the passed in frame.
|
||||
frame: frame to set the view to.
|
||||
ImageName: name of the .gif to load. Should not contain the extension.
|
||||
ImageName: name of the .gif to load. Should not contain the extension. Local images only.
|
||||
StartImmediately: should the gif immeidately begin playing. If YES, it will start. If NO, call [performAnimations] to start it.
|
||||
Duration: how long the animation takes to loop. Pass a negative value to use the default.
|
||||
LoopCompletionBlock: a block called whenever the gif finishes a loop.
|
||||
animatedImage : set as nil when use this view in reusable cell
|
||||
*/
|
||||
public init(withFrame frame: CGRect, imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) {
|
||||
public init(withFrame frame: CGRect, imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) throws {
|
||||
super.init(frame: frame)
|
||||
loadImage(imageName, startImmediately: startImmediately, duration: duration, loopCompletionBlock: loopCompletionBlock)
|
||||
try loadImage(imageName, startImmediately: startImmediately, duration: duration, loopCompletionBlock: loopCompletionBlock)
|
||||
}
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
@ -32,7 +36,7 @@ import UIKit
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
public func loadImage(_ imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) {
|
||||
public func loadImage(_ imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) throws {
|
||||
contentMode = UIView.ContentMode.scaleAspectFill
|
||||
clipsToBounds = true
|
||||
|
||||
@ -42,13 +46,10 @@ import UIKit
|
||||
self.loopCompletionBlock = loopCompletionBlock
|
||||
backgroundColor = .clear
|
||||
|
||||
var url: URL?
|
||||
if imageName.contains("http") {
|
||||
url = URL(string: imageName)
|
||||
} else {
|
||||
url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif")
|
||||
guard let url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif") else {
|
||||
throw MFTransparentGIFViewError.gifNotFoundError
|
||||
}
|
||||
imageData = MFFreebeeHandler.shared()?.freebee_data(withContentsOf: url)
|
||||
imageData = try Data(contentsOf: url)
|
||||
|
||||
runLoopMode = RunLoop.Mode.common.rawValue
|
||||
if startImmediately {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user