From fee94c6a8dbd6eefce3e86e0522b00dc8cfea7b4 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Tue, 2 May 2023 18:44:20 +0200 Subject: [PATCH] Show hashtag instead of content on lockscreen Widget isn't working on lockscreen atm as we can't edit the widget to set the hashtag --- .../FollowersCount/FollowersCountWidgetView.swift | 2 +- .../Variants/Hashtag/HashtagWidgetView.swift | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift b/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift index ab0f29d57..2ad348c71 100644 --- a/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift +++ b/WidgetExtension/Variants/FollowersCount/FollowersCountWidgetView.swift @@ -127,7 +127,7 @@ struct FollowersCountWidgetView: View { .padding(.top, 16) } - private func viewForAccessoryRectangular(_ account :FollowersEntryAccountable) -> some View { + private func viewForAccessoryRectangular(_ account: FollowersEntryAccountable) -> some View { HStack(spacing: 0) { VStack(alignment: .leading, spacing: 0) { HStack(alignment: .center) { diff --git a/WidgetExtension/Variants/Hashtag/HashtagWidgetView.swift b/WidgetExtension/Variants/Hashtag/HashtagWidgetView.swift index c09c22826..52b3a75ed 100644 --- a/WidgetExtension/Variants/Hashtag/HashtagWidgetView.swift +++ b/WidgetExtension/Variants/Hashtag/HashtagWidgetView.swift @@ -72,13 +72,14 @@ struct HashtagWidgetView: View { Text("|") .foregroundColor(.secondary) .font(.system(size: UIFontMetrics.default.scaledValue(for: 9))) - Text(statusHTML: entry.hashtag.content) + Text(statusHTML: entry.hashtag.hashtag) .foregroundColor(.secondary) .font(.system(size: UIFontMetrics.default.scaledValue(for: 13))) .fontWeight(.heavy) - } - Text(statusHTML: entry.hashtag.content) + Text(statusHTML: entry.hashtag.content, fontSize: 12) + .foregroundColor(.primary) + .lineLimit(3) Spacer() } } @@ -86,7 +87,7 @@ struct HashtagWidgetView: View { /// Inspired by: https://swiftuirecipes.com/blog/swiftui-text-with-html-via-nsattributedstring extension Text { - init(statusHTML htmlString: String) { + init(statusHTML htmlString: String, fontSize: Int = 16) { let fullHTML = """ @@ -94,7 +95,7 @@ extension Text {