Merge branch 'feature/Notification' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios.git into feature/Notification
This commit is contained in:
commit
4d2bdc759c
@ -7,11 +7,9 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
44604AD729CE196600E62B51 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD629CE196600E62B51 /* Line.swift */; };
|
|
||||||
445BA07829C07B3D0036A7C5 /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07729C07B3D0036A7C5 /* Notification.swift */; };
|
445BA07829C07B3D0036A7C5 /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07729C07B3D0036A7C5 /* Notification.swift */; };
|
||||||
44604AD029CE17EC00E62B51 /* NotificationTitleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604ACF29CE17EC00E62B51 /* NotificationTitleModel.swift */; };
|
|
||||||
44604AD229CE180F00E62B51 /* NotificationSubTitleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD129CE180F00E62B51 /* NotificationSubTitleModel.swift */; };
|
|
||||||
44604AD429CE186A00E62B51 /* NotificationButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */; };
|
44604AD429CE186A00E62B51 /* NotificationButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */; };
|
||||||
|
44604AD729CE196600E62B51 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD629CE196600E62B51 /* Line.swift */; };
|
||||||
5F21D7BF28DCEB3D003E7CD6 /* Useable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */; };
|
5F21D7BF28DCEB3D003E7CD6 /* Useable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */; };
|
||||||
5FC35BE328D51405004EBEAC /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE228D51405004EBEAC /* Button.swift */; };
|
5FC35BE328D51405004EBEAC /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE228D51405004EBEAC /* Button.swift */; };
|
||||||
EA0FC2C62914222900DF80B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */; };
|
EA0FC2C62914222900DF80B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */; };
|
||||||
@ -125,11 +123,9 @@
|
|||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
44604AD629CE196600E62B51 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
|
||||||
445BA07729C07B3D0036A7C5 /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
|
445BA07729C07B3D0036A7C5 /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
|
||||||
44604ACF29CE17EC00E62B51 /* NotificationTitleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTitleModel.swift; sourceTree = "<group>"; };
|
|
||||||
44604AD129CE180F00E62B51 /* NotificationSubTitleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSubTitleModel.swift; sourceTree = "<group>"; };
|
|
||||||
44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationButtonModel.swift; sourceTree = "<group>"; };
|
44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationButtonModel.swift; sourceTree = "<group>"; };
|
||||||
|
44604AD629CE196600E62B51 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||||
5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Useable.swift; sourceTree = "<group>"; };
|
5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Useable.swift; sourceTree = "<group>"; };
|
||||||
5FC35BE228D51405004EBEAC /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
|
5FC35BE228D51405004EBEAC /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
|
||||||
EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; };
|
EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; };
|
||||||
@ -255,6 +251,15 @@
|
|||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
445BA07629C07ABA0036A7C5 /* Notification */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
445BA07729C07B3D0036A7C5 /* Notification.swift */,
|
||||||
|
44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */,
|
||||||
|
);
|
||||||
|
path = Notification;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
44604AD529CE195300E62B51 /* Line */ = {
|
44604AD529CE195300E62B51 /* Line */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -263,17 +268,6 @@
|
|||||||
path = Line;
|
path = Line;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
445BA07629C07ABA0036A7C5 /* Notification */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
445BA07729C07B3D0036A7C5 /* Notification.swift */,
|
|
||||||
44604ACF29CE17EC00E62B51 /* NotificationTitleModel.swift */,
|
|
||||||
44604AD129CE180F00E62B51 /* NotificationSubTitleModel.swift */,
|
|
||||||
44604AD329CE186A00E62B51 /* NotificationButtonModel.swift */,
|
|
||||||
);
|
|
||||||
path = Notification;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
5FC35BE128D513EB004EBEAC /* Button */ = {
|
5FC35BE128D513EB004EBEAC /* Button */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -795,7 +789,6 @@
|
|||||||
EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */,
|
EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */,
|
||||||
EA4DB2FD28D3D0CA00103EE3 /* AnyEquatable.swift in Sources */,
|
EA4DB2FD28D3D0CA00103EE3 /* AnyEquatable.swift in Sources */,
|
||||||
EAA5EEB728ECC03A003B3210 /* ToolTipLabelAttribute.swift in Sources */,
|
EAA5EEB728ECC03A003B3210 /* ToolTipLabelAttribute.swift in Sources */,
|
||||||
44604AD029CE17EC00E62B51 /* NotificationTitleModel.swift in Sources */,
|
|
||||||
EA5E305A29510F8B0082B959 /* EnumSubset.swift in Sources */,
|
EA5E305A29510F8B0082B959 /* EnumSubset.swift in Sources */,
|
||||||
EA985BF7296C665E00F2FF2E /* IconName.swift in Sources */,
|
EA985BF7296C665E00F2FF2E /* IconName.swift in Sources */,
|
||||||
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
||||||
@ -830,7 +823,6 @@
|
|||||||
EAF7F09A2899B17200B287F5 /* CATransaction.swift in Sources */,
|
EAF7F09A2899B17200B287F5 /* CATransaction.swift in Sources */,
|
||||||
EAF7F0A2289AFB3900B287F5 /* Errorable.swift in Sources */,
|
EAF7F0A2289AFB3900B287F5 /* Errorable.swift in Sources */,
|
||||||
EA985C7D297DAED300F2FF2E /* Primitive.swift in Sources */,
|
EA985C7D297DAED300F2FF2E /* Primitive.swift in Sources */,
|
||||||
44604AD229CE180F00E62B51 /* NotificationSubTitleModel.swift in Sources */,
|
|
||||||
EAB5FEF829393A7200998C17 /* ButtonGroupConstants.swift in Sources */,
|
EAB5FEF829393A7200998C17 /* ButtonGroupConstants.swift in Sources */,
|
||||||
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */,
|
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */,
|
||||||
44604AD729CE196600E62B51 /* Line.swift in Sources */,
|
44604AD729CE196600E62B51 /* Line.swift in Sources */,
|
||||||
|
|||||||
@ -34,6 +34,10 @@ public class Notification: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ButtonsPosition: String, CaseIterable {
|
||||||
|
case bottom, right
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -51,6 +55,14 @@ public class Notification: View {
|
|||||||
$0.axis = .vertical
|
$0.axis = .vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var labelButtonView = UIStackView().with {
|
||||||
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
$0.alignment = .top
|
||||||
|
$0.distribution = .fillEqually
|
||||||
|
$0.axis = .vertical
|
||||||
|
$0.spacing = VDSLayout.Spacing.space2X.value
|
||||||
|
}
|
||||||
|
|
||||||
private var edgeSpacing: CGFloat {
|
private var edgeSpacing: CGFloat {
|
||||||
return UIDevice.isIPad ? VDSLayout.Spacing.space5X.value : VDSLayout.Spacing.space4X.value
|
return UIDevice.isIPad ? VDSLayout.Spacing.space5X.value : VDSLayout.Spacing.space4X.value
|
||||||
}
|
}
|
||||||
@ -92,7 +104,6 @@ public class Notification: View {
|
|||||||
|
|
||||||
open var subTitleText: String? { didSet{didChange()}}
|
open var subTitleText: String? { didSet{didChange()}}
|
||||||
|
|
||||||
#warning("will need to think about this one, probably create a model that has 2 props - text, onClick = (Button) -> () so we are not accessing the button directly. The only reason why I leave it open is for things like accessibility, but not for setting properties outside of this class. More or less follow how Tilelet is working, look at that, below is a temp fix until we can discuss with the guys")
|
|
||||||
//Buttons
|
//Buttons
|
||||||
open var primaryButtonModel: ButtonModel? { didSet{didChange()}}
|
open var primaryButtonModel: ButtonModel? { didSet{didChange()}}
|
||||||
open var primaryButton = Button().with {
|
open var primaryButton = Button().with {
|
||||||
@ -107,11 +118,22 @@ public class Notification: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Modal Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open var type: NotificationStyle = .info { didSet{didChange()}}
|
open var type: NotificationStyle = .info { didSet{didChange()}}
|
||||||
|
|
||||||
|
var _buttonPosition: ButtonsPosition = .bottom
|
||||||
|
open var buttonPosition: ButtonsPosition {
|
||||||
|
set {
|
||||||
|
if !UIDevice.isIPad, newValue == .right { return }
|
||||||
|
_buttonPosition = newValue
|
||||||
|
buttonsView.buttonPosition = _buttonPosition == .right ? .center : .left
|
||||||
|
didChange()
|
||||||
|
}
|
||||||
|
get { _buttonPosition }
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -159,9 +181,11 @@ public class Notification: View {
|
|||||||
])
|
])
|
||||||
|
|
||||||
mainStackView.addArrangedSubview(typeIcon)
|
mainStackView.addArrangedSubview(typeIcon)
|
||||||
mainStackView.addArrangedSubview(labelsView)
|
mainStackView.addArrangedSubview(labelButtonView)
|
||||||
mainStackView.addArrangedSubview(closeButton)
|
mainStackView.addArrangedSubview(closeButton)
|
||||||
|
|
||||||
|
labelButtonView.addArrangedSubview(labelsView)
|
||||||
|
|
||||||
closeButton.publisher(for: UITapGestureRecognizer()).sink { [weak self] _ in
|
closeButton.publisher(for: UITapGestureRecognizer()).sink { [weak self] _ in
|
||||||
self?.didClickOnCloseButton()
|
self?.didClickOnCloseButton()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
@ -183,6 +207,7 @@ public class Notification: View {
|
|||||||
type = .info
|
type = .info
|
||||||
typeIcon.name = .infoBold
|
typeIcon.name = .infoBold
|
||||||
closeButton.name = .close
|
closeButton.name = .close
|
||||||
|
buttonPosition = .bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -251,9 +276,10 @@ public class Notification: View {
|
|||||||
buttonsView.removeFromSuperview()
|
buttonsView.removeFromSuperview()
|
||||||
} else {
|
} else {
|
||||||
labelsView.setCustomSpacing(VDSLayout.Spacing.space3X.value, after: subTitleLabel)
|
labelsView.setCustomSpacing(VDSLayout.Spacing.space3X.value, after: subTitleLabel)
|
||||||
///This below doesn't work
|
|
||||||
buttonsView.buttons = buttons
|
buttonsView.buttons = buttons
|
||||||
labelsView.addArrangedSubview(buttonsView)
|
labelButtonView.axis = buttonPosition == .bottom ? .vertical : .horizontal
|
||||||
|
labelButtonView.addArrangedSubview(buttonsView)
|
||||||
|
|
||||||
buttonsView
|
buttonsView
|
||||||
.pinLeading()
|
.pinLeading()
|
||||||
|
|||||||
@ -1,26 +0,0 @@
|
|||||||
//
|
|
||||||
// NotificationSubTitleModel.swift
|
|
||||||
// VDS
|
|
||||||
//
|
|
||||||
// Created by Nadigadda, Sumanth on 24/03/23.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
extension Notification {
|
|
||||||
public struct SubTitleModel {
|
|
||||||
public var text: String
|
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
|
||||||
public var textStyle: TextStyle = .bodySmall
|
|
||||||
public var numberOfLines: Int
|
|
||||||
|
|
||||||
public init(text: String,
|
|
||||||
textColor: Use = .primary,
|
|
||||||
textAttributes: [any LabelAttributeModel]? = nil,
|
|
||||||
numberOfLines: Int = 0) {
|
|
||||||
self.text = text
|
|
||||||
self.textAttributes = textAttributes
|
|
||||||
self.numberOfLines = numberOfLines
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
//
|
|
||||||
// NotificationTitleModel.swift
|
|
||||||
// VDS
|
|
||||||
//
|
|
||||||
// Created by Nadigadda, Sumanth on 24/03/23.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
extension Notification {
|
|
||||||
public struct TitleModel {
|
|
||||||
public var text: String
|
|
||||||
public var textAttributes: [any LabelAttributeModel]?
|
|
||||||
public var textStyle: TextStyle = .boldBodySmall
|
|
||||||
public var numberOfLines: Int
|
|
||||||
|
|
||||||
public init(text: String,
|
|
||||||
textAttributes: [any LabelAttributeModel]? = nil,
|
|
||||||
numberOfLines: Int = 0) {
|
|
||||||
self.text = text
|
|
||||||
self.textAttributes = textAttributes
|
|
||||||
self.numberOfLines = numberOfLines
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user