Show visibility icon also in notification view
This commit is contained in:
parent
00a8c7523b
commit
e397191773
|
@ -42,6 +42,8 @@ extension NotificationView {
|
||||||
|
|
||||||
@Published public var timestamp: Date?
|
@Published public var timestamp: Date?
|
||||||
|
|
||||||
|
@Published public var visibility: MastodonVisibility = .public
|
||||||
|
|
||||||
@Published public var followRequestState = MastodonFollowRequestState(state: .none)
|
@Published public var followRequestState = MastodonFollowRequestState(state: .none)
|
||||||
@Published public var transientFollowRequestState = MastodonFollowRequestState(state: .none)
|
@Published public var transientFollowRequestState = MastodonFollowRequestState(state: .none)
|
||||||
|
|
||||||
|
@ -121,6 +123,12 @@ extension NotificationView.ViewModel {
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
|
$visibility
|
||||||
|
.sink { visibility in
|
||||||
|
notificationView.visibilityIconImageView.image = visibility.image
|
||||||
|
}
|
||||||
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
// notification type indicator
|
// notification type indicator
|
||||||
$notificationIndicatorText
|
$notificationIndicatorText
|
||||||
.sink { text in
|
.sink { text in
|
||||||
|
|
|
@ -91,6 +91,20 @@ public final class NotificationView: UIView {
|
||||||
// timestamp
|
// timestamp
|
||||||
public let dateLabel = MetaLabel(style: .statusUsername)
|
public let dateLabel = MetaLabel(style: .statusUsername)
|
||||||
|
|
||||||
|
public let dateTrailingDotLabel: MetaLabel = {
|
||||||
|
let label = MetaLabel(style: .statusUsername)
|
||||||
|
label.configure(content: PlaintextMetaContent(string: "·"))
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
|
let visibilityIconImageView: UIImageView = {
|
||||||
|
let imageView = UIImageView()
|
||||||
|
imageView.tintColor = Asset.Colors.Label.secondary.color
|
||||||
|
imageView.contentMode = .scaleAspectFit
|
||||||
|
imageView.image = Asset.Scene.Compose.earth.image.withRenderingMode(.alwaysTemplate)
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
|
|
||||||
public let menuButton: UIButton = {
|
public let menuButton: UIButton = {
|
||||||
let button = HitTestExpandedButton(type: .system)
|
let button = HitTestExpandedButton(type: .system)
|
||||||
button.tintColor = Asset.Colors.Label.secondary.color
|
button.tintColor = Asset.Colors.Label.secondary.color
|
||||||
|
@ -272,16 +286,32 @@ extension NotificationView {
|
||||||
authrMetaContainer.setCustomSpacing(4, after: authorSecondaryMetaContainer)
|
authrMetaContainer.setCustomSpacing(4, after: authorSecondaryMetaContainer)
|
||||||
|
|
||||||
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
authorSecondaryMetaContainer.addArrangedSubview(authorUsernameLabel)
|
||||||
authorUsernameLabel.setContentHuggingPriority(.required - 8, for: .horizontal)
|
authorUsernameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||||
authorUsernameLabel.setContentCompressionResistancePriority(.required - 8, for: .horizontal)
|
authorUsernameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||||
|
|
||||||
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
authorSecondaryMetaContainer.addArrangedSubview(usernameTrialingDotLabel)
|
||||||
usernameTrialingDotLabel.setContentHuggingPriority(.required - 2, for: .horizontal)
|
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
usernameTrialingDotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal)
|
|
||||||
authorSecondaryMetaContainer.addArrangedSubview(dateLabel)
|
authorSecondaryMetaContainer.addArrangedSubview(dateLabel)
|
||||||
dateLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
dateLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||||
dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
dateLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
||||||
|
|
||||||
|
authorSecondaryMetaContainer.addArrangedSubview(dateTrailingDotLabel)
|
||||||
|
dateTrailingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
|
||||||
|
authorSecondaryMetaContainer.addArrangedSubview(dateTrailingDotLabel)
|
||||||
|
dateTrailingDotLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
|
||||||
|
authorSecondaryMetaContainer.addArrangedSubview(visibilityIconImageView)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
visibilityIconImageView.heightAnchor.constraint(equalTo: authorUsernameLabel.heightAnchor),
|
||||||
|
visibilityIconImageView.widthAnchor.constraint(equalTo: visibilityIconImageView.heightAnchor),
|
||||||
|
])
|
||||||
|
|
||||||
authorSecondaryMetaContainer.addArrangedSubview(UIView())
|
authorSecondaryMetaContainer.addArrangedSubview(UIView())
|
||||||
|
|
||||||
|
authorSecondaryMetaContainer.setCustomSpacing(0, after: visibilityIconImageView)
|
||||||
|
|
||||||
// authorContainerViewBottomPaddingView
|
// authorContainerViewBottomPaddingView
|
||||||
authorContainerViewBottomPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
authorContainerViewBottomPaddingView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
containerStackView.addArrangedSubview(authorContainerViewBottomPaddingView)
|
containerStackView.addArrangedSubview(authorContainerViewBottomPaddingView)
|
||||||
|
|
Loading…
Reference in New Issue