Apply new style to server-rules (#690)
This commit is contained in:
parent
3a00010d89
commit
dc91ebcd0a
|
@ -1906,8 +1906,6 @@
|
|||
DB1E347725F519300079D7DF /* PickServerItem.swift */,
|
||||
DB1E346725F518E20079D7DF /* CategoryPickerSection.swift */,
|
||||
DB1FD45925F27898004CFCFC /* CategoryPickerItem.swift */,
|
||||
DB0617F427855AB90030EE79 /* ServerRuleSection.swift */,
|
||||
DB0617FC27855BFE0030EE79 /* ServerRuleItem.swift */,
|
||||
DB0618022785A7100030EE79 /* RegisterSection.swift */,
|
||||
DB0618042785A73D0030EE79 /* RegisterItem.swift */,
|
||||
);
|
||||
|
@ -2203,6 +2201,8 @@
|
|||
DB7A9F922818F33C0016AF98 /* MastodonServerRulesViewController+Debug.swift */,
|
||||
DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */,
|
||||
DB0617FE27855D6C0030EE79 /* MastodonServerRulesViewModel+Diffable.swift */,
|
||||
DB0617F427855AB90030EE79 /* ServerRuleSection.swift */,
|
||||
DB0617FC27855BFE0030EE79 /* ServerRuleItem.swift */,
|
||||
);
|
||||
path = ServerRules;
|
||||
sourceTree = "<group>";
|
||||
|
|
|
@ -21,13 +21,13 @@ final class ServerRulesTableViewCell: UITableViewCell {
|
|||
|
||||
let ruleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold))
|
||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .regular))
|
||||
label.textColor = Asset.Colors.Label.primary.color
|
||||
label.numberOfLines = 0
|
||||
return label
|
||||
}()
|
||||
|
||||
let separalerLine: UIView = {
|
||||
let separatorLine: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = Asset.Theme.System.separator.color
|
||||
return view
|
||||
|
@ -54,7 +54,7 @@ extension ServerRulesTableViewCell {
|
|||
indexImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(indexImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
indexImageView.topAnchor.constraint(greaterThanOrEqualTo: contentView.topAnchor, constant: ServerRulesTableViewCell.margin),
|
||||
indexImageView.topAnchor.constraint(greaterThanOrEqualTo: contentView.topAnchor, constant: 11),
|
||||
indexImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
contentView.bottomAnchor.constraint(greaterThanOrEqualTo: indexImageView.bottomAnchor, constant: ServerRulesTableViewCell.margin),
|
||||
indexImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
|
@ -65,20 +65,20 @@ extension ServerRulesTableViewCell {
|
|||
ruleLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(ruleLabel)
|
||||
NSLayoutConstraint.activate([
|
||||
ruleLabel.topAnchor.constraint(greaterThanOrEqualTo: contentView.topAnchor, constant: ServerRulesTableViewCell.margin),
|
||||
ruleLabel.leadingAnchor.constraint(equalTo: indexImageView.trailingAnchor, constant: 16),
|
||||
ruleLabel.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
|
||||
contentView.bottomAnchor.constraint(greaterThanOrEqualTo: ruleLabel.bottomAnchor, constant: ServerRulesTableViewCell.margin),
|
||||
ruleLabel.topAnchor.constraint(greaterThanOrEqualTo: contentView.topAnchor, constant: 11),
|
||||
ruleLabel.leadingAnchor.constraint(equalTo: indexImageView.trailingAnchor, constant: 14),
|
||||
ruleLabel.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor, constant: 16),
|
||||
contentView.bottomAnchor.constraint(greaterThanOrEqualTo: ruleLabel.bottomAnchor, constant: 11),
|
||||
ruleLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
])
|
||||
|
||||
separalerLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separalerLine)
|
||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separalerLine.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
separalerLine.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
|
||||
separalerLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separalerLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1),
|
||||
separatorLine.leadingAnchor.constraint(equalTo: ruleLabel.leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)).priority(.required - 1),
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ final class MastodonServerRulesViewModel {
|
|||
guard i < 50 else {
|
||||
return NSAttributedString(string: "\(i)" + separatorString + rule.text.trimmingCharacters(in: .whitespacesAndNewlines) + "\n\n")
|
||||
}
|
||||
let imageName = String(i + 1) + ".circle.fill"
|
||||
let imageName = String(i + 1) + ".circle"
|
||||
let image = UIImage(systemName: imageName, withConfiguration: configuration)!
|
||||
let attachment = NSTextAttachment()
|
||||
attachment.image = image.withTintColor(Asset.Colors.Label.primary.color)
|
||||
attachment.image = image.withTintColor(Asset.Colors.brand.color)
|
||||
let imageAttribute = NSMutableAttributedString(attachment: attachment)
|
||||
imageAttribute.addAttributes([NSAttributedString.Key.baselineOffset : -1.5], range: NSRange(location: 0, length: imageAttribute.length))
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ extension ServerRuleSection {
|
|||
switch item {
|
||||
case .header(let domain):
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: OnboardingHeadlineTableViewCell.self), for: indexPath) as! OnboardingHeadlineTableViewCell
|
||||
cell.titleLabel.text = L10n.Scene.ServerRules.title
|
||||
cell.subTitleLabel.text = L10n.Scene.ServerRules.subtitle(domain)
|
||||
return cell
|
||||
case .rule(let ruleContext):
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ServerRulesTableViewCell.self), for: indexPath) as! ServerRulesTableViewCell
|
||||
cell.indexImageView.image = UIImage(systemName: "\(ruleContext.index + 1).circle.fill") ?? UIImage(systemName: "questionmark.circle.fill")
|
||||
cell.indexImageView.image = UIImage(systemName: "\(ruleContext.index + 1).circle") ?? UIImage(systemName: "questionmark.circle")
|
||||
cell.indexImageView.tintColor = Asset.Colors.brand.color
|
||||
cell.ruleLabel.text = ruleContext.rule.text
|
||||
return cell
|
||||
}
|
Loading…
Reference in New Issue