| author | |
| committer | |
| log | 9962e6986db68cd5537d23153e7898d6b3696b85 |
| tree | b7cde15b2122f95e79e0b804f288ed4058328be2 |
| parent | ce920f2ac893051bff2108c03346bd35340fd988 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>3 files changed, 16 insertions(+), 5 deletions(-)
apps/mobile/modules/t3-composer-editor/ios/T3ComposerEditorView.swift+9-1| ... | @@ -436,6 +436,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | ... | @@ -436,6 +436,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro |
| 436 | private var iconImages: [String: UIImage] = [:] | 436 | private var iconImages: [String: UIImage] = [:] |
| 437 | private var pendingIconUris = Set<String>() | 437 | private var pendingIconUris = Set<String>() |
| 438 | private var tokensNeedRebuild = false | 438 | private var tokensNeedRebuild = false |
| 439 | private var chipsNeedMeasuredWidth = false | ||
| 439 | 440 | ||
| 440 | let onComposerChange = EventDispatcher() | 441 | let onComposerChange = EventDispatcher() |
| 441 | let onComposerSelectionChange = EventDispatcher() | 442 | let onComposerSelectionChange = EventDispatcher() |
| ... | @@ -571,6 +572,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | ... | @@ -571,6 +572,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro |
| 571 | public override func layoutSubviews() { | 572 | public override func layoutSubviews() { |
| 572 | super.layoutSubviews() | 573 | super.layoutSubviews() |
| 573 | textView.frame = bounds | 574 | textView.frame = bounds |
| 575 | if chipsNeedMeasuredWidth, bounds.width > 0 { | ||
| 576 | chipsNeedMeasuredWidth = false | ||
| 577 | applyControlledDocument(force: true) | ||
| 578 | } | ||
| 574 | let placeholderX = textView.textContainerInset.left + textView.textContainer.lineFragmentPadding | 579 | let placeholderX = textView.textContainerInset.left + textView.textContainer.lineFragmentPadding |
| 575 | let placeholderY = textView.textContainerInset.top | 580 | let placeholderY = textView.textContainerInset.top |
| 576 | let placeholderWidth = max( | 581 | let placeholderWidth = max( |
| ... | @@ -970,7 +975,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro | ... | @@ -970,7 +975,10 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro |
| 970 | // `maximumWidth` does, so the chip always fits the line it sits on. | 975 | // `maximumWidth` does, so the chip always fits the line it sits on. |
| 971 | let availableWidth = textView.textContainer.size.width > 0 | 976 | let availableWidth = textView.textContainer.size.width > 0 |
| 972 | ? textView.textContainer.size.width - textView.textContainer.lineFragmentPadding * 2 | 977 | ? textView.textContainer.size.width - textView.textContainer.lineFragmentPadding * 2 |
| 973 | : UIScreen.main.bounds.width | 978 | : (textView.window?.bounds.width ?? bounds.width) |
| 979 | if availableWidth <= 0 { | ||
| 980 | chipsNeedMeasuredWidth = true | ||
| 981 | } | ||
| 974 | let maximumLabelWidth = max(chipFontSize * 3, availableWidth - padding * 2 - iconWidth - iconGap) | 982 | let maximumLabelWidth = max(chipFontSize * 3, availableWidth - padding * 2 - iconWidth - iconGap) |
| 975 | paragraph.lineBreakMode = .byTruncatingMiddle | 983 | paragraph.lineBreakMode = .byTruncatingMiddle |
| 976 | attributedLabel.addAttribute( | 984 | attributedLabel.addAttribute( |
apps/mobile/modules/t3-review-diff/ios/T3ReviewDiffView.swift+2-2| ... | @@ -1923,7 +1923,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate { | ... | @@ -1923,7 +1923,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate { |
| 1923 | theme.headerBackground.setFill() | 1923 | theme.headerBackground.setFill() |
| 1924 | context.fill(cardRect) | 1924 | context.fill(cardRect) |
| 1925 | 1925 | ||
| 1926 | let hairline = 1 / UIScreen.main.scale | 1926 | let hairline = 1 / traitCollection.displayScale |
| 1927 | theme.border.setFill() | 1927 | theme.border.setFill() |
| 1928 | context.fill(CGRect(x: cardRect.minX, y: cardRect.maxY - hairline, width: cardRect.width, height: hairline)) | 1928 | context.fill(CGRect(x: cardRect.minX, y: cardRect.maxY - hairline, width: cardRect.width, height: hairline)) |
| 1929 | 1929 | ||
| ... | @@ -1982,7 +1982,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate { | ... | @@ -1982,7 +1982,7 @@ private final class ReviewDiffContentView: UIView, UIGestureRecognizerDelegate { |
| 1982 | theme.background.setFill() | 1982 | theme.background.setFill() |
| 1983 | context.fill(rect) | 1983 | context.fill(rect) |
| 1984 | 1984 | ||
| 1985 | let hairline = 1 / UIScreen.main.scale | 1985 | let hairline = 1 / traitCollection.displayScale |
| 1986 | theme.border.withAlphaComponent(0.65).setFill() | 1986 | theme.border.withAlphaComponent(0.65).setFill() |
| 1987 | context.fill(CGRect(x: 0, y: rect.maxY - hairline, width: rect.width, height: hairline)) | 1987 | context.fill(CGRect(x: 0, y: rect.maxY - hairline, width: rect.width, height: hairline)) |
| 1988 | 1988 |
apps/mobile/modules/t3-terminal/ios/T3TerminalView.swift+5-2| ... | @@ -315,7 +315,8 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate { | ... | @@ -315,7 +315,8 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate { |
| 315 | 315 | ||
| 316 | applyTheme() | 316 | applyTheme() |
| 317 | clipsToBounds = true | 317 | clipsToBounds = true |
| 318 | contentScaleFactor = UIScreen.main.scale | 318 | // The real scale arrives with the window; layoutSubviews corrects it. |
| 319 | contentScaleFactor = traitCollection.displayScale | ||
| 319 | 320 | ||
| 320 | terminalViewport.clipsToBounds = true | 321 | terminalViewport.clipsToBounds = true |
| 321 | terminalViewport.contentScaleFactor = contentScaleFactor | 322 | terminalViewport.contentScaleFactor = contentScaleFactor |
| ... | @@ -677,7 +678,9 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate { | ... | @@ -677,7 +678,9 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate { |
| 677 | } | 678 | } |
| 678 | 679 | ||
| 679 | private func updateContentScale() { | 680 | private func updateContentScale() { |
| 680 | let scale = window?.screen.scale ?? UIScreen.main.scale | 681 | // The trait collection follows the scene the view is in, which matters once |
| 682 | // iPhone apps run resizable and on external displays; UIScreen.main does not. | ||
| 683 | let scale = traitCollection.displayScale | ||
| 681 | if contentScaleFactor != scale { | 684 | if contentScaleFactor != scale { |
| 682 | contentScaleFactor = scale | 685 | contentScaleFactor = scale |
| 683 | } | 686 | } |