From b71c6e0e5c2f0935910f3a23d1a43031e9dd23fd Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 2 Sep 2020 13:04:47 -0400 Subject: [PATCH 1/7] valid --- .../Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift index dd2a3c62..d64f70ae 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/EntryFieldModel.swift @@ -34,7 +34,7 @@ import Foundation public var baseValue: AnyHashable? public var wasInitiallySelected: Bool = false - public var isValid: Bool? { + public var isValid: Bool? = true { didSet { updateUI?() } } From b18f7d1aaf53cda0e57986024bde7a459758efb6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 4 Sep 2020 17:04:12 -0400 Subject: [PATCH 2/7] remove freebee --- MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift b/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift index 0c220de5..df748d85 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift @@ -48,7 +48,9 @@ import UIKit } else { url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif") } - imageData = MFFreebeeHandler.shared()?.freebee_data(withContentsOf: url) + if let url = url { + imageData = try? Data(contentsOf: url) + } runLoopMode = RunLoop.Mode.common.rawValue if startImmediately { From acfc1e2b512886e3eb9ed953b14004b637a1cd92 Mon Sep 17 00:00:00 2001 From: "Chintakrinda, Arun Kumar (Arun)" Date: Tue, 8 Sep 2020 12:50:21 +0530 Subject: [PATCH 3/7] Modification to add overlay to image --- .../Atomic/Molecules/OtherContainers/BGImageMolecule.swift | 2 +- .../Molecules/OtherContainers/BGImageMoleculeModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMolecule.swift b/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMolecule.swift index 1c39975e..4aa811a1 100644 --- a/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMolecule.swift +++ b/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMolecule.swift @@ -10,7 +10,7 @@ import Foundation open class BGImageMolecule: MoleculeContainer { - let image = LoadImageView(pinnedEdges: .all) + public let image = LoadImageView(pinnedEdges: .all) open override func setupView() { super.setupView() diff --git a/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMoleculeModel.swift b/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMoleculeModel.swift index 83b5931d..2dbfced5 100644 --- a/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMoleculeModel.swift +++ b/MVMCoreUI/Atomic/Molecules/OtherContainers/BGImageMoleculeModel.swift @@ -9,7 +9,7 @@ import Foundation open class BGImageMoleculeModel: MoleculeContainerModel { - public override class var identifier: String { + open override class var identifier: String { return "bgImageContainer" } public var image: ImageViewModel @@ -44,7 +44,7 @@ open class BGImageMoleculeModel: MoleculeContainerModel { try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + open override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(image, forKey: .image) From 07d41e57c49f4c4141a252eef857888250349f1d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 8 Sep 2020 18:00:22 -0400 Subject: [PATCH 4/7] review changes --- .../Atoms/Views/MFTransparentGIFView.swift | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift b/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift index df748d85..7dd9e15f 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift @@ -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,15 +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") - } - if let url = url { - imageData = try? Data(contentsOf: url) + guard let url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif") else { + throw MFTransparentGIFViewError.gifNotFoundError } + imageData = try Data(contentsOf: url) runLoopMode = RunLoop.Mode.common.rawValue if startImmediately { From 2adf3b7c4fbd4f55f93650e4d59acb921fd39eac Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 9 Sep 2020 16:03:12 -0400 Subject: [PATCH 5/7] for molecularly clipping image --- MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift | 2 ++ MVMCoreUI/Atomic/Atoms/Views/LoadImageView.swift | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift index 57a82052..6cf019ca 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift @@ -21,6 +21,7 @@ import Foundation public var contentMode: UIView.ContentMode? public var localBundle: Bundle? public var cornerRadius: CGFloat? + public var clipsImage: Bool? public init(image: String, imageFormat: String? = nil, width: CGFloat? = nil, height: CGFloat? = nil) { self.image = image @@ -40,5 +41,6 @@ import Foundation case height case contentMode case cornerRadius + case clipsImage } } diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadImageView.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadImageView.swift index 532056cb..42267a20 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadImageView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadImageView.swift @@ -254,6 +254,10 @@ import UIKit clipsToBounds = true layer.cornerRadius = cornerRadius } + + if let clipsImage = imageModel.clipsImage { + clipsToBounds = clipsImage + } } // MARK: - load functions From 91b037fa427c9267e0a4eba31c77c47b76106886 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 10 Sep 2020 15:49:10 -0400 Subject: [PATCH 6/7] getting the accordion accessory to work --- .../Items/AccordionListItemModel.swift | 19 ++++++++++++++- .../AccordionMoleculeTableViewCell.swift | 23 ++++++++++++++----- MVMCoreUI/BaseClasses/TableViewCell.swift | 9 +++++++- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift index ac299a8b..cd2c12aa 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift @@ -9,12 +9,21 @@ import UIKit class AccordionListItemModel: MoleculeListItemModel { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + override public class var identifier: String { return "accordionListItem" - } + } + public var molecules: [ListItemModelProtocol & MoleculeModelProtocol] public var hideLineWhenExpanded: Bool = false + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case moleculeName case molecules @@ -22,11 +31,19 @@ class AccordionListItemModel: MoleculeListItemModel { case hideLineWhenExpanded } + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + public override func setDefaults() { super.setDefaults() hideArrow = true } + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) molecules = try typeContainer.decodeModels(codingKey: .molecules) diff --git a/MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift index f6e6dd6f..8488703d 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift @@ -8,20 +8,29 @@ import UIKit + @objcMembers public class AccordionMoleculeTableViewCell: MoleculeTableViewCell { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + var accordionListItemModel: AccordionListItemModel? { return listItemModel as? AccordionListItemModel } - let accordionButton = createAccordionButton() - static func createAccordionButton() -> Button { + let accordionButton: Button = { let accordionButton = Button(type: .custom) accordionButton.setTitle("+", for: .normal) accordionButton.setTitleColor(.black, for: .normal) accordionButton.titleLabel?.font = UIFont.systemFont(ofSize: 40, weight: .ultraLight) accordionButton.frame = CGRect(x: 0, y: 0, width: 20, height: 20) + accordionButton.translatesAutoresizingMaskIntoConstraints = true return accordionButton - } + }() + + //-------------------------------------------------- + // MARK: - Setup + //-------------------------------------------------- override public func setupView() { customAccessoryView = true @@ -29,11 +38,13 @@ import UIKit accessoryView = accordionButton } - override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { - accordionButton.isSelected = !accordionButton.isSelected + override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { + + accordionButton.isSelected.toggle() accordionButton.setTitle(accordionButton.isSelected ? "-" : "+", for: .normal) + guard let model = accordionListItemModel else { return } - + if accordionButton.isSelected { if let indexPath = delegateObject?.moleculeDelegate?.getIndexPath(for: model) { delegateObject?.moleculeDelegate?.addMolecules(model.molecules, indexPath: indexPath, animation: .automatic) diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index b391162e..298fa6b0 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -8,8 +8,12 @@ import UIKit -@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol { +@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + open var molecule: MoleculeViewProtocol? open var listItemModel: ListItemModelProtocol? public let containerHelper = ContainerHelper() @@ -30,7 +34,10 @@ import UIKit private var initialSetupPerformed = false + //-------------------------------------------------- // MARK: - Styling + //-------------------------------------------------- + open func styleLine(with style: ListItemStyle?) { switch style { case .standard?: From 2b4469db6312df4a7d3f20d346394a227816440c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 11 Sep 2020 10:34:38 -0400 Subject: [PATCH 7/7] missing color for enable state --- MVMCoreUI/Atomic/Atoms/Views/CaretView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift b/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift index b3081654..b9de9b3a 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift @@ -140,7 +140,7 @@ open class CaretView: View { caretPath.addLine(to: CGPoint(x: frame.size.width - inset, y: frame.size.height - inset)) } - enabledColor.setStroke() + _ = isEnabled ? enabledColor.setStroke() : disabledColor.setStroke() caretPath.stroke() } @@ -160,6 +160,7 @@ open class CaretView: View { isHidden = false backgroundColor = .clear enabledColor = .mvmBlack + disabledColor = .mvmCoolGray3 } /// Ensure you have defined a CaretSize with Orientation before calling.