diff --git a/VDS/Components/Modal/Modal.swift b/VDS/Components/Modal/Modal.swift index b927d528..494b71b7 100644 --- a/VDS/Components/Modal/Modal.swift +++ b/VDS/Components/Modal/Modal.swift @@ -51,12 +51,15 @@ open class Modal: Control, ModalLaunchable { /// UIView rendered for the content area of the modal open var contentView: UIView? { didSet { setNeedsUpdate() } } - ///// Array of Buttonable Views that are shown as Modal Footer. Primary and Close button data for modal button group. + /// Array of Buttonable Views that are shown as Modal Footer. Primary and Close button data for modal button group. open var buttonData: [ButtonBase]? { didSet { setNeedsUpdate() } } - ///// If provided, the Modal has the option to be displayed at full screen. + /// If provided, the Modal has the option to be displayed at full screen. open var fullScreenDialog: Bool = false { didSet { setNeedsUpdate() } } - + + /// If provided, close button can not be present. + open var hideCloseButton: Bool = false { didSet { setNeedsUpdate() } } + //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- @@ -106,7 +109,8 @@ open class Modal: Control, ModalLaunchable { content: content, contentView: contentView, buttonData: buttonData, - fullScreenDialog: fullScreenDialog), + fullScreenDialog: fullScreenDialog, + hideCloseButton: hideCloseButton), presenter: self) } diff --git a/VDS/Components/Modal/ModalDialog.swift b/VDS/Components/Modal/ModalDialog.swift index 3c9c05c5..1f1987ce 100644 --- a/VDS/Components/Modal/ModalDialog.swift +++ b/VDS/Components/Modal/ModalDialog.swift @@ -245,6 +245,8 @@ open class ModalDialog: View, UIScrollViewDelegate, ParentViewProtocol { contentStackView.setCustomSpacing(contentLabelTopSpace, after: titleLabel) } + closeCrossButton.isHidden = modalModel.hideCloseButton + contentStackView.setNeedsLayout() contentStackView.layoutIfNeeded() scrollView.setNeedsLayout() diff --git a/VDS/Components/Modal/ModalModel.swift b/VDS/Components/Modal/ModalModel.swift index 85972bcc..c0bb6f79 100644 --- a/VDS/Components/Modal/ModalModel.swift +++ b/VDS/Components/Modal/ModalModel.swift @@ -21,12 +21,14 @@ extension Modal { public var contentViewAlignment: UIStackView.Alignment? public var buttonData: [ButtonBase]? public var fullScreenDialog: Bool + public var hideCloseButton: Bool public init(closeButtonText: String = "Close", title: String? = nil, content: String? = nil, contentView: UIView? = nil, buttonData: [ButtonBase]? = nil, fullScreenDialog: Bool = false, + hideCloseButton: Bool = false, accessibleText: String? = "Modal", contentViewAlignment: UIStackView.Alignment = .leading) { self.closeButtonText = closeButtonText @@ -37,6 +39,7 @@ extension Modal { self.contentViewAlignment = contentViewAlignment self.buttonData = buttonData self.fullScreenDialog = fullScreenDialog + self.hideCloseButton = hideCloseButton } } }