Dynamic type support in assorted places
This commit is contained in:
parent
590b9f0bcc
commit
b9555cf7dd
|
@ -49,7 +49,6 @@ struct ComposeAttachmentRow: View {
|
||||||
ComposeTextView(text: $attachment.attachmentDescription, placeholder: Text("Describe for the visually impaired…"), minHeight: 80)
|
ComposeTextView(text: $attachment.attachmentDescription, placeholder: Text("Describe for the visually impaired…"), minHeight: 80)
|
||||||
.heightDidChange(self.heightChanged)
|
.heightDidChange(self.heightChanged)
|
||||||
.backgroundColor(.clear)
|
.backgroundColor(.clear)
|
||||||
.fontSize(17)
|
|
||||||
|
|
||||||
case .recognizingText:
|
case .recognizingText:
|
||||||
ProgressView()
|
ProgressView()
|
||||||
|
|
|
@ -66,11 +66,11 @@ struct ComposeAutocompleteMentionsView: View {
|
||||||
.cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 30)
|
.cornerRadius(preferences.avatarStyle.cornerRadiusFraction * 30)
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
AccountDisplayNameLabel(account: account.value, fontSize: 14)
|
AccountDisplayNameLabel(account: account.value, textStyle: .subheadline, emojiSize: 14)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
|
|
||||||
Text(verbatim: "@\(account.value.acct)")
|
Text(verbatim: "@\(account.value.acct)")
|
||||||
.font(.system(size: 12))
|
.font(.caption)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,7 @@ struct ComposeAutocompleteEmojisView: View {
|
||||||
|
|
||||||
@State var expanded = false
|
@State var expanded = false
|
||||||
@State private var emojis: [Emoji] = []
|
@State private var emojis: [Emoji] = []
|
||||||
|
@ScaledMetric private var emojiSize = 30
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
// When exapnded, the toggle button should be at the top. When collapsed, it should be centered.
|
// When exapnded, the toggle button should be at the top. When collapsed, it should be centered.
|
||||||
|
@ -212,13 +213,13 @@ struct ComposeAutocompleteEmojisView: View {
|
||||||
|
|
||||||
private var verticalGrid: some View {
|
private var verticalGrid: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
LazyVGrid(columns: [GridItem(.adaptive(minimum: 30), spacing: 4)]) {
|
LazyVGrid(columns: [GridItem(.adaptive(minimum: emojiSize), spacing: 4)]) {
|
||||||
ForEach(emojis, id: \.shortcode) { (emoji) in
|
ForEach(emojis, id: \.shortcode) { (emoji) in
|
||||||
Button {
|
Button {
|
||||||
uiState.currentInput?.autocomplete(with: ":\(emoji.shortcode):")
|
uiState.currentInput?.autocomplete(with: ":\(emoji.shortcode):")
|
||||||
} label: {
|
} label: {
|
||||||
CustomEmojiImageView(emoji: emoji)
|
CustomEmojiImageView(emoji: emoji)
|
||||||
.frame(height: 30)
|
.frame(height: emojiSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,19 +237,19 @@ struct ComposeAutocompleteEmojisView: View {
|
||||||
} label: {
|
} label: {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
CustomEmojiImageView(emoji: emoji)
|
CustomEmojiImageView(emoji: emoji)
|
||||||
.frame(height: 30)
|
.frame(height: emojiSize)
|
||||||
Text(verbatim: ":\(emoji.shortcode):")
|
Text(verbatim: ":\(emoji.shortcode):")
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(height: 30)
|
.frame(height: emojiSize)
|
||||||
}
|
}
|
||||||
.animation(.linear(duration: 0.2), value: emojis)
|
.animation(.linear(duration: 0.2), value: emojis)
|
||||||
|
|
||||||
Spacer(minLength: 30)
|
Spacer(minLength: emojiSize)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 8)
|
.padding(.horizontal, 8)
|
||||||
.frame(height: 46)
|
.frame(height: emojiSize + 16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,11 @@ struct ComposeCurrentAccount: View {
|
||||||
if let id = account?.id,
|
if let id = account?.id,
|
||||||
let account = mastodonController.persistentContainer.account(for: id) {
|
let account = mastodonController.persistentContainer.account(for: id) {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
AccountDisplayNameLabel(account: account, fontSize: 20)
|
AccountDisplayNameLabel(account: account, textStyle: .title2, emojiSize: 24)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
|
|
||||||
Text(verbatim: "@\(account.acct)")
|
Text(verbatim: "@\(account.acct)")
|
||||||
.font(.system(size: 17, weight: .light))
|
.font(.body.weight(.light))
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,12 +46,13 @@ struct ComposeEmojiTextField: UIViewRepresentable {
|
||||||
|
|
||||||
view.placeholder = placeholder
|
view.placeholder = placeholder
|
||||||
view.borderStyle = .roundedRect
|
view.borderStyle = .roundedRect
|
||||||
|
view.font = .preferredFont(forTextStyle: .body)
|
||||||
|
view.adjustsFontForContentSizeCategory = true
|
||||||
|
view.backgroundColor = backgroundColor
|
||||||
|
|
||||||
view.delegate = context.coordinator
|
view.delegate = context.coordinator
|
||||||
view.addTarget(context.coordinator, action: #selector(Coordinator.didChange(_:)), for: .editingChanged)
|
view.addTarget(context.coordinator, action: #selector(Coordinator.didChange(_:)), for: .editingChanged)
|
||||||
|
|
||||||
view.backgroundColor = backgroundColor
|
|
||||||
|
|
||||||
// otherwise when the text gets too wide it starts expanding the ComposeView
|
// otherwise when the text gets too wide it starts expanding the ComposeView
|
||||||
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ struct ComposeReplyView: View {
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
HStack {
|
HStack {
|
||||||
AccountDisplayNameLabel(account: status.account, fontSize: 17)
|
AccountDisplayNameLabel(account: status.account, textStyle: .body, emojiSize: 17)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.layoutPriority(1)
|
.layoutPriority(1)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ struct ComposeTextView: View {
|
||||||
|
|
||||||
private var heightDidChange: ((CGFloat) -> Void)?
|
private var heightDidChange: ((CGFloat) -> Void)?
|
||||||
private var backgroundColor = UIColor.secondarySystemBackground
|
private var backgroundColor = UIColor.secondarySystemBackground
|
||||||
private var fontSize: CGFloat = 20
|
|
||||||
|
|
||||||
@State private var height: CGFloat?
|
@State private var height: CGFloat?
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ struct ComposeTextView: View {
|
||||||
|
|
||||||
if text.isEmpty, let placeholder = placeholder {
|
if text.isEmpty, let placeholder = placeholder {
|
||||||
placeholder
|
placeholder
|
||||||
.font(.system(size: fontSize))
|
.font(.body)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.offset(x: 4, y: 8)
|
.offset(x: 4, y: 8)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +38,7 @@ struct ComposeTextView: View {
|
||||||
WrappedTextView(
|
WrappedTextView(
|
||||||
text: $text,
|
text: $text,
|
||||||
textDidChange: self.textDidChange,
|
textDidChange: self.textDidChange,
|
||||||
font: .systemFont(ofSize: fontSize)
|
font: .preferredFont(forTextStyle: .body)
|
||||||
)
|
)
|
||||||
.frame(height: height ?? minHeight)
|
.frame(height: height ?? minHeight)
|
||||||
}
|
}
|
||||||
|
@ -61,12 +60,6 @@ struct ComposeTextView: View {
|
||||||
copy.backgroundColor = color
|
copy.backgroundColor = color
|
||||||
return copy
|
return copy
|
||||||
}
|
}
|
||||||
|
|
||||||
func fontSize(_ size: CGFloat) -> Self {
|
|
||||||
var copy = self
|
|
||||||
copy.fontSize = size
|
|
||||||
return copy
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WrappedTextView: UIViewRepresentable {
|
struct WrappedTextView: UIViewRepresentable {
|
||||||
|
@ -82,6 +75,7 @@ struct WrappedTextView: UIViewRepresentable {
|
||||||
textView.isEditable = true
|
textView.isEditable = true
|
||||||
textView.backgroundColor = .clear
|
textView.backgroundColor = .clear
|
||||||
textView.font = font
|
textView.font = font
|
||||||
|
textView.adjustsFontForContentSizeCategory = true
|
||||||
textView.textContainer.lineBreakMode = .byWordWrapping
|
textView.textContainer.lineBreakMode = .byWordWrapping
|
||||||
return textView
|
return textView
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct MainComposeTextView: View {
|
||||||
@State private var height: CGFloat?
|
@State private var height: CGFloat?
|
||||||
@State private var becomeFirstResponder: Bool = false
|
@State private var becomeFirstResponder: Bool = false
|
||||||
@State private var hasFirstAppeared = false
|
@State private var hasFirstAppeared = false
|
||||||
|
@ScaledMetric private var fontSize = 20
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack(alignment: .topLeading) {
|
ZStack(alignment: .topLeading) {
|
||||||
|
@ -40,7 +41,7 @@ struct MainComposeTextView: View {
|
||||||
|
|
||||||
if draft.text.isEmpty {
|
if draft.text.isEmpty {
|
||||||
placeholder
|
placeholder
|
||||||
.font(.system(size: 20))
|
.font(.system(size: fontSize))
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.offset(x: 4, y: 8)
|
.offset(x: 4, y: 8)
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,8 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
|
||||||
textView.delegate = context.coordinator
|
textView.delegate = context.coordinator
|
||||||
textView.isEditable = true
|
textView.isEditable = true
|
||||||
textView.backgroundColor = .clear
|
textView.backgroundColor = .clear
|
||||||
textView.font = .systemFont(ofSize: 20)
|
textView.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 20))
|
||||||
|
textView.adjustsFontForContentSizeCategory = true
|
||||||
textView.textContainer.lineBreakMode = .byWordWrapping
|
textView.textContainer.lineBreakMode = .byWordWrapping
|
||||||
context.coordinator.textView = textView
|
context.coordinator.textView = textView
|
||||||
return textView
|
return textView
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
<constraint firstAttribute="height" constant="20" id="4tF-oL-qXT"/>
|
<constraint firstAttribute="height" constant="20" id="4tF-oL-qXT"/>
|
||||||
<constraint firstAttribute="width" constant="20" id="zWx-jJ-dBj"/>
|
<constraint firstAttribute="width" constant="20" id="zWx-jJ-dBj"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<state key="normal" image="square.and.arrow.up" catalog="system"/>
|
<state key="normal" image="square.and.arrow.up" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
<constraint firstAttribute="width" constant="20" id="eg0-hN-rda"/>
|
<constraint firstAttribute="width" constant="20" id="eg0-hN-rda"/>
|
||||||
<constraint firstAttribute="height" constant="20" id="fmA-pI-8WB"/>
|
<constraint firstAttribute="height" constant="20" id="fmA-pI-8WB"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<state key="normal" image="xmark" catalog="system"/>
|
<state key="normal" image="xmark" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
|
@ -75,9 +76,9 @@
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rPa-Zu-T6g">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rPa-Zu-T6g">
|
||||||
<rect key="frame" x="0.0" y="622.5" width="375" height="44.5"/>
|
<rect key="frame" x="0.0" y="622.5" width="375" height="44.5"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eo5-fc-RV8">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eo5-fc-RV8">
|
||||||
<rect key="frame" x="16" y="8" width="343" height="20.5"/>
|
<rect key="frame" x="16" y="8" width="343" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -28,6 +28,12 @@ class AccountTableViewCell: UITableViewCell {
|
||||||
super.awakeFromNib()
|
super.awakeFromNib()
|
||||||
|
|
||||||
avatarImageView.layer.masksToBounds = true
|
avatarImageView.layer.masksToBounds = true
|
||||||
|
|
||||||
|
usernameLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .light))
|
||||||
|
usernameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
|
noteLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15))
|
||||||
|
noteLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPrefrences), name: .preferencesChanged, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPrefrences), name: .preferencesChanged, object: nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16092.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16082.1"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -26,16 +28,16 @@
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Iif-9m-vM5">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Iif-9m-vM5">
|
||||||
<rect key="frame" x="74" y="11" width="230" height="78"/>
|
<rect key="frame" x="74" y="11" width="230" height="78"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Display Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fhc-bZ-lkB" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Display Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fhc-bZ-lkB" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="230" height="20.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="230" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JMo-QH-1is">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JMo-QH-1is">
|
||||||
<rect key="frame" x="0.0" y="20.5" width="230" height="18"/>
|
<rect key="frame" x="0.0" y="20.5" width="230" height="18"/>
|
||||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="15"/>
|
<fontDescription key="fontDescription" type="system" weight="light" pointSize="15"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Note" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bNO-qR-YEe" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Note" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bNO-qR-YEe" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
|
@ -66,4 +68,9 @@
|
||||||
<point key="canvasLocation" x="173.91304347826087" y="35.491071428571423"/>
|
<point key="canvasLocation" x="173.91304347826087" y="35.491071428571423"/>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
</objects>
|
</objects>
|
||||||
|
<resources>
|
||||||
|
<systemColor name="secondaryLabelColor">
|
||||||
|
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
</systemColor>
|
||||||
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -14,20 +14,22 @@ private let emojiRegex = try! NSRegularExpression(pattern: ":(\\w+):", options:
|
||||||
|
|
||||||
struct AccountDisplayNameLabel: View {
|
struct AccountDisplayNameLabel: View {
|
||||||
let account: any AccountProtocol
|
let account: any AccountProtocol
|
||||||
let fontSize: Int
|
let textStyle: Font.TextStyle
|
||||||
|
@ScaledMetric var emojiSize: CGFloat
|
||||||
@State var text: Text
|
@State var text: Text
|
||||||
@State var emojiRequests = [ImageCache.Request]()
|
@State var emojiRequests = [ImageCache.Request]()
|
||||||
|
|
||||||
init(account: any AccountProtocol, fontSize: Int) {
|
init(account: any AccountProtocol, textStyle: Font.TextStyle, emojiSize: CGFloat) {
|
||||||
self.account = account
|
self.account = account
|
||||||
self.fontSize = fontSize
|
self.textStyle = textStyle
|
||||||
|
self._emojiSize = ScaledMetric(wrappedValue: emojiSize, relativeTo: textStyle)
|
||||||
let name = account.displayName.isEmpty ? account.username : account.displayName
|
let name = account.displayName.isEmpty ? account.username : account.displayName
|
||||||
self._text = State(initialValue: Text(verbatim: name))
|
self._text = State(initialValue: Text(verbatim: name))
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
text
|
text
|
||||||
.font(.system(size: CGFloat(fontSize), weight: .semibold))
|
.font(.system(textStyle).weight(.semibold))
|
||||||
.onAppear(perform: self.loadEmojis)
|
.onAppear(perform: self.loadEmojis)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +55,7 @@ struct AccountDisplayNameLabel: View {
|
||||||
defer { group.leave() }
|
defer { group.leave() }
|
||||||
guard let image = image else { return }
|
guard let image = image else { return }
|
||||||
|
|
||||||
let size = CGSize(width: fontSize, height: fontSize)
|
let size = CGSize(width: emojiSize, height: emojiSize)
|
||||||
let renderer = UIGraphicsImageRenderer(size: size)
|
let renderer = UIGraphicsImageRenderer(size: size)
|
||||||
let resized = renderer.image { (ctx) in
|
let resized = renderer.image { (ctx) in
|
||||||
image.draw(in: CGRect(origin: .zero, size: size))
|
image.draw(in: CGRect(origin: .zero, size: size))
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -23,9 +24,9 @@
|
||||||
<constraint firstAttribute="height" constant="64" id="ZhL-aE-TCF"/>
|
<constraint firstAttribute="height" constant="64" id="ZhL-aE-TCF"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</imageView>
|
</imageView>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Album Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fK1-aD-yvs">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Album Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fK1-aD-yvs">
|
||||||
<rect key="frame" x="96" y="30" width="216" height="20.5"/>
|
<rect key="frame" x="96" y="30" width="216" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -23,9 +24,9 @@
|
||||||
<constraint firstAttribute="width" constant="64" id="P7K-i4-Id7"/>
|
<constraint firstAttribute="width" constant="64" id="P7K-i4-Id7"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</imageView>
|
</imageView>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="All Photos" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pcI-Ow-ilI">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="All Photos" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pcI-Ow-ilI">
|
||||||
<rect key="frame" x="96" y="30" width="216" height="20.5"/>
|
<rect key="frame" x="96" y="30" width="216" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -32,6 +32,8 @@ class ConfirmLoadMoreCollectionViewCell: UICollectionViewCell {
|
||||||
|
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = "Infinite scrolling is off. Do you want to keep going?"
|
label.text = "Infinite scrolling is off. Do you want to keep going?"
|
||||||
|
label.font = .preferredFont(forTextStyle: .body)
|
||||||
|
label.adjustsFontForContentSizeCategory = true
|
||||||
label.textColor = .secondaryLabel
|
label.textColor = .secondaryLabel
|
||||||
label.textAlignment = .natural
|
label.textAlignment = .natural
|
||||||
label.numberOfLines = 0
|
label.numberOfLines = 0
|
||||||
|
|
|
@ -17,6 +17,13 @@ class DraftTableViewCell: UITableViewCell {
|
||||||
@IBOutlet weak var attachmentsStackViewContainer: UIView!
|
@IBOutlet weak var attachmentsStackViewContainer: UIView!
|
||||||
@IBOutlet weak var attachmentsStackView: UIStackView!
|
@IBOutlet weak var attachmentsStackView: UIStackView!
|
||||||
|
|
||||||
|
override func awakeFromNib() {
|
||||||
|
super.awakeFromNib()
|
||||||
|
|
||||||
|
contentWarningLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .bold))
|
||||||
|
contentWarningLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
}
|
||||||
|
|
||||||
func updateUI(for draft: Draft) {
|
func updateUI(for draft: Draft) {
|
||||||
contentWarningLabel.text = draft.contentWarning
|
contentWarningLabel.text = draft.contentWarning
|
||||||
contentWarningLabel.isHidden = !draft.contentWarningEnabled
|
contentWarningLabel.isHidden = !draft.contentWarningEnabled
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14865.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14819.2"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -16,27 +18,27 @@
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="gaD-3B-qO1">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="gaD-3B-qO1">
|
||||||
<rect key="frame" x="15" y="11" width="352" height="124"/>
|
<rect key="frame" x="16" y="11" width="351" height="124"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VhS-ig-6Fu">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VhS-ig-6Fu">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="352" height="18"/>
|
<rect key="frame" x="0.0" y="0.0" width="351" height="18"/>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zMS-88-DcM">
|
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zMS-88-DcM">
|
||||||
<rect key="frame" x="0.0" y="26" width="352" height="40"/>
|
<rect key="frame" x="0.0" y="26" width="351" height="40"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" ambiguous="YES" text="Content" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8eA-yd-rBp">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" ambiguous="YES" text="Content" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8eA-yd-rBp">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="311.5" height="32"/>
|
<rect key="frame" x="0.0" y="0.0" width="310.5" height="32"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="2m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D2X-9O-iQw">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="2m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D2X-9O-iQw">
|
||||||
<rect key="frame" x="327.5" y="0.0" width="24.5" height="20.5"/>
|
<rect key="frame" x="326.5" y="0.0" width="24.5" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
@ -50,7 +52,7 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="csc-gx-KVg">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="csc-gx-KVg">
|
||||||
<rect key="frame" x="0.0" y="74" width="352" height="50"/>
|
<rect key="frame" x="0.0" y="74" width="351" height="50"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="htC-hf-vJ4">
|
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="htC-hf-vJ4">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="352" height="50"/>
|
<rect key="frame" x="0.0" y="0.0" width="352" height="50"/>
|
||||||
|
@ -88,4 +90,9 @@
|
||||||
<point key="canvasLocation" x="-388" y="184.85757121439281"/>
|
<point key="canvasLocation" x="-388" y="184.85757121439281"/>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
</objects>
|
</objects>
|
||||||
|
<resources>
|
||||||
|
<systemColor name="secondaryLabelColor">
|
||||||
|
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
</systemColor>
|
||||||
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|
Loading…
Reference in New Issue