Compare commits
No commits in common. "176eb7c011897dba3869bafe0015dce7ecebaf04" and "b470ee6401f01bf31cf157fbcd603019072d59b5" have entirely different histories.
176eb7c011
...
b470ee6401
|
@ -22,7 +22,7 @@ class SuggestedProfileCardCollectionViewCell: UICollectionViewCell {
|
||||||
@IBOutlet weak var headerImageView: CachedImageView!
|
@IBOutlet weak var headerImageView: CachedImageView!
|
||||||
@IBOutlet weak var avatarContainerView: UIView!
|
@IBOutlet weak var avatarContainerView: UIView!
|
||||||
@IBOutlet weak var avatarImageView: CachedImageView!
|
@IBOutlet weak var avatarImageView: CachedImageView!
|
||||||
@IBOutlet weak var displayNameLabel: AccountDisplayNameLabel!
|
@IBOutlet weak var displayAndUserNameLabel: AccountDisplayNameLabel!
|
||||||
@IBOutlet weak var usernameLabel: UILabel!
|
@IBOutlet weak var usernameLabel: UILabel!
|
||||||
@IBOutlet weak var noteTextView: StatusContentTextView!
|
@IBOutlet weak var noteTextView: StatusContentTextView!
|
||||||
@IBOutlet weak var suggestionSourceButton: UIButton!
|
@IBOutlet weak var suggestionSourceButton: UIButton!
|
||||||
|
@ -49,8 +49,8 @@ class SuggestedProfileCardCollectionViewCell: UICollectionViewCell {
|
||||||
avatarImageView.layer.masksToBounds = true
|
avatarImageView.layer.masksToBounds = true
|
||||||
avatarImageView.layer.cornerCurve = .continuous
|
avatarImageView.layer.cornerCurve = .continuous
|
||||||
|
|
||||||
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
displayAndUserNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
||||||
displayNameLabel.adjustsFontForContentSizeCategory = true
|
displayAndUserNameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
usernameLabel.font = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 15, weight: .light))
|
usernameLabel.font = UIFontMetrics.default.scaledFont(for: .systemFont(ofSize: 15, weight: .light))
|
||||||
usernameLabel.adjustsFontForContentSizeCategory = true
|
usernameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
@ -96,7 +96,7 @@ class SuggestedProfileCardCollectionViewCell: UICollectionViewCell {
|
||||||
private func updateUIForPreferences(account: AccountMO) {
|
private func updateUIForPreferences(account: AccountMO) {
|
||||||
avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView)
|
avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView)
|
||||||
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView)
|
||||||
displayNameLabel.updateForAccountDisplayName(account: account)
|
displayAndUserNameLabel.updateForAccountDisplayName(account: account)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unneeded on visionOS since there is no light/dark mode
|
// Unneeded on visionOS since there is no light/dark mode
|
||||||
|
|
|
@ -135,11 +135,12 @@ private struct MockStatusCardView: UIViewRepresentable {
|
||||||
func makeUIView(context: Context) -> StatusCardView {
|
func makeUIView(context: Context) -> StatusCardView {
|
||||||
let view = StatusCardView()
|
let view = StatusCardView()
|
||||||
view.isUserInteractionEnabled = false
|
view.isUserInteractionEnabled = false
|
||||||
let card = StatusCardView.CardData(
|
let card = Card(
|
||||||
url: WebURL("https://vaccor.space/tusker")!,
|
url: WebURL("https://vaccor.space/tusker")!,
|
||||||
image: WebURL("https://vaccor.space/tusker/img/icon.png")!,
|
|
||||||
title: "Tusker",
|
title: "Tusker",
|
||||||
description: "Tusker is an iOS app for Mastodon"
|
description: "Tusker is an iOS app for Mastodon",
|
||||||
|
image: WebURL("https://vaccor.space/tusker/img/icon.png")!,
|
||||||
|
kind: .link
|
||||||
)
|
)
|
||||||
view.updateUI(card: card, sensitive: false)
|
view.updateUI(card: card, sensitive: false)
|
||||||
return view
|
return view
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import SafariServices
|
import SafariServices
|
||||||
import WebURL
|
|
||||||
import WebURLFoundationExtras
|
import WebURLFoundationExtras
|
||||||
import HTMLStreamer
|
import HTMLStreamer
|
||||||
|
|
||||||
|
@ -19,7 +18,7 @@ class StatusCardView: UIView {
|
||||||
weak var actionProvider: MenuActionProvider?
|
weak var actionProvider: MenuActionProvider?
|
||||||
|
|
||||||
private var statusID: String?
|
private var statusID: String?
|
||||||
private(set) var card: CardData?
|
private(set) var card: Card?
|
||||||
|
|
||||||
private static let activeBackgroundColor = UIColor.secondarySystemFill
|
private static let activeBackgroundColor = UIColor.secondarySystemFill
|
||||||
private static let inactiveBackgroundColor = UIColor.secondarySystemBackground
|
private static let inactiveBackgroundColor = UIColor.secondarySystemBackground
|
||||||
|
@ -164,22 +163,20 @@ class StatusCardView: UIView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateUI(status: StatusMO) {
|
func updateUI(status: StatusMO) {
|
||||||
let newData = status.card.map { CardData(card: $0) }
|
guard status.id != statusID else {
|
||||||
guard self.card != newData else {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.card = newData
|
self.card = status.card
|
||||||
self.statusID = status.id
|
self.statusID = status.id
|
||||||
|
|
||||||
guard let newData else {
|
guard let card = status.card else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUI(card: newData, sensitive: status.sensitive)
|
updateUI(card: card, sensitive: status.sensitive)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is internal for use by MockStatusView
|
func updateUI(card: Card, sensitive: Bool) {
|
||||||
func updateUI(card: CardData, sensitive: Bool) {
|
|
||||||
if let image = card.image {
|
if let image = card.image {
|
||||||
if sensitive {
|
if sensitive {
|
||||||
if let blurhash = card.blurhash {
|
if let blurhash = card.blurhash {
|
||||||
|
@ -246,30 +243,6 @@ class StatusCardView: UIView {
|
||||||
hStack.backgroundColor = StatusCardView.inactiveBackgroundColor
|
hStack.backgroundColor = StatusCardView.inactiveBackgroundColor
|
||||||
setNeedsDisplay()
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CardData: Equatable {
|
|
||||||
let url: WebURL
|
|
||||||
let image: WebURL?
|
|
||||||
let title: String
|
|
||||||
let description: String
|
|
||||||
let blurhash: String?
|
|
||||||
|
|
||||||
init(card: Card) {
|
|
||||||
self.url = card.url
|
|
||||||
self.image = card.image
|
|
||||||
self.title = card.title
|
|
||||||
self.description = card.description
|
|
||||||
self.blurhash = card.blurhash
|
|
||||||
}
|
|
||||||
|
|
||||||
init(url: WebURL, image: WebURL? = nil, title: String, description: String, blurhash: String? = nil) {
|
|
||||||
self.url = url
|
|
||||||
self.image = image
|
|
||||||
self.title = title
|
|
||||||
self.description = description
|
|
||||||
self.blurhash = blurhash
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue