Adjust fonts, icon and colors for updated verified-design (IOS-130)
This commit is contained in:
parent
ad91b45a97
commit
59755b6d70
|
@ -35,28 +35,26 @@ extension ProfileFieldSection {
|
|||
let fieldCellRegistration = UICollectionView.CellRegistration<ProfileFieldCollectionViewCell, ProfileFieldItem> { cell, indexPath, item in
|
||||
let key, value: String
|
||||
let emojiMeta: MastodonContent.Emojis
|
||||
let verified: Bool
|
||||
|
||||
switch item {
|
||||
case .field(field: let field):
|
||||
key = field.name.value
|
||||
value = field.value.value
|
||||
emojiMeta = field.emojiMeta
|
||||
verified = field.verifiedAt.value != nil
|
||||
case .createdAt(date: let date):
|
||||
key = L10n.Scene.Profile.Fields.joined
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium
|
||||
formatter.timeStyle = .none
|
||||
formatter.timeZone = TimeZone(identifier: "UTC")
|
||||
value = formatter.string(from: date)
|
||||
emojiMeta = [:]
|
||||
verified = false
|
||||
default: return
|
||||
case .field(field: let field):
|
||||
key = field.name.value
|
||||
value = field.value.value
|
||||
emojiMeta = field.emojiMeta
|
||||
|
||||
case .createdAt(date: let date):
|
||||
key = L10n.Scene.Profile.Fields.joined
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium
|
||||
formatter.timeStyle = .none
|
||||
formatter.timeZone = TimeZone(identifier: "UTC")
|
||||
value = formatter.string(from: date)
|
||||
emojiMeta = [:]
|
||||
case .addEntry, .editField(_): return
|
||||
}
|
||||
|
||||
// set key
|
||||
let keyColor = verified ? Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color : Asset.Colors.Label.secondary.color
|
||||
let keyColor = Asset.Colors.Label.secondary.color
|
||||
do {
|
||||
let mastodonContent = MastodonContent(content: key, emojis: emojiMeta)
|
||||
let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
|
||||
|
@ -69,7 +67,7 @@ extension ProfileFieldSection {
|
|||
}
|
||||
|
||||
// set value
|
||||
let linkColor = verified ? Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color : Asset.Colors.Brand.blurple.color
|
||||
let linkColor = Asset.Colors.Brand.blurple.color
|
||||
do {
|
||||
let mastodonContent = MastodonContent(content: value, emojis: emojiMeta)
|
||||
let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
|
||||
|
@ -83,7 +81,7 @@ extension ProfileFieldSection {
|
|||
|
||||
// set background
|
||||
var backgroundConfiguration = UIBackgroundConfiguration.listPlainCell()
|
||||
backgroundConfiguration.backgroundColor = verified ? Asset.Scene.Profile.About.bioAboutFieldVerifiedBackground.color : UIColor.secondarySystemBackground
|
||||
backgroundConfiguration.backgroundColor = UIColor.secondarySystemBackground
|
||||
cell.backgroundConfiguration = backgroundConfiguration
|
||||
|
||||
// set checkmark and edit menu label
|
||||
|
|
|
@ -25,7 +25,7 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell {
|
|||
let keyMetaLabel = MetaLabel(style: .profileFieldName)
|
||||
let valueMetaLabel = MetaLabel(style: .profileFieldValue)
|
||||
|
||||
let checkmark = UIImageView(image: Asset.Editing.checkmark.image.withRenderingMode(.alwaysTemplate))
|
||||
let checkmark = UIImageView(image: UIImage(systemName: "checkmark.seal"))
|
||||
var checkmarkPopoverString: String? = nil;
|
||||
let tapGesture = UITapGestureRecognizer();
|
||||
var editMenuInteraction: UIEditMenuInteraction!
|
||||
|
@ -55,7 +55,7 @@ extension ProfileFieldCollectionViewCell {
|
|||
editMenuInteraction = UIEditMenuInteraction(delegate: self)
|
||||
|
||||
// Setup colors
|
||||
checkmark.tintColor = Asset.Scene.Profile.About.bioAboutFieldVerifiedText.color;
|
||||
checkmark.tintColor = Asset.Colors.Brand.blurple.color
|
||||
|
||||
// Setup gestures
|
||||
tapGesture.addTarget(self, action: #selector(ProfileFieldCollectionViewCell.didTapCheckmark(_:)))
|
||||
|
@ -145,24 +145,6 @@ extension ProfileFieldCollectionViewCell {
|
|||
}
|
||||
}
|
||||
|
||||
// UIMenuController boilerplate
|
||||
@available(iOS, deprecated: 16, message: "Can be removed when target version is >=16 -- boilerplate to maintain compatibility with UIMenuController")
|
||||
extension ProfileFieldCollectionViewCell {
|
||||
override var canBecomeFirstResponder: Bool { true }
|
||||
|
||||
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
|
||||
if action == #selector(dismissVerifiedMenu) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.canPerformAction(action, withSender: sender)
|
||||
}
|
||||
|
||||
@objc public func dismissVerifiedMenu() {
|
||||
UIMenuController.shared.hideMenu()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - MetaLabelDelegate
|
||||
extension ProfileFieldCollectionViewCell: MetaLabelDelegate {
|
||||
func metaLabel(_ metaLabel: MetaLabel, didSelectMeta meta: Meta) {
|
||||
|
|
|
@ -14,18 +14,7 @@ final class ProfileFieldCollectionViewHeaderFooterView: UICollectionReusableView
|
|||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension ProfileFieldCollectionViewHeaderFooterView {
|
||||
private func _init() {
|
||||
|
||||
}
|
||||
required init?(coder: NSCoder) { fatalError("Not implemented") }
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ extension MetaLabel {
|
|||
textColor = Asset.Colors.Label.secondary.color
|
||||
|
||||
case .profileFieldName:
|
||||
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 13, weight: .semibold))
|
||||
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular))
|
||||
textColor = Asset.Colors.Label.secondary.color
|
||||
|
||||
case .profileFieldValue:
|
||||
|
|
Loading…
Reference in New Issue