diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj
index e92678855..1b6b3747f 100644
--- a/Mastodon.xcodeproj/project.pbxproj
+++ b/Mastodon.xcodeproj/project.pbxproj
@@ -5715,7 +5715,7 @@
repositoryURL = "https://github.com/TwidereProject/MetaTextKit.git";
requirement = {
kind = exactVersion;
- version = 2.1.0;
+ version = 2.1.1;
};
};
DB0E2D2C26833FF600865C3C /* XCRemoteSwiftPackageReference "Nuke-FLAnimatedImage-Plugin" */ = {
diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
index 22e216ce0..fc6bfd208 100644
--- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -12,7 +12,7 @@
CoreDataStack.xcscheme_^#shared#^_
orderHint
- 33
+ 32
Mastodon - ASDK.xcscheme_^#shared#^_
@@ -87,7 +87,7 @@
MastodonIntent.xcscheme_^#shared#^_
orderHint
- 32
+ 34
MastodonIntents.xcscheme_^#shared#^_
@@ -107,7 +107,7 @@
ShareActionExtension.xcscheme_^#shared#^_
orderHint
- 34
+ 33
SuppressBuildableAutocreation
diff --git a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 8e5ea37af..0dc724ded 100644
--- a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -96,8 +96,8 @@
"repositoryURL": "https://github.com/TwidereProject/MetaTextKit.git",
"state": {
"branch": null,
- "revision": "ccb54189b31d13868d979c33d43566912b765bbd",
- "version": "2.1.0"
+ "revision": "a5f412b72fc08cd1348e2388fc7ec326365e1823",
+ "version": "2.1.1"
}
},
{
diff --git a/Mastodon/Diffiable/Section/Status/NotificationSection.swift b/Mastodon/Diffiable/Section/Status/NotificationSection.swift
index 79e312299..11dba2146 100644
--- a/Mastodon/Diffiable/Section/Status/NotificationSection.swift
+++ b/Mastodon/Diffiable/Section/Status/NotificationSection.swift
@@ -68,23 +68,37 @@ extension NotificationSection {
.store(in: &cell.disposeBag)
// configure author name, notification description, timestamp
+ let nameText = notification.account.displayNameWithFallback
+ let titleLabelText = "\(nameText) \(notification.notificationType.actionText)"
+
do {
- let mastodonContent = MastodonContent(content: notification.account.displayNameWithFallback, emojis: notification.account.emojiMeta)
+ let nameContent = MastodonContent(content: nameText, emojis: notification.account.emojiMeta)
+ let nameMetaContent = try MastodonMetaContent.convert(document: nameContent)
+
+ let mastodonContent = MastodonContent(content: titleLabelText, emojis: notification.account.emojiMeta)
let metaContent = try MastodonMetaContent.convert(document: mastodonContent)
- cell.nameLabel.configure(content: metaContent)
+
+ cell.titleLabel.configure(content: metaContent)
+
+ if let nameRange = metaContent.string.range(of: nameMetaContent.string) {
+ let nsRange = NSRange(nameRange, in: metaContent.string)
+ cell.titleLabel.textStorage.addAttributes([
+ .font: UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold), maximumPointSize: 20),
+ .foregroundColor: Asset.Colors.brandBlue.color,
+ ], range: nsRange)
+ }
+
} catch {
- let metaContent = PlaintextMetaContent(string: notification.account.displayNameWithFallback)
- cell.nameLabel.configure(content: metaContent)
+ let metaContent = PlaintextMetaContent(string: titleLabelText)
+ cell.titleLabel.configure(content: metaContent)
}
+
let createAt = notification.createAt
- let actionText = notification.notificationType.actionText
- cell.actionLabel.text = actionText
cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow
AppContext.shared.timestampUpdatePublisher
.receive(on: DispatchQueue.main)
.sink { [weak cell] _ in
guard let cell = cell else { return }
- cell.actionLabel.text = actionText
cell.timestampLabel.text = createAt.localizedTimeAgoSinceNow
}
.store(in: &cell.disposeBag)
diff --git a/Mastodon/Extension/MetaLabel.swift b/Mastodon/Extension/MetaLabel.swift
index 8163a10cb..9e7920a8e 100644
--- a/Mastodon/Extension/MetaLabel.swift
+++ b/Mastodon/Extension/MetaLabel.swift
@@ -13,7 +13,7 @@ extension MetaLabel {
enum Style {
case statusHeader
case statusName
- case notificationName
+ case notificationTitle
case profileFieldName
case profileFieldValue
case recommendAccountName
@@ -26,6 +26,7 @@ extension MetaLabel {
self.init()
layer.masksToBounds = true
+ lineBreakMode = .byTruncatingTail
textContainer.lineBreakMode = .byTruncatingTail
textContainer.lineFragmentPadding = 0
@@ -41,9 +42,9 @@ extension MetaLabel {
font = .systemFont(ofSize: 17, weight: .semibold)
textColor = Asset.Colors.Label.primary.color
- case .notificationName:
- font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold), maximumPointSize: 20)
- textColor = Asset.Colors.brandBlue.color
+ case .notificationTitle:
+ font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20)
+ textColor = Asset.Colors.Label.secondary.color
case .profileFieldName:
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 20)
@@ -54,7 +55,6 @@ extension MetaLabel {
textColor = Asset.Colors.Label.primary.color
textAlignment = .right
-
case .titleView:
font = .systemFont(ofSize: 17, weight: .semibold)
textColor = Asset.Colors.Label.primary.color
diff --git a/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift b/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift
index 804fc081a..1712468a9 100644
--- a/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift
+++ b/Mastodon/Scene/Notification/TableViewCell/NotificationStatusTableViewCell.swift
@@ -49,13 +49,8 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
let contentStackView = UIStackView()
- let actionLabel: UILabel = {
- let label = UILabel()
- label.textColor = Asset.Colors.Label.secondary.color
- label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20)
- label.lineBreakMode = .byTruncatingTail
- return label
- }()
+ let titleLabel = MetaLabel(style: .notificationTitle)
+
let dotLabel: UILabel = {
let label = UILabel()
label.textColor = Asset.Colors.Label.secondary.color
@@ -70,7 +65,6 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
return label
}()
- let nameLabel = MetaLabel(style: .notificationName)
let buttonStackView = UIStackView()
@@ -181,17 +175,15 @@ extension NotificationStatusTableViewCell {
actionStackView.distribution = .fill
actionStackView.spacing = 4
- actionStackView.addArrangedSubview(nameLabel)
- actionStackView.addArrangedSubview(actionLabel)
+ actionStackView.addArrangedSubview(titleLabel)
actionStackView.addArrangedSubview(dotLabel)
actionStackView.addArrangedSubview(timestampLabel)
let timestampPaddingView = UIView()
actionStackView.addArrangedSubview(timestampPaddingView)
- nameLabel.setContentHuggingPriority(.required - 3, for: .horizontal)
- nameLabel.setContentHuggingPriority(.required - 1, for: .vertical)
- nameLabel.setContentCompressionResistancePriority(.required - 3, for: .horizontal)
- nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
- actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
+ titleLabel.setContentHuggingPriority(.required - 3, for: .horizontal)
+ titleLabel.setContentHuggingPriority(.required - 1, for: .vertical)
+ titleLabel.setContentCompressionResistancePriority(.required - 3, for: .horizontal)
+ titleLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
dotLabel.setContentHuggingPriority(.required - 2, for: .horizontal)
dotLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal)
timestampLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
@@ -255,7 +247,7 @@ extension NotificationStatusTableViewCell {
avatarButton.addTarget(self, action: #selector(NotificationStatusTableViewCell.avatarButtonDidPressed(_:)), for: .touchUpInside)
let authorNameLabelTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
authorNameLabelTapGestureRecognizer.addTarget(self, action: #selector(NotificationStatusTableViewCell.authorNameLabelTapGestureRecognizerHandler(_:)))
- nameLabel.addGestureRecognizer(authorNameLabelTapGestureRecognizer)
+ titleLabel.addGestureRecognizer(authorNameLabelTapGestureRecognizer)
resetSeparatorLineLayout()
@@ -303,7 +295,7 @@ extension NotificationStatusTableViewCell {
@objc private func authorNameLabelTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
- delegate?.notificationStatusTableViewCell(self, authorNameLabelDidPressed: nameLabel)
+ delegate?.notificationStatusTableViewCell(self, authorNameLabelDidPressed: titleLabel)
}
}