Merge branch 'feature/list_star_rating' into 'develop'
Feature/list star rating See merge request BPHV_MIPS/mvm_core_ui!622
This commit is contained in:
commit
f316e61d5b
@ -235,6 +235,8 @@
|
||||
AA71AD4024A32FE700ACA76F /* HeadersH2Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */; };
|
||||
AA7F32AB246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */; };
|
||||
AA7F32AD246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */; };
|
||||
AA7F47732541AD560015A2C1 /* ListStarRatingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F47722541AD560015A2C1 /* ListStarRatingModel.swift */; };
|
||||
AA7F47762541AD6A0015A2C1 /* ListStarRating.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA7F47752541AD6A0015A2C1 /* ListStarRating.swift */; };
|
||||
AA85236C244435A20059CC1E /* RadioSwatchCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */; };
|
||||
AA9972502475309F00FC7472 /* ListLeftVariableIconAllTextLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA99724F2475309F00FC7472 /* ListLeftVariableIconAllTextLinksModel.swift */; };
|
||||
AA997252247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA997251247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift */; };
|
||||
@ -774,6 +776,8 @@
|
||||
AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Link.swift; sourceTree = "<group>"; };
|
||||
AA7F32AA246C0F7900C965BA /* ListLeftVariableRadioButtonAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinksModel.swift; sourceTree = "<group>"; };
|
||||
AA7F32AC246C0F8C00C965BA /* ListLeftVariableRadioButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAllTextAndLinks.swift; sourceTree = "<group>"; };
|
||||
AA7F47722541AD560015A2C1 /* ListStarRatingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStarRatingModel.swift; sourceTree = "<group>"; };
|
||||
AA7F47752541AD6A0015A2C1 /* ListStarRating.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListStarRating.swift; sourceTree = "<group>"; };
|
||||
AA85236B244435A20059CC1E /* RadioSwatchCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||
AA99724F2475309F00FC7472 /* ListLeftVariableIconAllTextLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconAllTextLinksModel.swift; sourceTree = "<group>"; };
|
||||
AA997251247530B100FC7472 /* ListLeftVariableIconAllTextLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconAllTextLinks.swift; sourceTree = "<group>"; };
|
||||
@ -1359,6 +1363,8 @@
|
||||
children = (
|
||||
AAE96FA125341F6A0037A989 /* ListStoreLocatorModel.swift */,
|
||||
AAE96FA425341F7D0037A989 /* ListStoreLocator.swift */,
|
||||
AA7F47722541AD560015A2C1 /* ListStarRatingModel.swift */,
|
||||
AA7F47752541AD6A0015A2C1 /* ListStarRating.swift */,
|
||||
);
|
||||
path = Miscellaneous;
|
||||
sourceTree = "<group>";
|
||||
@ -2654,6 +2660,8 @@
|
||||
011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */,
|
||||
D22479962316AF6E003FCCF9 /* HeadlineBodyLink.swift in Sources */,
|
||||
8DE5BECD2456F7A200772E76 /* ListTwoColumnDropdownSelectorsModel.swift in Sources */,
|
||||
AA7F47732541AD560015A2C1 /* ListStarRatingModel.swift in Sources */,
|
||||
AA7F47762541AD6A0015A2C1 /* ListStarRating.swift in Sources */,
|
||||
0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */,
|
||||
D2ED27EB254B0CE700A1C293 /* UIAlertActionStyle+Codable.swift in Sources */,
|
||||
BB55B51D244482C1002001AD /* ListRightVariablePriceChangeBodyText.swift in Sources */,
|
||||
|
||||
@ -202,6 +202,7 @@ import Foundation
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarThin.self, viewModelClass: ListProgressBarThinModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListStoreLocator.self, viewModelClass: ListStoreLocatorModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListStarRating.self, viewModelClass: ListStarRatingModel.self)
|
||||
|
||||
// MARK:- Designed Section Dividers
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self)
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
//
|
||||
// ListStarRating.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 22/10/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
@objcMembers open class ListStarRating: TableViewCell {
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//-----------------------------------------------------
|
||||
public let stars = Stars()
|
||||
public var reviewsCount = Label(fontStyle: .RegularBodySmall)
|
||||
public lazy var stack: Stack<StackModel> = {
|
||||
return Stack<StackModel>.createStack(with: [(view: stars, model: StackItemModel(horizontalAlignment: .fill)),
|
||||
(view: reviewsCount, model: StackItemModel(horizontalAlignment: .leading))],
|
||||
axis: .horizontal, spacing: Padding.Two)
|
||||
}()
|
||||
|
||||
//-----------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//-----------------------------------------------------
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MARK: - Molecule
|
||||
//----------------------------------------------------
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
guard let model = model as? ListStarRatingModel else { return }
|
||||
stars.set(with: model.stars, delegateObject, additionalData)
|
||||
reviewsCount.set(with: model.reviewsCount, delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 90
|
||||
}
|
||||
|
||||
// MARK: - Accessibility
|
||||
func updateAccessibilityLabel() {
|
||||
isAccessibilityElement = true
|
||||
var message = ""
|
||||
if let starsLabel = stars.accessibilityLabel {
|
||||
message += starsLabel + ", "
|
||||
}
|
||||
|
||||
if let reviewsCountLabelText = reviewsCount.text, let reviewText = MVMCoreUIUtility.hardcodedString(withKey: "review_text") {
|
||||
message += reviewsCountLabelText + reviewText
|
||||
}
|
||||
accessibilityLabel = message
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
//
|
||||
// ListStarRatingModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Lekshmi S on 22/10/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
open class ListStarRatingModel: ListItemModel, MoleculeModelProtocol {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
public static var identifier: String = "listStarRating"
|
||||
public var stars: StarsModel
|
||||
public var reviewsCount: LabelModel
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
public init(stars: StarsModel, reviewsCount: LabelModel) {
|
||||
self.stars = stars
|
||||
self.reviewsCount = reviewsCount
|
||||
super.init()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case stars
|
||||
case reviewsCount
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
stars = try typeContainer.decode(StarsModel.self, forKey: .stars)
|
||||
reviewsCount = try typeContainer.decode(LabelModel.self, forKey: .reviewsCount)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
open override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(stars, forKey: .stars)
|
||||
try container.encode(reviewsCount, forKey: .reviewsCount)
|
||||
}
|
||||
}
|
||||
@ -92,3 +92,4 @@
|
||||
"star" = "Star";
|
||||
"star_percent" = "%d percent progress";
|
||||
"stars_filled" = "%.1f out of %d stars";
|
||||
"review_text" = " reviews";
|
||||
|
||||
@ -70,3 +70,4 @@
|
||||
"star" = "Estrella";
|
||||
"star_percent" = "%@ porcentaje de progreso";
|
||||
"stars_filled" = "%.1f de %d estrellas";
|
||||
"review_text" = " críticas";
|
||||
|
||||
@ -75,3 +75,4 @@
|
||||
"star" = "Estrella";
|
||||
"star_percent" = "%@ porcentaje de progreso";
|
||||
"stars_filled" = "%.1f de %d estrellas";
|
||||
"review_text" = " críticas";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user