Merge branch 'feature/image_notify_control' into 'develop'
load image update control for delegate See merge request BPHV_MIPS/mvm_core_ui!438
This commit is contained in:
commit
c4fa9188b4
@ -12,6 +12,7 @@ import UIKit
|
||||
public let loadingSpinner = MFLoadingSpinner(frame: .zero)
|
||||
public let imageView = MFTransparentGIFView(frame: .zero)
|
||||
public var addSizeConstraintsForAspectRatio = false
|
||||
public var shouldNotifyDelegateOnUpdate = true
|
||||
var centerX: NSLayoutConstraint?
|
||||
var centerY: NSLayoutConstraint?
|
||||
var widthConstraint: NSLayoutConstraint?
|
||||
@ -264,16 +265,15 @@ import UIKit
|
||||
}
|
||||
|
||||
let finishedLoadingBlock: MVMCoreGetImageBlock = {[weak self] (image, data, isFallbackImage) in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||
guard let loadingImageName = self?.currentImageName, loadingImageName == imageName else {
|
||||
return
|
||||
}
|
||||
self?.isFallbackImage = isFallbackImage
|
||||
self?.loadingSpinner.pause()
|
||||
let layoutWillChange = self?.layoutWillChange(width: self?.currentImageWidth, height: self?.currentImageHeight, size: image?.size) ?? false
|
||||
self?.addConstraints(width: width, height: height, size: image?.size)
|
||||
self?.loadingSpinnerHeightConstraint?.constant = 0
|
||||
guard let self = self,
|
||||
let loadingImageName = self.currentImageName, loadingImageName == imageName else { return }
|
||||
self.isFallbackImage = isFallbackImage
|
||||
self.loadingSpinner.pause()
|
||||
let layoutWillChange = self.shouldNotifyDelegateOnUpdate ? self.layoutWillChange(width: self.currentImageWidth, height: self.currentImageHeight, size: image?.size) : false
|
||||
self.addConstraints(width: width, height: height, size: image?.size)
|
||||
self.loadingSpinnerHeightConstraint?.constant = 0
|
||||
if layoutWillChange {
|
||||
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!)
|
||||
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
|
||||
}
|
||||
completionBlock(image,data,isFallbackImage)
|
||||
})}
|
||||
|
||||
@ -43,6 +43,7 @@ import Foundation
|
||||
// MARK: - MFViewProtocol
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
rightImageView.shouldNotifyDelegateOnUpdate = false
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack.restack()
|
||||
|
||||
@ -43,6 +43,7 @@ import Foundation
|
||||
// MARK: - MFViewProtocol
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
rightImageView.shouldNotifyDelegateOnUpdate = false
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack.restack()
|
||||
|
||||
@ -46,6 +46,7 @@ import Foundation
|
||||
//-----------------------------------------------------
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
rightImage.shouldNotifyDelegateOnUpdate = false
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack.restack()
|
||||
|
||||
@ -46,6 +46,7 @@ import Foundation
|
||||
//-----------------------------------------------------
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
rightImage.shouldNotifyDelegateOnUpdate = false
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
verticalStack.restack()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user