Merge branch 'feature/remove_freebee' into 'develop'

remove freebee

See merge request BPHV_MIPS/mvm_core_ui!580
This commit is contained in:
Pfeil, Scott Robert 2020-09-09 12:25:31 -04:00
commit dc3a2c87ab

View File

@ -8,20 +8,24 @@
import UIKit import UIKit
enum MFTransparentGIFViewError: Error {
case gifNotFoundError
}
@objcMembers public class MFTransparentGIFView: FLAnimatedImageView { @objcMembers public class MFTransparentGIFView: FLAnimatedImageView {
var imageData: Data? var imageData: Data?
/** Creates the GIF display view with the passed in frame. /** Creates the GIF display view with the passed in frame.
frame: frame to set the view to. 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. 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. 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. LoopCompletionBlock: a block called whenever the gif finishes a loop.
animatedImage : set as nil when use this view in reusable cell 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) 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) { public override init(frame: CGRect) {
@ -32,7 +36,7 @@ import UIKit
super.init(coder: aDecoder) 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 contentMode = UIView.ContentMode.scaleAspectFill
clipsToBounds = true clipsToBounds = true
@ -42,13 +46,10 @@ import UIKit
self.loopCompletionBlock = loopCompletionBlock self.loopCompletionBlock = loopCompletionBlock
backgroundColor = .clear backgroundColor = .clear
var url: URL? guard let url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif") else {
if imageName.contains("http") { throw MFTransparentGIFViewError.gifNotFoundError
url = URL(string: imageName)
} else {
url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif")
} }
imageData = MFFreebeeHandler.shared()?.freebee_data(withContentsOf: url) imageData = try Data(contentsOf: url)
runLoopMode = RunLoop.Mode.common.rawValue runLoopMode = RunLoop.Mode.common.rawValue
if startImmediately { if startImmediately {