Merge branch 'develop' into feature/star
This commit is contained in:
commit
439fe0d202
@ -74,23 +74,6 @@ import UIKit
|
|||||||
private weak var widthConstraint: NSLayoutConstraint?
|
private weak var widthConstraint: NSLayoutConstraint?
|
||||||
private weak var heightConstraint: NSLayoutConstraint?
|
private weak var heightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
@objc public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc required public init?(coder: NSCoder) {
|
|
||||||
super.init(coder: coder)
|
|
||||||
fatalError("DigitBox does not support xibs.")
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -81,7 +81,9 @@ open class ItemDropdownEntryField: BaseDropdownEntryField {
|
|||||||
guard !pickerData.isEmpty else { return }
|
guard !pickerData.isEmpty else { return }
|
||||||
|
|
||||||
if setInitialValueInTextField, let pickerIndex = pickerView?.selectedRow(inComponent: 0) {
|
if setInitialValueInTextField, let pickerIndex = pickerView?.selectedRow(inComponent: 0) {
|
||||||
|
observeDropdownChange?(text ?? "", pickerData[pickerIndex])
|
||||||
text = pickerData[pickerIndex]
|
text = pickerData[pickerIndex]
|
||||||
|
itemDropdownEntryFieldModel?.selectedIndex = pickerIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,18 +79,6 @@ open class Arrow: View {
|
|||||||
widthConstraint?.isActive = true
|
widthConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -73,30 +73,6 @@
|
|||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
setupView()
|
|
||||||
}
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public convenience init(position: CheckboxPosition) {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
|
|
||||||
alignCheckbox(position)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder: NSCoder) {
|
|
||||||
super.init(coder: coder)
|
|
||||||
fatalError("xib file is not implemented for CheckboxLabel")
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -24,22 +24,6 @@ open class DashLine: View {
|
|||||||
|
|
||||||
@objc private var dashLayer: CAShapeLayer?
|
@objc private var dashLayer: CAShapeLayer?
|
||||||
|
|
||||||
//------------------------------------------------------
|
|
||||||
// MARK: - Initializer
|
|
||||||
//------------------------------------------------------
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder: NSCoder) {
|
|
||||||
super.init(coder: coder)
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -46,22 +46,6 @@
|
|||||||
rightTextLabelLeading?.isActive = false
|
rightTextLabelLeading?.isActive = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
|
||||||
// MARK: - Initialization
|
|
||||||
//------------------------------------------------------
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
|
|||||||
@ -14,19 +14,9 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public let headlineBody = HeadlineBody(frame: .zero)
|
public let headlineBody = HeadlineBody(frame: .zero)
|
||||||
public let buttons = TwoButtonView(frame: .zero)
|
public let buttons = TwoButtonView(frame: .zero)
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [headlineBody, buttons], spacing: Padding.Eighteen)
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
// MARK: - Initializers
|
|
||||||
//-------------------------------------------------------
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [headlineBody, buttons], spacing: Padding.Eighteen)
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
|
|||||||
@ -16,20 +16,9 @@ import Foundation
|
|||||||
|
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let buttons = TwoButtonView()
|
public let buttons = TwoButtonView()
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [headlineBody, buttons], spacing: PaddingDefaultVerticalSpacing3)
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
// MARK: - Initializers
|
|
||||||
//-------------------------------------------------------
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [headlineBody, buttons], spacing: PaddingDefaultVerticalSpacing3)
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -13,19 +13,9 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let caretLink = CaretLink()
|
public let caretLink = CaretLink()
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [headlineBody, caretLink])
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
// MARK: - Initializers
|
|
||||||
//-------------------------------------------------------
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [headlineBody, caretLink])
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -14,19 +14,9 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let link = Link()
|
public let link = Link()
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [headlineBody, link])
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
// MARK: - Initializers
|
|
||||||
//-------------------------------------------------------
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [headlineBody, link])
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -21,31 +21,26 @@ import Foundation
|
|||||||
public let subBody3 = Label(fontStyle: .RegularMicro)
|
public let subBody3 = Label(fontStyle: .RegularMicro)
|
||||||
public let verticalLine1 = Line()
|
public let verticalLine1 = Line()
|
||||||
public let verticalLine2 = Line()
|
public let verticalLine2 = Line()
|
||||||
public let verticalStack1: Stack<StackModel>
|
public lazy var verticalStack1: Stack<StackModel> = {
|
||||||
public let verticalStack2: Stack<StackModel>
|
return Stack<StackModel>.createStack(with: [body, subBody], spacing: 0)
|
||||||
public let verticalStack3: Stack<StackModel>
|
}()
|
||||||
public let horizontalStack: Stack<StackModel>
|
public lazy var verticalStack2: Stack<StackModel> = {
|
||||||
public let stack: Stack<StackModel>
|
return Stack<StackModel>.createStack(with: [body2, subBody2], spacing: 0)
|
||||||
|
}()
|
||||||
//-------------------------------------------------------
|
public lazy var verticalStack3: Stack<StackModel> = {
|
||||||
// MARK: - Initializers
|
return Stack<StackModel>.createStack(with: [body3, subBody3], spacing: 0)
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
public override init(frame: CGRect) {
|
public lazy var horizontalStack: Stack<StackModel> = {
|
||||||
verticalStack1 = Stack<StackModel>.createStack(with: [body, subBody], spacing: 0)
|
return Stack<StackModel>.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 29, verticalAlignment: .top)),
|
||||||
verticalStack2 = Stack<StackModel>.createStack(with: [body2, subBody2], spacing: 0)
|
(view: verticalLine1, model: StackItemModel(verticalAlignment: .top)),
|
||||||
verticalStack3 = Stack<StackModel>.createStack(with: [body3, subBody3], spacing: 0)
|
(view: verticalStack2, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)),
|
||||||
horizontalStack = Stack<StackModel>.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 29, verticalAlignment: .top)), (view: verticalLine1, model: StackItemModel(verticalAlignment: .top)),
|
(view: verticalLine2, model: StackItemModel(verticalAlignment: .top)),
|
||||||
(view: verticalStack2, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)),
|
(view: verticalStack3, model: StackItemModel(percent: 32, verticalAlignment: .top))],
|
||||||
(view: verticalLine2, model: StackItemModel(verticalAlignment: .top)),
|
axis: .horizontal)
|
||||||
(view: verticalStack3, model: StackItemModel(percent: 32, verticalAlignment: .top))],
|
}()
|
||||||
axis: .horizontal)
|
public lazy var stack: Stack<StackModel> = {
|
||||||
stack = Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
return Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
||||||
super.init(frame: frame)
|
}()
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -16,22 +16,11 @@ import Foundation
|
|||||||
|
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let button = PillButton()
|
public let button = PillButton()
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
//-------------------------------------------------------
|
(view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))],
|
||||||
// MARK: - Initializers
|
axis: .vertical)
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)),
|
|
||||||
(view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))],
|
|
||||||
axis: .vertical)
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Constants
|
// MARK: - Constants
|
||||||
|
|||||||
@ -15,21 +15,11 @@ import Foundation
|
|||||||
public let headline = Label(fontStyle: .Title2XLarge)
|
public let headline = Label(fontStyle: .Title2XLarge)
|
||||||
public let subHeadline = Label(fontStyle: .RegularTitleLarge)
|
public let subHeadline = Label(fontStyle: .RegularTitleLarge)
|
||||||
public let body = Label(fontStyle: .RegularBodySmall)
|
public let body = Label(fontStyle: .RegularBodySmall)
|
||||||
public let stack: Stack<StackModel>
|
public lazy var stack: Stack<StackModel> = {
|
||||||
|
return Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel()),
|
||||||
//-------------------------------------------------------
|
(view: subHeadline, model: StackItemModel(spacing: 16)),
|
||||||
// MARK: - Initializers
|
(view: body, model: StackItemModel(spacing: 8))])
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
public override init(frame: CGRect) {
|
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel()),
|
|
||||||
(view: subHeadline, model: StackItemModel(spacing: 16)),
|
|
||||||
(view: body, model: StackItemModel(spacing: 8))])
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -16,26 +16,17 @@ import Foundation
|
|||||||
public let headline = Label(fontStyle: .BoldTitleLarge)
|
public let headline = Label(fontStyle: .BoldTitleLarge)
|
||||||
public let subHeadline = Label(fontStyle: .RegularTitleLarge)
|
public let subHeadline = Label(fontStyle: .RegularTitleLarge)
|
||||||
public let body = Label(fontStyle: .RegularBodySmall)
|
public let body = Label(fontStyle: .RegularBodySmall)
|
||||||
public let verticalStack: Stack<StackModel>
|
public lazy var verticalStack: Stack<StackModel> = {
|
||||||
public var stack: Stack<StackModel>
|
return Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel()),
|
||||||
|
(view: subHeadline, model: StackItemModel()),
|
||||||
//-------------------------------------------------------
|
(view: body, model: StackItemModel(horizontalAlignment: .fill))],
|
||||||
// MARK: - Initializers
|
axis: .vertical, spacing: 0)
|
||||||
//-------------------------------------------------------
|
}()
|
||||||
public override init(frame: CGRect) {
|
public lazy var stack: Stack<StackModel> = {
|
||||||
verticalStack = Stack<StackModel>.createStack(with: [(view: headline, model: StackItemModel()),
|
return Stack<StackModel>.createStack(with: [(view: planLabel, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .leading)),
|
||||||
(view: subHeadline, model: StackItemModel()),
|
(view: verticalStack, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .leading))],
|
||||||
(view: body, model: StackItemModel(horizontalAlignment: .fill))],
|
axis: .horizontal)
|
||||||
axis: .vertical, spacing: 0)
|
}()
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: planLabel, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .leading)),
|
|
||||||
(view: verticalStack, model: StackItemModel(horizontalAlignment: .fill, verticalAlignment: .leading))],
|
|
||||||
axis: .horizontal)
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
|
|||||||
@ -49,22 +49,6 @@ open class DoughnutChart: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -15,19 +15,6 @@ import UIKit
|
|||||||
var delegateObject: MVMCoreUIDelegateObject?
|
var delegateObject: MVMCoreUIDelegateObject?
|
||||||
let label = Label()
|
let label = Label()
|
||||||
|
|
||||||
// MARK: - Inits
|
|
||||||
public init() {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func updateView(_ size: CGFloat) {
|
public override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
radioButton.updateView(size)
|
radioButton.updateView(size)
|
||||||
|
|||||||
@ -23,22 +23,6 @@ import UIKit
|
|||||||
|
|
||||||
private var equalWidthConstraint: NSLayoutConstraint?
|
private var equalWidthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -17,22 +17,6 @@ import Foundation
|
|||||||
open var leftLink = Link()
|
open var leftLink = Link()
|
||||||
open var rightLink = Link()
|
open var rightLink = Link()
|
||||||
private var stack = UIStackView()
|
private var stack = UIStackView()
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Initializers
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
|||||||
@ -29,22 +29,6 @@ import UIKit
|
|||||||
|
|
||||||
var imageLeadingConstraint: NSLayoutConstraint?
|
var imageLeadingConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//------------------------------------------------------
|
|
||||||
// MARK: - Initialization
|
|
||||||
//------------------------------------------------------
|
|
||||||
|
|
||||||
public init() {
|
|
||||||
super.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -29,22 +29,6 @@ import UIKit
|
|||||||
|
|
||||||
var buttonTopConstraint: NSLayoutConstraint?
|
var buttonTopConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//------------------------------------------------------
|
|
||||||
// MARK: - Initialization
|
|
||||||
//------------------------------------------------------
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -36,6 +36,13 @@ open class StringAndMoleculeView: View {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
|
let moleculeModel = model as? StringAndMoleculeModel
|
||||||
|
label.text = moleculeModel?.string
|
||||||
|
self.molecule = moleculeModel?.molecule as! MoleculeViewProtocol
|
||||||
|
super.init(model: model, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
override public func setupView() {
|
override public func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
guard subviews.count == 0 else {
|
guard subviews.count == 0 else {
|
||||||
|
|||||||
@ -20,22 +20,6 @@ open class ThreeHeadlineBodyLink: View {
|
|||||||
public let body = Label(fontStyle: .RegularBodySmall)
|
public let body = Label(fontStyle: .RegularBodySmall)
|
||||||
public let link = Link()
|
public let link = Link()
|
||||||
|
|
||||||
//------------------------------------------------------
|
|
||||||
// MARK: - Initialization
|
|
||||||
//------------------------------------------------------
|
|
||||||
|
|
||||||
public convenience init() {
|
|
||||||
self.init(frame: .zero)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
|
||||||
super.init(frame: frame)
|
|
||||||
}
|
|
||||||
|
|
||||||
required public init?(coder aDecoder: NSCoder) {
|
|
||||||
super.init(coder: aDecoder)
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -113,6 +113,11 @@ open class Stack<T>: Container where T: (StackModelProtocol & MoleculeModelProto
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.init(frame: .zero)
|
||||||
|
set(with: model, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a Stack created with a StackModel and StackItems containing the passed in views.
|
/// Returns a Stack created with a StackModel and StackItems containing the passed in views.
|
||||||
public static func createStack(with views: [UIView], axis: NSLayoutConstraint.Axis? = nil, spacing: CGFloat? = nil) -> Stack<StackModel> {
|
public static func createStack(with views: [UIView], axis: NSLayoutConstraint.Axis? = nil, spacing: CGFloat? = nil) -> Stack<StackModel> {
|
||||||
var items: [StackItem] = []
|
var items: [StackItem] = []
|
||||||
|
|||||||
@ -43,6 +43,12 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.init(frame: .zero)
|
||||||
|
initialSetup()
|
||||||
|
set(with: model, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -878,7 +878,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
// Create bottom progress bar
|
// Create bottom progress bar
|
||||||
UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
||||||
progressView.translatesAutoresizingMaskIntoConstraints = NO;
|
progressView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
progressView.tintColor = [UIColor mfTomatoRed];
|
progressView.progressTintColor = [UIColor mfTomatoRed];
|
||||||
[self.view addSubview:progressView];
|
[self.view addSubview:progressView];
|
||||||
self.bottomProgressBar = progressView;
|
self.bottomProgressBar = progressView;
|
||||||
[NSLayoutConstraint constraintWithItem:progressView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES;
|
[NSLayoutConstraint constraintWithItem:progressView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES;
|
||||||
|
|||||||
@ -21,13 +21,13 @@ public extension MVMCoreUITopAlertView {
|
|||||||
NotificationCenter.default.addObserver(self, selector: #selector(viewControllerChanged(notification:)), name: NSNotification.Name(rawValue: MVMCoreNotificationViewControllerChanged), object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(viewControllerChanged(notification:)), name: NSNotification.Name(rawValue: MVMCoreNotificationViewControllerChanged), object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func getDelegateObject() -> MVMCoreUIDelegateObject {
|
private func getDelegateObject() -> MVMCoreUIDelegateObject {
|
||||||
// TODO: Top alert view is current delegate. Should move to current view controller eventually?
|
// TODO: Top alert view is current delegate. Should move to current view controller eventually?
|
||||||
return MVMCoreUIDelegateObject.create(withDelegateForAll: self)
|
return MVMCoreUIDelegateObject.create(withDelegateForAll: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks for new top alert json
|
/// Checks for new top alert json
|
||||||
@objc func responseJSONUpdated(notification: Notification) {
|
@objc private func responseJSONUpdated(notification: Notification) {
|
||||||
guard let responseJSON = (notification.userInfo?[String(describing: MVMCoreLoadObject.self)] as? MVMCoreLoadObject)?.responseJSON,
|
guard let responseJSON = (notification.userInfo?[String(describing: MVMCoreLoadObject.self)] as? MVMCoreLoadObject)?.responseJSON,
|
||||||
let json = responseJSON.optionalDictionaryForKey("TopNotification"),
|
let json = responseJSON.optionalDictionaryForKey("TopNotification"),
|
||||||
let model = decodeTopNotification(with: json, delegateObject: getDelegateObject()) else { return }
|
let model = decodeTopNotification(with: json, delegateObject: getDelegateObject()) else { return }
|
||||||
@ -35,13 +35,43 @@ public extension MVMCoreUITopAlertView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// When a detail page changes, check top alerts.
|
/// When a detail page changes, check top alerts.
|
||||||
@objc func viewControllerChanged(notification: Notification) {
|
@objc private func viewControllerChanged(notification: Notification) {
|
||||||
guard let controller = MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() as? MVMCoreViewControllerProtocol else { return }
|
guard let controller = MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() as? MVMCoreViewControllerProtocol else { return }
|
||||||
MVMCoreAlertHandler.shared()?.checkPagesDependency(for: controller.pageType)
|
MVMCoreAlertHandler.shared()?.handleAllPagesDependency(for: controller.pageType)
|
||||||
|
reevalutePriority()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Re-evaluates the queue priority
|
||||||
|
private func reevalutePriority() {
|
||||||
|
guard let operations = MVMCoreAlertHandler.shared()?.topAlertQueue.operations else { return }
|
||||||
|
var highestReadyOperation: Operation?
|
||||||
|
var executingOperation: Operation?
|
||||||
|
for operation in operations {
|
||||||
|
guard !operation.isCancelled,
|
||||||
|
!operation.isFinished else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if operation.isReady,
|
||||||
|
highestReadyOperation == nil || operation.queuePriority.rawValue > highestReadyOperation!.queuePriority.rawValue {
|
||||||
|
highestReadyOperation = operation
|
||||||
|
}
|
||||||
|
if operation.isExecuting {
|
||||||
|
executingOperation = operation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the highest priority operation is not executing, and the executing operation is persistent, cancel it.
|
||||||
|
if let newOperation = highestReadyOperation,
|
||||||
|
let currentOperation = executingOperation as? MVMCoreTopAlertOperation,
|
||||||
|
currentOperation != newOperation,
|
||||||
|
currentOperation.topAlertObject.persistent {
|
||||||
|
currentOperation.reAddAfterCancel = true
|
||||||
|
currentOperation.cancel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decodes the json into a TopNotificationModel
|
/// Decodes the json into a TopNotificationModel
|
||||||
func decodeTopNotification(with json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) -> TopNotificationModel? {
|
private func decodeTopNotification(with json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) -> TopNotificationModel? {
|
||||||
do {
|
do {
|
||||||
return try TopNotificationModel.decode(json: json, delegateObject: delegateObject)
|
return try TopNotificationModel.decode(json: json, delegateObject: delegateObject)
|
||||||
} catch {
|
} catch {
|
||||||
@ -55,7 +85,26 @@ public extension MVMCoreUITopAlertView {
|
|||||||
/// Shows the top alert with the model.
|
/// Shows the top alert with the model.
|
||||||
func showTopAlert(with model: TopNotificationModel) {
|
func showTopAlert(with model: TopNotificationModel) {
|
||||||
let object = model.createTopAlertObject()
|
let object = model.createTopAlertObject()
|
||||||
MVMCoreAlertHandler.shared()?.showTopAlert(with: object)
|
guard !checkAndUpdateExisting(with: object),
|
||||||
|
let operation = MVMCoreTopAlertOperation(topAlertObject: object) else { return }
|
||||||
|
MVMCoreAlertHandler.shared()?.addPagesDependency(to: operation)
|
||||||
|
MVMCoreAlertHandler.shared()?.handlePageDependency(for: operation, with: (MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() as? MVMCoreViewControllerProtocol)?.pageType)
|
||||||
|
MVMCoreAlertHandler.shared()?.add(operation)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks for existing top alert object of same type and updates it. Only happens for molecular top alerts. Returns true if we updated.
|
||||||
|
private func checkAndUpdateExisting(with topAlertObject: MVMCoreTopAlertObject) -> Bool {
|
||||||
|
guard let queue = MVMCoreAlertHandler.shared()?.topAlertQueue.operations else { return false }
|
||||||
|
for case let operation as MVMCoreTopAlertOperation in queue {
|
||||||
|
guard topAlertObject.json != nil,
|
||||||
|
operation.topAlertObject.type == topAlertObject.type else { continue }
|
||||||
|
operation.update(with: topAlertObject)
|
||||||
|
MVMCoreAlertHandler.shared()?.updatePages(for: operation, with: topAlertObject)
|
||||||
|
MVMCoreAlertHandler.shared()?.handlePageDependency(for: operation, with: (MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() as? MVMCoreViewControllerProtocol)?.pageType)
|
||||||
|
reevalutePriority()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Updates the current top alert molecule with the new object
|
/// Updates the current top alert molecule with the new object
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user