Compare commits
No commits in common. "88cfbfb1f3adb27c3b21edf2d9619b1e20c9d6da" and "b5c8a38b9b90092914a2c05c0cc87bac6b93aa5a" have entirely different histories.
88cfbfb1f3
...
b5c8a38b9b
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class StatusState: Equatable {
|
public class StatusState: Equatable, Hashable {
|
||||||
public var collapsible: Bool?
|
public var collapsible: Bool?
|
||||||
public var collapsed: Bool?
|
public var collapsed: Bool?
|
||||||
|
|
||||||
|
|
|
@ -122,27 +122,6 @@ extension TrendingStatusesViewController {
|
||||||
case status(id: String, state: StatusState)
|
case status(id: String, state: StatusState)
|
||||||
case loadingIndicator
|
case loadingIndicator
|
||||||
|
|
||||||
static func ==(lhs: Item, rhs: Item) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case (.status(id: let a, state: _), .status(id: let b, state: _)):
|
|
||||||
return a == b
|
|
||||||
case (.loadingIndicator, .loadingIndicator):
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func hash(into hasher: inout Hasher) {
|
|
||||||
switch self {
|
|
||||||
case .status(id: let id, state: _):
|
|
||||||
hasher.combine(0)
|
|
||||||
hasher.combine(id)
|
|
||||||
case .loadingIndicator:
|
|
||||||
hasher.combine(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var hideSeparators: Bool {
|
var hideSeparators: Bool {
|
||||||
if case .loadingIndicator = self {
|
if case .loadingIndicator = self {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct AdvancedPrefsView : View {
|
||||||
}
|
}
|
||||||
|
|
||||||
var formattingFooter: some View {
|
var formattingFooter: some View {
|
||||||
var s: AttributedString = "This option is only supported with Pleroma and some compatible Mastodon instances (such as Glitch).\n"
|
var s: AttributedString = "This option is only supported with Pleroma and some compatible Mastodon instances (such as Glitch or Hometown).\n"
|
||||||
if let account = LocalData.shared.getMostRecentAccount() {
|
if let account = LocalData.shared.getMostRecentAccount() {
|
||||||
let mastodonController = MastodonController.getForAccount(account)
|
let mastodonController = MastodonController.getForAccount(account)
|
||||||
// shouldn't need to load the instance here, because loading it is kicked off my the scene delegate
|
// shouldn't need to load the instance here, because loading it is kicked off my the scene delegate
|
||||||
|
|
|
@ -16,20 +16,10 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
|
|
||||||
// MARK: Subviews
|
// MARK: Subviews
|
||||||
|
|
||||||
private lazy var rebloggerLabel = EmojiLabel().configure {
|
private lazy var reblogLabel = EmojiLabel().configure {
|
||||||
$0.textColor = .secondaryLabel
|
$0.textColor = .secondaryLabel
|
||||||
$0.font = .preferredFont(forTextStyle: .body)
|
$0.font = .preferredFont(forTextStyle: .body)
|
||||||
$0.adjustsFontForContentSizeCategory = true
|
$0.adjustsFontForContentSizeCategory = true
|
||||||
}
|
|
||||||
private let reblogIcon = UIImageView(image: UIImage(systemName: "repeat")).configure {
|
|
||||||
$0.tintColor = .secondaryLabel
|
|
||||||
}
|
|
||||||
private lazy var reblogHStack = UIStackView(arrangedSubviews: [
|
|
||||||
reblogIcon,
|
|
||||||
rebloggerLabel,
|
|
||||||
]).configure {
|
|
||||||
$0.axis = .horizontal
|
|
||||||
$0.spacing = 8
|
|
||||||
// this needs to have a higher priorty than the content container's zero height constraint
|
// this needs to have a higher priorty than the content container's zero height constraint
|
||||||
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
$0.isUserInteractionEnabled = true
|
$0.isUserInteractionEnabled = true
|
||||||
|
@ -275,12 +265,12 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
for subview in [reblogHStack, mainContainer, actionsContainer] {
|
for subview in [reblogLabel, mainContainer, actionsContainer] {
|
||||||
subview.translatesAutoresizingMaskIntoConstraints = false
|
subview.translatesAutoresizingMaskIntoConstraints = false
|
||||||
contentView.addSubview(subview)
|
contentView.addSubview(subview)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainContainerTopToReblogLabelConstraint = mainContainer.topAnchor.constraint(equalTo: reblogHStack.bottomAnchor, constant: 4)
|
mainContainerTopToReblogLabelConstraint = mainContainer.topAnchor.constraint(equalTo: reblogLabel.bottomAnchor, constant: 4)
|
||||||
mainContainerTopToSelfConstraint = mainContainer.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8)
|
mainContainerTopToSelfConstraint = mainContainer.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8)
|
||||||
mainContainerBottomToActionsConstraint = mainContainer.bottomAnchor.constraint(equalTo: actionsContainer.topAnchor, constant: -4)
|
mainContainerBottomToActionsConstraint = mainContainer.bottomAnchor.constraint(equalTo: actionsContainer.topAnchor, constant: -4)
|
||||||
mainContainerBottomToSelfConstraint = mainContainer.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6)
|
mainContainerBottomToSelfConstraint = mainContainer.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -6)
|
||||||
|
@ -291,9 +281,9 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
// why is this 4 but the mainContainerTopSelfConstraint constant 8? because this looks more balanced
|
// why is this 4 but the mainContainerTopSelfConstraint constant 8? because this looks more balanced
|
||||||
reblogHStack.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 4),
|
reblogLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 4),
|
||||||
rebloggerLabel.leadingAnchor.constraint(equalTo: contentVStack.leadingAnchor),
|
reblogLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16),
|
||||||
reblogHStack.trailingAnchor.constraint(lessThanOrEqualTo: contentView.trailingAnchor, constant: -16),
|
reblogLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16),
|
||||||
|
|
||||||
mainContainer.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16),
|
mainContainer.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16),
|
||||||
mainContainer.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16),
|
mainContainer.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16),
|
||||||
|
@ -409,7 +399,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
if let rebloggedStatus = status.reblog {
|
if let rebloggedStatus = status.reblog {
|
||||||
reblogStatusID = statusID
|
reblogStatusID = statusID
|
||||||
rebloggerID = status.account.id
|
rebloggerID = status.account.id
|
||||||
reblogHStack.isHidden = false
|
reblogLabel.isHidden = false
|
||||||
mainContainerTopToReblogLabelConstraint.isActive = true
|
mainContainerTopToReblogLabelConstraint.isActive = true
|
||||||
mainContainerTopToSelfConstraint.isActive = false
|
mainContainerTopToSelfConstraint.isActive = false
|
||||||
updateRebloggerLabel(reblogger: status.account)
|
updateRebloggerLabel(reblogger: status.account)
|
||||||
|
@ -418,7 +408,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
} else {
|
} else {
|
||||||
reblogStatusID = nil
|
reblogStatusID = nil
|
||||||
rebloggerID = nil
|
rebloggerID = nil
|
||||||
reblogHStack.isHidden = true
|
reblogLabel.isHidden = true
|
||||||
mainContainerTopToReblogLabelConstraint.isActive = false
|
mainContainerTopToReblogLabelConstraint.isActive = false
|
||||||
mainContainerTopToSelfConstraint.isActive = true
|
mainContainerTopToSelfConstraint.isActive = true
|
||||||
}
|
}
|
||||||
|
@ -502,11 +492,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
|
|
||||||
private func updateRebloggerLabel(reblogger: AccountMO) {
|
private func updateRebloggerLabel(reblogger: AccountMO) {
|
||||||
if Preferences.shared.hideCustomEmojiInUsernames {
|
if Preferences.shared.hideCustomEmojiInUsernames {
|
||||||
rebloggerLabel.text = "\(reblogger.displayNameWithoutCustomEmoji) reblogged"
|
reblogLabel.text = "Reblogged by \(reblogger.displayNameWithoutCustomEmoji)"
|
||||||
rebloggerLabel.removeEmojis()
|
reblogLabel.removeEmojis()
|
||||||
} else {
|
} else {
|
||||||
rebloggerLabel.text = "\(reblogger.displayOrUserName) reblogged"
|
reblogLabel.text = "Reblogged by \(reblogger.displayOrUserName)"
|
||||||
rebloggerLabel.setEmojis(reblogger.emojis, identifier: reblogger.id)
|
reblogLabel.setEmojis(reblogger.emojis, identifier: reblogger.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue