diff --git a/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib b/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib
index 1437e6eb..b89047f4 100644
--- a/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib
+++ b/Tusker/Views/Status/ConversationMainStatusTableViewCell.xib
@@ -102,9 +102,9 @@
-
+
-
+
diff --git a/Tusker/Views/Status/StatusCardView.swift b/Tusker/Views/Status/StatusCardView.swift
index 19c44e8e..6868f3fd 100644
--- a/Tusker/Views/Status/StatusCardView.swift
+++ b/Tusker/Views/Status/StatusCardView.swift
@@ -25,8 +25,10 @@ class StatusCardView: UIView {
private var imageRequest: ImageCache.Request?
private var isGrayscale = false
+ private var hStack: UIStackView!
private var titleLabel: UILabel!
private var descriptionLabel: UILabel!
+ private var domainLabel: UILabel!
private var imageView: UIImageView!
private var placeholderImageView: UIImageView!
@@ -41,11 +43,13 @@ class StatusCardView: UIView {
}
private func commonInit() {
- self.clipsToBounds = true
- self.layer.cornerRadius = 6.5
- self.layer.borderWidth = 1
- self.layer.borderColor = UIColor.lightGray.cgColor
- self.backgroundColor = inactiveBackgroundColor
+// self.clipsToBounds = true
+// self.layer.borderWidth = 0.5
+// self.layer.borderColor = UIColor.lightGray.cgColor
+ self.layer.shadowColor = UIColor.black.cgColor
+ self.layer.shadowRadius = 5
+ self.layer.shadowOpacity = 0.2
+ self.layer.shadowOffset = .zero
self.addInteraction(UIContextMenuInteraction(delegate: self))
@@ -60,9 +64,16 @@ class StatusCardView: UIView {
descriptionLabel.numberOfLines = 2
descriptionLabel.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
+ domainLabel = UILabel()
+ domainLabel.font = .preferredFont(forTextStyle: .caption2)
+ domainLabel.adjustsFontForContentSizeCategory = true
+ domainLabel.numberOfLines = 1
+ domainLabel.textColor = .tintColor
+
let vStack = UIStackView(arrangedSubviews: [
titleLabel,
- descriptionLabel
+ descriptionLabel,
+ domainLabel,
])
vStack.axis = .vertical
vStack.alignment = .leading
@@ -73,15 +84,23 @@ class StatusCardView: UIView {
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
- let hStack = UIStackView(arrangedSubviews: [
+ let spacer = UIView()
+ spacer.backgroundColor = .clear
+
+ hStack = UIStackView(arrangedSubviews: [
imageView,
- vStack
+ vStack,
+ spacer,
])
hStack.translatesAutoresizingMaskIntoConstraints = false
hStack.axis = .horizontal
hStack.alignment = .center
hStack.distribution = .fill
hStack.spacing = 4
+ hStack.clipsToBounds = true
+ hStack.layer.borderWidth = 0.5
+ hStack.layer.borderColor = UIColor.lightGray.cgColor
+ hStack.backgroundColor = inactiveBackgroundColor
addSubview(hStack)
@@ -98,8 +117,10 @@ class StatusCardView: UIView {
vStack.heightAnchor.constraint(equalTo: heightAnchor, constant: -8),
+ spacer.widthAnchor.constraint(equalToConstant: 4),
+
hStack.leadingAnchor.constraint(equalTo: leadingAnchor),
- hStack.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -4),
+ hStack.trailingAnchor.constraint(equalTo: trailingAnchor),
hStack.topAnchor.constraint(equalTo: topAnchor),
hStack.bottomAnchor.constraint(equalTo: bottomAnchor),
@@ -112,6 +133,11 @@ class StatusCardView: UIView {
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPreferences), name: .preferencesChanged, object: nil)
}
+ override func layoutSubviews() {
+ super.layoutSubviews()
+ hStack.layer.cornerRadius = 0.1 * bounds.height
+ }
+
func updateUI(status: StatusMO) {
guard status.id != statusID else {
return
@@ -135,6 +161,13 @@ class StatusCardView: UIView {
let description = card.description.trimmingCharacters(in: .whitespacesAndNewlines)
descriptionLabel.text = description
descriptionLabel.isHidden = description.isEmpty
+
+ if let host = card.url.host {
+ domainLabel.text = host.serialized
+ domainLabel.isHidden = false
+ } else {
+ domainLabel.isHidden = true
+ }
}
@objc private func updateUIForPreferences() {
@@ -201,7 +234,7 @@ class StatusCardView: UIView {
}
override func touchesBegan(_ touches: Set, with event: UIEvent?) {
- backgroundColor = activeBackgroundColor
+ hStack.backgroundColor = activeBackgroundColor
setNeedsDisplay()
}
@@ -209,7 +242,7 @@ class StatusCardView: UIView {
}
override func touchesEnded(_ touches: Set, with event: UIEvent?) {
- backgroundColor = inactiveBackgroundColor
+ hStack.backgroundColor = inactiveBackgroundColor
setNeedsDisplay()
if let card = card, let delegate = navigationDelegate {
@@ -218,7 +251,7 @@ class StatusCardView: UIView {
}
override func touchesCancelled(_ touches: Set, with event: UIEvent?) {
- backgroundColor = inactiveBackgroundColor
+ hStack.backgroundColor = inactiveBackgroundColor
setNeedsDisplay()
}
@@ -238,6 +271,12 @@ extension StatusCardView: UIContextMenuInteractionDelegate {
}
}
+ func contextMenuInteraction(_ interaction: UIContextMenuInteraction, previewForHighlightingMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? {
+ let params = UIPreviewParameters()
+ params.visiblePath = UIBezierPath(roundedRect: hStack.bounds, cornerRadius: hStack.layer.cornerRadius)
+ return UITargetedPreview(view: hStack, parameters: params)
+ }
+
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
if let viewController = animator.previewViewController,
let delegate = navigationDelegate {
diff --git a/Tusker/Views/Status/StatusContentContainer.swift b/Tusker/Views/Status/StatusContentContainer.swift
index e60fa6cf..2ea5dab7 100644
--- a/Tusker/Views/Status/StatusContentContainer.swift
+++ b/Tusker/Views/Status/StatusContentContainer.swift
@@ -20,7 +20,7 @@ class StatusContentContainer: UIView {
let cardView = StatusCardView().configure {
NSLayoutConstraint.activate([
- $0.heightAnchor.constraint(equalToConstant: 65),
+ $0.heightAnchor.constraint(equalToConstant: 90),
])
}
diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.xib b/Tusker/Views/Status/TimelineStatusTableViewCell.xib
index 3a19fff3..1ce14e1d 100644
--- a/Tusker/Views/Status/TimelineStatusTableViewCell.xib
+++ b/Tusker/Views/Status/TimelineStatusTableViewCell.xib
@@ -132,9 +132,9 @@
-
+
-
+