forked from shadowfacts/Tusker
Tweak timeline status VO labels to only include attachment text when not blurred
This commit is contained in:
parent
cde061c77a
commit
f96acd33f2
|
@ -386,6 +386,16 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
|||
str += AttributedString(contentTextView.attributedText)
|
||||
|
||||
if status.attachments.count > 0 {
|
||||
let includeDescriptions: Bool
|
||||
switch Preferences.shared.attachmentBlurMode {
|
||||
case .useStatusSetting:
|
||||
includeDescriptions = !Preferences.shared.blurMediaBehindContentWarning || status.spoilerText.isEmpty
|
||||
case .always:
|
||||
includeDescriptions = true
|
||||
case .never:
|
||||
includeDescriptions = false
|
||||
}
|
||||
if includeDescriptions {
|
||||
if status.attachments.count == 1 {
|
||||
let attachment = status.attachments[0]
|
||||
let desc = attachment.description?.isEmpty == false ? attachment.description! : "no description"
|
||||
|
@ -396,6 +406,9 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
|||
str += AttributedString(", attachment \(index + 1): \(desc)")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
str += AttributedString(", \(status.attachments.count) attachment\(status.attachments.count == 1 ? "" : "s")")
|
||||
}
|
||||
}
|
||||
if status.poll != nil {
|
||||
str += ", poll"
|
||||
|
|
|
@ -271,6 +271,16 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|||
str += AttributedString(contentTextView.attributedText)
|
||||
|
||||
if status.attachments.count > 0 {
|
||||
let includeDescriptions: Bool
|
||||
switch Preferences.shared.attachmentBlurMode {
|
||||
case .useStatusSetting:
|
||||
includeDescriptions = !Preferences.shared.blurMediaBehindContentWarning || status.spoilerText.isEmpty
|
||||
case .always:
|
||||
includeDescriptions = true
|
||||
case .never:
|
||||
includeDescriptions = false
|
||||
}
|
||||
if includeDescriptions {
|
||||
if status.attachments.count == 1 {
|
||||
let attachment = status.attachments[0]
|
||||
let desc = attachment.description?.isEmpty == false ? attachment.description! : "no description"
|
||||
|
@ -281,6 +291,9 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|||
str += AttributedString(", attachment \(index + 1): \(desc)")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
str += AttributedString(", \(status.attachments.count) attachment\(status.attachments.count == 1 ? "" : "s")")
|
||||
}
|
||||
}
|
||||
if status.poll != nil {
|
||||
str += ", poll"
|
||||
|
|
Loading…
Reference in New Issue