diff --git a/Mastodon/In Progress New Layout and Datamodel/InlinePostPreview.swift b/Mastodon/In Progress New Layout and Datamodel/InlinePostPreview.swift index bf05b1be7..229addf3e 100644 --- a/Mastodon/In Progress New Layout and Datamodel/InlinePostPreview.swift +++ b/Mastodon/In Progress New Layout and Datamodel/InlinePostPreview.swift @@ -11,6 +11,7 @@ import SwiftUI struct InlinePostPreview: View { let viewModel: Mastodon.Entity.Status.ViewModel + let showAttributionHeader: Bool // TODO: remove this option when full post layout is available @Environment(\.colorScheme) private var colorScheme @@ -20,7 +21,7 @@ struct InlinePostPreview: View { if let content = viewModel.content { Text(String(content.characters[...])) .font(.subheadline) - .lineLimit(3) + .lineLimit(showAttributionHeader ? 3 : 9) .fixedSize(horizontal: false, vertical: true) } if let attachmentInfo = viewModel.attachmentInfo { @@ -50,7 +51,7 @@ struct InlinePostPreview: View { @ViewBuilder func header() -> some View { HStack(spacing: 4) { - if viewModel.needsUserAttribution { + if showAttributionHeader && viewModel.needsUserAttribution { if let url = viewModel.accountAvatarUrl { AsyncImage( url: url, diff --git a/Mastodon/In Progress New Layout and Datamodel/NotificationRowView.swift b/Mastodon/In Progress New Layout and Datamodel/NotificationRowView.swift index c64f6162a..9fffd1dd7 100644 --- a/Mastodon/In Progress New Layout and Datamodel/NotificationRowView.swift +++ b/Mastodon/In Progress New Layout and Datamodel/NotificationRowView.swift @@ -178,6 +178,15 @@ extension GroupedNotificationType { return .gray } } + + var wantsFullStatusLayout: Bool { + switch self { + case .status, .mention: + return true + default: + return false + } + } func actionSummaryLabel(_ sourceAccounts: NotificationSourceAccounts) -> AttributedString? @@ -673,10 +682,10 @@ struct NotificationRowView: View { .frame(maxWidth: .infinity, alignment: .leading) case .weightedText(let string, let weight): textComponent(string, fontWeight: weight) - case .status(let viewModel): - InlinePostPreview(viewModel: viewModel) + case .status(let statusViewModel): + InlinePostPreview(viewModel: statusViewModel, showAttributionHeader: !viewModel.type.wantsFullStatusLayout) .onTapGesture { - viewModel.navigateToStatus() + statusViewModel.navigateToStatus() } case .hyperlinkButton(let label, let url): Button(label) {