Fix Dynamic Type not applying to status content

This commit is contained in:
Shadowfacts 2024-07-21 19:46:17 -07:00
parent 176eb7c011
commit 42423f36db
8 changed files with 15 additions and 3 deletions

View File

@ -3260,7 +3260,7 @@
repositoryURL = "https://git.shadowfacts.net/shadowfacts/HTMLStreamer.git"; repositoryURL = "https://git.shadowfacts.net/shadowfacts/HTMLStreamer.git";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = 0.2.5; version = 0.3.0;
}; };
}; };
D63CC700290EC0B8000E19DE /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { D63CC700290EC0B8000E19DE /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = {

View File

@ -25,8 +25,14 @@ class HTMLConverter {
private let converter: AttributedStringConverter<Callbacks> private let converter: AttributedStringConverter<Callbacks>
init(font: UIFont, monospaceFont: UIFont, color: UIColor, paragraphStyle: NSParagraphStyle) { init(font: UIFont, monospaceFont: UIFont, fontMetrics: UIFontMetrics, color: UIColor, paragraphStyle: NSParagraphStyle) {
let config = AttributedStringConverterConfiguration(font: font, monospaceFont: monospaceFont, color: color, paragraphStyle: paragraphStyle) let config = AttributedStringConverterConfiguration(
font: font,
monospaceFont: monospaceFont,
fontMetrics: fontMetrics,
color: color,
paragraphStyle: paragraphStyle
)
self.converter = AttributedStringConverter(configuration: config) self.converter = AttributedStringConverter(configuration: config)
} }

View File

@ -12,6 +12,7 @@ import SwiftUI
private var converter = HTMLConverter( private var converter = HTMLConverter(
font: .preferredFont(forTextStyle: .body), font: .preferredFont(forTextStyle: .body),
monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)), monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)),
fontMetrics: .default,
color: .label, color: .label,
paragraphStyle: .default paragraphStyle: .default
) )

View File

@ -13,6 +13,7 @@ class ConfirmReblogStatusPreviewView: UIView {
private static let htmlConverter = HTMLConverter( private static let htmlConverter = HTMLConverter(
font: .preferredFont(forTextStyle: .caption2), font: .preferredFont(forTextStyle: .caption2),
monospaceFont: UIFontMetrics(forTextStyle: .caption2).scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)), monospaceFont: UIFontMetrics(forTextStyle: .caption2).scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)),
fontMetrics: UIFontMetrics(forTextStyle: .caption2),
color: .label, color: .label,
paragraphStyle: .default paragraphStyle: .default
) )

View File

@ -25,6 +25,7 @@ class ContentTextView: LinkTextView, BaseEmojiLabel {
private static let defaultBodyHTMLConverter = HTMLConverter( private static let defaultBodyHTMLConverter = HTMLConverter(
font: .preferredFont(forTextStyle: .body), font: .preferredFont(forTextStyle: .body),
monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)), monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)),
fontMetrics: .default,
color: .label, color: .label,
paragraphStyle: .default paragraphStyle: .default
) )

View File

@ -21,6 +21,7 @@ class ProfileFieldValueView: UIView {
private static let converter = HTMLConverter( private static let converter = HTMLConverter(
font: .preferredFont(forTextStyle: .body), font: .preferredFont(forTextStyle: .body),
monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)), monospaceFont: UIFontMetrics.default.scaledFont(for: .monospacedSystemFont(ofSize: 17, weight: .regular)),
fontMetrics: .default,
color: .label, color: .label,
paragraphStyle: .default paragraphStyle: .default
) )

View File

@ -20,6 +20,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
private static let htmlConverter = HTMLConverter( private static let htmlConverter = HTMLConverter(
font: ConversationMainStatusCollectionViewCell.contentFont, font: ConversationMainStatusCollectionViewCell.contentFont,
monospaceFont: ConversationMainStatusCollectionViewCell.monospaceFont, monospaceFont: ConversationMainStatusCollectionViewCell.monospaceFont,
fontMetrics: .default,
color: .label, color: .label,
paragraphStyle: ConversationMainStatusCollectionViewCell.contentParagraphStyle paragraphStyle: ConversationMainStatusCollectionViewCell.contentParagraphStyle
) )

View File

@ -23,6 +23,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
static let htmlConverter = HTMLConverter( static let htmlConverter = HTMLConverter(
font: TimelineStatusCollectionViewCell.contentFont, font: TimelineStatusCollectionViewCell.contentFont,
monospaceFont: TimelineStatusCollectionViewCell.monospaceFont, monospaceFont: TimelineStatusCollectionViewCell.monospaceFont,
fontMetrics: .default,
color: .label, color: .label,
paragraphStyle: TimelineStatusCollectionViewCell.contentParagraphStyle paragraphStyle: TimelineStatusCollectionViewCell.contentParagraphStyle
) )