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
This commit is contained in:
Nathan Mattes 2023-05-02 18:44:20 +02:00
parent 1829793ac5
commit fee94c6a8d
2 changed files with 7 additions and 6 deletions

View File

@ -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) {

View File

@ -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 = """
<!doctype html>
<html>
@ -94,7 +95,7 @@ extension Text {
<style>
body {
font-family: -apple-system;
font-size: 16px;
font-size: \(fontSize)px;
}
a {