Digital ACT-191 ONEAPP-10928 story: show/hide close button based on flag

This commit is contained in:
Vasavi Kanamarlapudi 2024-09-27 18:58:53 +05:30
parent 81725ffdeb
commit b210135566
3 changed files with 13 additions and 4 deletions

View File

@ -51,12 +51,15 @@ open class Modal: Control, ModalLaunchable {
/// UIView rendered for the content area of the modal /// UIView rendered for the content area of the modal
open var contentView: UIView? { didSet { setNeedsUpdate() } } 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() } } 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() } } open var fullScreenDialog: Bool = false { didSet { setNeedsUpdate() } }
/// If provided, close button can not be present.
open var hideCloseButton: Bool = false { didSet { setNeedsUpdate() } }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
@ -106,7 +109,8 @@ open class Modal: Control, ModalLaunchable {
content: content, content: content,
contentView: contentView, contentView: contentView,
buttonData: buttonData, buttonData: buttonData,
fullScreenDialog: fullScreenDialog), fullScreenDialog: fullScreenDialog,
hideCloseButton: hideCloseButton),
presenter: self) presenter: self)
} }

View File

@ -245,6 +245,8 @@ open class ModalDialog: View, UIScrollViewDelegate, ParentViewProtocol {
contentStackView.setCustomSpacing(contentLabelTopSpace, after: titleLabel) contentStackView.setCustomSpacing(contentLabelTopSpace, after: titleLabel)
} }
closeCrossButton.isHidden = modalModel.hideCloseButton
contentStackView.setNeedsLayout() contentStackView.setNeedsLayout()
contentStackView.layoutIfNeeded() contentStackView.layoutIfNeeded()
scrollView.setNeedsLayout() scrollView.setNeedsLayout()

View File

@ -21,12 +21,14 @@ extension Modal {
public var contentViewAlignment: UIStackView.Alignment? public var contentViewAlignment: UIStackView.Alignment?
public var buttonData: [ButtonBase]? public var buttonData: [ButtonBase]?
public var fullScreenDialog: Bool public var fullScreenDialog: Bool
public var hideCloseButton: Bool
public init(closeButtonText: String = "Close", public init(closeButtonText: String = "Close",
title: String? = nil, title: String? = nil,
content: String? = nil, content: String? = nil,
contentView: UIView? = nil, contentView: UIView? = nil,
buttonData: [ButtonBase]? = nil, buttonData: [ButtonBase]? = nil,
fullScreenDialog: Bool = false, fullScreenDialog: Bool = false,
hideCloseButton: Bool = false,
accessibleText: String? = "Modal", accessibleText: String? = "Modal",
contentViewAlignment: UIStackView.Alignment = .leading) { contentViewAlignment: UIStackView.Alignment = .leading) {
self.closeButtonText = closeButtonText self.closeButtonText = closeButtonText
@ -37,6 +39,7 @@ extension Modal {
self.contentViewAlignment = contentViewAlignment self.contentViewAlignment = contentViewAlignment
self.buttonData = buttonData self.buttonData = buttonData
self.fullScreenDialog = fullScreenDialog self.fullScreenDialog = fullScreenDialog
self.hideCloseButton = hideCloseButton
} }
} }
} }