From a76fb75200040168c29226cd0c6346913f8a319a Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 20 Jan 2020 11:53:22 +0530 Subject: [PATCH 1/7] crash fix --- MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift index 130536e4..51532228 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift @@ -176,7 +176,7 @@ open class DoughnutChart: View { labelContainer.layoutIfNeeded() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth() let labelheight = labelContainer.frame.height/2 - let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(pow(radius, 2) - pow(labelheight, 2)) + let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(abs(pow(radius, 2) - pow(labelheight, 2))) labelContainerLeftConstraint?.constant = padding labelContainerRightConstraint?.constant = padding From d3c644805352a92933719b41ddd20bc1b1fcc681 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Mon, 20 Jan 2020 14:50:53 +0530 Subject: [PATCH 2/7] fix for separator --- MVMCoreUI/Models/Molecules/HeaderModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Models/Molecules/HeaderModel.swift b/MVMCoreUI/Models/Molecules/HeaderModel.swift index 4499d313..0277e9fe 100644 --- a/MVMCoreUI/Models/Molecules/HeaderModel.swift +++ b/MVMCoreUI/Models/Molecules/HeaderModel.swift @@ -44,8 +44,8 @@ import Foundation required public init(from decoder: Decoder) throws { try super.init(from: decoder) let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self) - line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) setDefaults() + line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) } public override func encode(to encoder: Encoder) throws { From 8c373ebfa41ec923fd341a8b9f4712b85ea8132f Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 16:56:30 +0530 Subject: [PATCH 3/7] index update --- .../VerticalCombinationViews/Lists/NumberedListModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift index 728ae3a8..943dfd11 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift @@ -26,7 +26,7 @@ import Foundation let list = try typeContainer.decodeMolecules(codingKey: .list) var models: [MoleculeStackItemModel] = [] for (index, molecule) in list.enumerated() { - models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index).", molecule: molecule))) + models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index+1).", molecule: molecule))) } super.init(molecules: models) spacing = 0 From 13cc6bf2090e05b45213421376c4431758e26d19 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 17:11:00 +0530 Subject: [PATCH 4/7] removed padding --- MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift index 72aceab7..e33601ad 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift @@ -26,7 +26,7 @@ import Foundation addSubview(colorLablesStack) doughnutChart.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true - doughnutChart.topAnchor.constraint(equalTo: topAnchor, constant: PaddingFour).isActive = true + doughnutChart.topAnchor.constraint(equalTo: topAnchor).isActive = true bottomAnchor.constraint(greaterThanOrEqualTo: doughnutChart.bottomAnchor).isActive = true let doughnutBottomAnchor = bottomAnchor.constraint(equalTo: doughnutChart.bottomAnchor) From fffb04e5e15380bbd4dc2ac01610dc64034f4260 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 20:31:02 +0530 Subject: [PATCH 5/7] avoid negative value --- MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift index 51532228..03d87ec9 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift @@ -176,7 +176,7 @@ open class DoughnutChart: View { labelContainer.layoutIfNeeded() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth() let labelheight = labelContainer.frame.height/2 - let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(abs(pow(radius, 2) - pow(labelheight, 2))) + let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(max(0, pow(radius, 2) - pow(labelheight, 2))) labelContainerLeftConstraint?.constant = padding labelContainerRightConstraint?.constant = padding From 4760c10c8db7d58ea05aadcb645e9080f65b1241 Mon Sep 17 00:00:00 2001 From: "Murugan, Vimal" Date: Tue, 21 Jan 2020 21:51:22 +0530 Subject: [PATCH 6/7] removed comment --- MVMCoreUI/Models/Molecules/HeaderModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Models/Molecules/HeaderModel.swift b/MVMCoreUI/Models/Molecules/HeaderModel.swift index 0277e9fe..4499d313 100644 --- a/MVMCoreUI/Models/Molecules/HeaderModel.swift +++ b/MVMCoreUI/Models/Molecules/HeaderModel.swift @@ -44,8 +44,8 @@ import Foundation required public init(from decoder: Decoder) throws { try super.init(from: decoder) let typeContainer = try decoder.container(keyedBy: HeaderCodingKeys.self) - setDefaults() line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) + setDefaults() } public override func encode(to encoder: Encoder) throws { From 8e284034804d5c1cec56818844cd52a5cde2f316 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Tue, 21 Jan 2020 23:44:31 +0530 Subject: [PATCH 7/7] alignment fixes and progressBar mapping change. --- .../HeadLineBodyCaretLinkImage.swift | 25 +++++++++---------- .../MVMCoreUIMoleculeMappingObject.m | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift index 3b52e6bf..d1f0dbf5 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift @@ -13,18 +13,15 @@ import Foundation let caretButton = CaretButton(frame: .zero) let backgroundImageView = MFLoadImageView() var spaceBetweenConstant: CGFloat = 104.0 - var leftConstraintHeadline : NSLayoutConstraint? - var leftConstraintCaretView : NSLayoutConstraint? - let padding = MFStyler.defaultHorizontalPaddingForApplicationWidth() let maxWidth : CGFloat = 350.0 // MARK: - MVMCoreViewProtocol open override func updateView(_ size: CGFloat) { - super.updateView(size) - headlineBody.updateView(size) - caretButton.updateView(size) - backgroundImageView.updateView(size) - leftConstraintHeadline?.constant = MFStyler.defaultHorizontalPadding(forSize: size) - leftConstraintCaretView?.constant = MFStyler.defaultHorizontalPadding(forSize: size) + super.updateView(size) + headlineBody.updateView(size) + caretButton.updateView(size) + backgroundImageView.updateView(size) + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() } open override func setupView() { @@ -39,8 +36,7 @@ import Foundation view.addSubview(caretButton) //Headline view - leftConstraintHeadline = headlineBody.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: padding) - leftConstraintHeadline?.isActive = true + headlineBody.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true headlineBody.topAnchor.constraint(equalTo: view.topAnchor, constant: PaddingDefault).isActive = true let headLineBodyWidth = headlineBody.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.85) @@ -50,8 +46,7 @@ import Foundation //Caret view caretButton.translatesAutoresizingMaskIntoConstraints = false - leftConstraintCaretView = caretButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: padding) - leftConstraintCaretView?.isActive = true + caretButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true view.bottomAnchor.constraint(equalTo: caretButton.bottomAnchor, constant: PaddingDefault).isActive = true caretButton.topAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant).isActive = true @@ -59,6 +54,8 @@ import Foundation //Background image view backgroundImageView.translatesAutoresizingMaskIntoConstraints = false backgroundImageView.imageView.contentMode = .scaleAspectFill + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() view.addSubview(backgroundImageView) NSLayoutConstraint.constraintPinSubview(toSuperview: backgroundImageView) view.sendSubviewToBack(backgroundImageView) @@ -88,6 +85,8 @@ import Foundation headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData) caretButton.setWithModel(model.caretLink, delegateObject, additionalData) backgroundImageView.setWithModel(model.image, delegateObject, additionalData) + backgroundImageView.alignFillHorizontal() + backgroundImageView.alignFillVertical() } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index 1e589134..b5a39119 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -45,7 +45,7 @@ @"checkbox": Checkbox.class, @"checkboxLabel": CheckboxWithLabelView.class, @"cornerLabels" : CornerLabels.class, - @"progressbar": ProgressBar.class, + @"progressBar": ProgressBar.class, @"circleProgress": GraphView.class, @"multiProgressBar": MultiProgress.class, @"radioButton": RadioButton.class,