Skip to content

Commit a3fc4eb

Browse files
Merge pull request #18649 from wordpress-mobile/task/18552-qs-new-modal
Quick Start: Remove completed list from checklist modal
2 parents 0c52735 + e4e780d commit a3fc4eb

File tree

6 files changed

+79
-464
lines changed

6 files changed

+79
-464
lines changed
Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Gridicons
2+
import UIKit
23

34
class QuickStartChecklistCell: UITableViewCell {
45
@IBOutlet private var titleLabel: UILabel! {
@@ -31,60 +32,20 @@ class QuickStartChecklistCell: UITableViewCell {
3132
return WPDeviceIdentification.isiPhone() ? contentView.trailingAnchor : contentView.readableContentGuide.trailingAnchor
3233
}
3334

34-
public var completed = false {
35-
didSet {
36-
if completed {
37-
guard let titleText = tour?.title else {
38-
return
39-
}
40-
41-
titleLabel.attributedText = NSAttributedString(string: titleText,
42-
attributes: [.strikethroughStyle: 1,
43-
.foregroundColor: UIColor.neutral(.shade30)])
44-
// Overrides the existing accessibility hint in the tour property observer,
45-
// because users don't need the hint repeated to them after a task is completed.
46-
accessibilityHint = nil
47-
accessibilityLabel = tour?.titleMarkedCompleted
48-
descriptionLabel.textColor = .neutral(.shade30)
49-
iconView?.tintColor = .neutral(.shade30)
50-
} else {
51-
titleLabel.textColor = .text
52-
descriptionLabel.textColor = .textSubtle
53-
iconView?.tintColor = .listIcon
54-
}
55-
}
56-
}
57-
public var tour: QuickStartTour? {
58-
didSet {
59-
titleLabel.text = tour?.title
60-
descriptionLabel.text = tour?.description
61-
iconView?.image = tour?.icon.withRenderingMode(.alwaysTemplate)
62-
63-
if let hint = tour?.accessibilityHintText, !hint.isEmpty {
64-
accessibilityHint = hint
65-
}
66-
}
67-
}
68-
69-
public var lastRow: Bool = false {
70-
didSet {
71-
bottomStrokeLeading?.isActive = !lastRow
72-
}
73-
}
74-
75-
public var topSeparatorIsHidden: Bool = false {
76-
didSet {
77-
topSeparator?.isHidden = topSeparatorIsHidden
78-
}
79-
}
80-
81-
8235
override func awakeFromNib() {
8336
super.awakeFromNib()
8437
contentView.backgroundColor = .listForeground
8538
setupConstraints()
8639
}
8740

41+
func configure(tour: QuickStartTour, completed: Bool, topSeparatorIsHidden: Bool, lastRow: Bool) {
42+
setupColors(completed: completed)
43+
setupTitle(tour: tour, completed: completed)
44+
setupContent(tour: tour)
45+
setupAccessibility(tour: tour, completed: completed)
46+
setupSeperators(topSeparatorIsHidden: topSeparatorIsHidden, lastRow: lastRow)
47+
}
48+
8849
static let reuseIdentifier = "QuickStartChecklistCell"
8950
}
9051

@@ -104,4 +65,46 @@ private extension QuickStartChecklistCell {
10465
topSeparator.leadingAnchor.constraint(equalTo: contentViewLeadingAnchor).isActive = true
10566
topSeparator.trailingAnchor.constraint(equalTo: contentViewTrailingAnchor).isActive = true
10667
}
68+
69+
func setupTitle(tour: QuickStartTour, completed: Bool) {
70+
let strikeThroughStyle = completed ? 1 : 0
71+
let titleColor: UIColor = completed ? .neutral(.shade30) : .text
72+
titleLabel.attributedText = NSAttributedString(string: tour.title,
73+
attributes: [.strikethroughStyle: strikeThroughStyle,
74+
.foregroundColor: titleColor])
75+
}
76+
77+
func setupAccessibility(tour: QuickStartTour, completed: Bool) {
78+
if completed {
79+
// Overrides the existing accessibility hint in the tour property observer,
80+
// because users don't need the hint repeated to them after a task is completed.
81+
accessibilityHint = nil
82+
accessibilityLabel = tour.titleMarkedCompleted
83+
} else {
84+
let hint = tour.accessibilityHintText
85+
if !hint.isEmpty {
86+
accessibilityHint = hint
87+
}
88+
}
89+
}
90+
91+
func setupColors(completed: Bool) {
92+
if completed {
93+
descriptionLabel.textColor = .neutral(.shade30)
94+
iconView?.tintColor = .neutral(.shade30)
95+
} else {
96+
descriptionLabel.textColor = .textSubtle
97+
iconView?.tintColor = .listIcon
98+
}
99+
}
100+
101+
func setupContent(tour: QuickStartTour) {
102+
descriptionLabel.text = tour.description
103+
iconView?.image = tour.icon.withRenderingMode(.alwaysTemplate)
104+
}
105+
106+
func setupSeperators(topSeparatorIsHidden: Bool, lastRow: Bool) {
107+
bottomStrokeLeading?.isActive = !lastRow
108+
topSeparator?.isHidden = topSeparatorIsHidden
109+
}
107110
}

WordPress/Classes/ViewRelated/Blog/QuickStartChecklistHeader.swift

Lines changed: 0 additions & 119 deletions
This file was deleted.

WordPress/Classes/ViewRelated/Blog/QuickStartChecklistHeader.xib

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)