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

@ -72,13 +72,14 @@ struct HashtagWidgetView: View {
Text("|") Text("|")
.foregroundColor(.secondary) .foregroundColor(.secondary)
.font(.system(size: UIFontMetrics.default.scaledValue(for: 9))) .font(.system(size: UIFontMetrics.default.scaledValue(for: 9)))
Text(statusHTML: entry.hashtag.content) Text(statusHTML: entry.hashtag.hashtag)
.foregroundColor(.secondary) .foregroundColor(.secondary)
.font(.system(size: UIFontMetrics.default.scaledValue(for: 13))) .font(.system(size: UIFontMetrics.default.scaledValue(for: 13)))
.fontWeight(.heavy) .fontWeight(.heavy)
} }
Text(statusHTML: entry.hashtag.content) Text(statusHTML: entry.hashtag.content, fontSize: 12)
.foregroundColor(.primary)
.lineLimit(3)
Spacer() Spacer()
} }
} }
@ -86,7 +87,7 @@ struct HashtagWidgetView: View {
/// Inspired by: https://swiftuirecipes.com/blog/swiftui-text-with-html-via-nsattributedstring /// Inspired by: https://swiftuirecipes.com/blog/swiftui-text-with-html-via-nsattributedstring
extension Text { extension Text {
init(statusHTML htmlString: String) { init(statusHTML htmlString: String, fontSize: Int = 16) {
let fullHTML = """ let fullHTML = """
<!doctype html> <!doctype html>
<html> <html>
@ -94,7 +95,7 @@ extension Text {
<style> <style>
body { body {
font-family: -apple-system; font-family: -apple-system;
font-size: 16px; font-size: \(fontSize)px;
} }
a { a {