Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 82824f7

Browse files
author
Krzysztof Jan Modras
authored
Update Privacy Dashboard design - fix #758 (#765)
1 parent 98fa9b6 commit 82824f7

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

UserAgent/Views/Privacy Indicator/PrivacyDashboardUtils.swift

+4-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ enum PrivacyDashboardUtils {
1818
private func columns(dot: UIView, label: UILabel, number: UILabel) {
1919
self.spacing = 5
2020
self.alignment = .top
21-
self.distribution = .fill
21+
self.distribution = .fillProportionally
2222
[dot, label, number].forEach { self.addArrangedSubview($0) }
2323
number.alpha = 0.7
24-
25-
label.snp.makeConstraints { make in
26-
make.width.lessThanOrEqualTo(100)
27-
}
24+
number.textAlignment = .right
2825
number.snp.makeConstraints { make in
2926
// space for keeping three digits [18, 25]
3027
make.width.greaterThanOrEqualTo(18)
@@ -61,9 +58,9 @@ enum PrivacyDashboardUtils {
6158
}
6259
private func setupForStat() {
6360
self.textColor = Theme.textField.textAndTint
64-
self.numberOfLines = 0
61+
self.numberOfLines = 2
62+
self.lineBreakMode = .byWordWrapping
6563
self.setContentCompressionResistancePriority(.required, for: .horizontal)
66-
self.font = UIFont.preferredFont(forTextStyle: .footnote)
6764
}
6865
private func setupForDomain() {
6966
self.textColor = UIColor.DarkGreen

UserAgent/Views/Privacy Indicator/PrivacyDashboardView.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class PrivacyDashboardView: UIView, PhotonCustomViewCellContent {
88
override init(frame: CGRect) {
99
super.init(frame: frame)
1010
self.snp.makeConstraints { make in
11-
// This fixes a bug
12-
// where the tableview would squash elements inside PrivacyDashboardView
13-
make.height.greaterThanOrEqualTo(UIScreen.main.bounds.height * 0.3)
11+
make.height.greaterThanOrEqualTo(0)
1412
}
1513
self.backgroundColor = UIColor.clear
1614
}

UserAgent/Views/Privacy Indicator/PrivacyIndicatorView.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ enum PrivacyIndicatorTransformation {
1414
let color = UIColor(named: "PrivacyIndicatorBackground")!
1515
return (arcs: [(color, 1)], strike: (color, 1))
1616
}
17-
let arcs: [(UIColor, Int)] = WTMCategory.statsDict(from: stats)
18-
.map { (key, value) in (key.color, value) }
17+
let arcsWithKeys: [(UIColor, Int, WTMCategory)] = WTMCategory.statsDict(from: stats)
18+
.map { (key, value) in (key.color, value, key) }
1919
.filter { $0.1 != 0 }
20-
.sorted(by: { $1.1 < $0.1 })
20+
.sorted(by: { String(describing: $1.2) < String(describing: $0.2) })
21+
let arcs: [(UIColor, Int)] = arcsWithKeys.map { (color, value, key) in (color, value) }
2122
return (arcs: arcs, strike: nil)
2223
}
2324
}

Widgets/PrivacyIndicator/Canvas.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fileprivate extension PrivacyIndicator.CanvasView {
8989
let maxX = self.bounds.maxX
9090
let maxY = self.bounds.maxY
9191
let radius = width * 3 / 8
92-
let diagonal = sqrt(3 * width * width)
92+
let diagonal = sqrt(2 * width * width)
9393
let distance = (diagonal / 2) - radius
9494
let vDistance = sqrt((distance * distance) / 2)
9595

0 commit comments

Comments
 (0)