Merge branch 'feature/unlock_s7_server_query_params' into 'develop'
add toggle for server s7 params See merge request BPHV_MIPS/mvm_core_ui!260
This commit is contained in:
commit
3fc476a576
@ -273,7 +273,9 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - load functions
|
||||
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) {
|
||||
public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, completionHandler: MVMCoreGetImageBlock? = nil) {
|
||||
|
||||
let completionBlock = completionHandler ?? defaultCompletionBlock()
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in
|
||||
self.currentImageName = imageName
|
||||
self.currentImageWidth = width?.cgfloat()
|
||||
@ -295,15 +297,15 @@ import UIKit
|
||||
if layoutWillChange {
|
||||
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!)
|
||||
}
|
||||
completionHandler(image,data,isFallbackImage)
|
||||
completionBlock(image,data,isFallbackImage)
|
||||
})}
|
||||
|
||||
let fallbackImageName = customFallbackImage ?? MVMCoreUIUtility.localizedImageName("fallback")
|
||||
if let format = format, format.lowercased().contains("gif") {
|
||||
// Gifs aren't supported by default and need special handling
|
||||
MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock)
|
||||
MVMCoreCache.shared()?.getGif(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock)
|
||||
} else {
|
||||
MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, completionHandler: finishedLoadingBlock)
|
||||
MVMCoreCache.shared()?.getImage(imageName, useWidth: width != nil, widthForS7: width?.intValue ?? 0, useHeight: height != nil, heightForS7: height?.intValue ?? 0, format: format, localFallbackImageName: fallbackImageName, allowServerQueryParameters: allowServerParameters, completionHandler: finishedLoadingBlock)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -333,6 +335,8 @@ import UIKit
|
||||
})
|
||||
}
|
||||
|
||||
// Note: Exposed for objective-c interfaces.
|
||||
|
||||
public func loadImage(withName imageName: String?) {
|
||||
loadImage(withName: imageName, format: nil, width: nil, height: nil, customFallbackImage: nil, completionHandler: defaultCompletionBlock())
|
||||
}
|
||||
@ -368,4 +372,8 @@ import UIKit
|
||||
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?) {
|
||||
loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, completionHandler: defaultCompletionBlock())
|
||||
}
|
||||
|
||||
public func loadImage(withName imageName: String?, format: String?, width: NSNumber?, height: NSNumber?, customFallbackImage: String?, completionHandler: @escaping MVMCoreGetImageBlock) {
|
||||
loadImage(withName: imageName, format: format, width: width, height: height, customFallbackImage: customFallbackImage, allowServerParameters: false, completionHandler: completionHandler)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user