Fixes to allow bundle improvements
This commit is contained in:
parent
a845c37f17
commit
50d1d1a13a
@ -18,8 +18,20 @@ import Foundation
|
||||
public var width: CGFloat?
|
||||
public var height: CGFloat?
|
||||
public var contentMode: UIView.ContentMode?
|
||||
|
||||
public var localBundle: Bundle?
|
||||
|
||||
public init(image: String) {
|
||||
self.image = image
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case backgroundColor
|
||||
case image
|
||||
case accessibilityText
|
||||
case fallbackImage
|
||||
case imageFormat
|
||||
case width
|
||||
case height
|
||||
case contentMode
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ import UIKit
|
||||
if shouldLoadImage(withName: imageModel.image, width: width, height: height) {
|
||||
imageView.image = nil
|
||||
imageView.animatedImage = nil
|
||||
loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage)
|
||||
loadImage(withName: imageModel.image, format: imageModel.imageFormat, width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: imageModel.fallbackImage, localBundle: imageModel.localBundle)
|
||||
}
|
||||
|
||||
if let contentMode = imageModel.contentMode {
|
||||
@ -276,7 +276,7 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - load functions
|
||||
public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, completionHandler: MVMCoreGetImageBlock? = nil) {
|
||||
public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, localBundle: Bundle? = nil, completionHandler: MVMCoreGetImageBlock? = nil) {
|
||||
|
||||
let completionBlock = completionHandler ?? defaultCompletionBlock()
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [unowned self] in
|
||||
@ -308,7 +308,7 @@ import UIKit
|
||||
// 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, 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, allowServerQueryParameters: allowServerParameters, 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, localBundle: localBundle, completionHandler: finishedLoadingBlock)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ import Foundation
|
||||
let leftLabel = StackItemModel()
|
||||
leftLabel.horizontalAlignment = .leading
|
||||
let rightImage = StackItemModel()
|
||||
rightImage.horizontalAlignment = .trailing
|
||||
rightImage.horizontalAlignment = .fill
|
||||
let stackModel = StackModel(molecules: [leftLabel,rightImage])
|
||||
stackModel.axis = .horizontal
|
||||
stack.model = stackModel
|
||||
|
||||
@ -21,8 +21,11 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco
|
||||
}
|
||||
|
||||
static func createPayPalImage() -> ImageViewModel {
|
||||
let image = ImageViewModel(image: "imagename_paypal")
|
||||
image.width = 30.0
|
||||
let image = ImageViewModel(image: "imageName_PayPal_logo")
|
||||
image.localBundle = MVMCoreUIUtility.bundleForMVMCoreUI()
|
||||
image.width = 70.0
|
||||
image.height = 18.0
|
||||
image.contentMode = .scaleAspectFit
|
||||
return image
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user