Compare commits

..

No commits in common. "71a57e9859646c924346fe1c42d3bf3f50300833" and "4f48514d1a901c1d8100dbc9d936a8d1a549066c" have entirely different histories.

5 changed files with 4 additions and 39 deletions

View File

@ -16,7 +16,6 @@ protocol ComposeUIStateDelegate: AnyObject {
func presentAssetPickerSheet() func presentAssetPickerSheet()
func presentComposeDrawing() func presentComposeDrawing()
func selectDraft(_ draft: Draft) func selectDraft(_ draft: Draft)
func paste(itemProviders: [NSItemProvider])
} }
class ComposeUIState: ObservableObject { class ComposeUIState: ObservableObject {

View File

@ -72,24 +72,8 @@ struct ComposeView: View {
return attachmentIds.contains { uiState.attachmentsMissingDescriptions.contains($0) } return attachmentIds.contains { uiState.attachmentsMissingDescriptions.contains($0) }
} }
private var validAttachmentCombination: Bool {
if !mastodonController.instanceFeatures.mastodonAttachmentRestrictions {
return true
} else if draft.attachments.contains(where: { $0.data.type == .video }) && draft.attachments.count > 1 {
return false
} else if draft.attachments.count > 4 {
return false
}
return true
}
private var postButtonEnabled: Bool { private var postButtonEnabled: Bool {
draft.hasContent draft.hasContent && charactersRemaining >= 0 && !isPosting && !requiresAttachmentDescriptions && (draft.poll == nil || draft.poll!.options.allSatisfy { !$0.text.isEmpty })
&& charactersRemaining >= 0
&& !isPosting
&& !requiresAttachmentDescriptions
&& validAttachmentCombination
&& (draft.poll == nil || draft.poll!.options.allSatisfy { !$0.text.isEmpty })
} }
var body: some View { var body: some View {

View File

@ -83,7 +83,7 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
@Environment(\.isEnabled) var isEnabled: Bool @Environment(\.isEnabled) var isEnabled: Bool
func makeUIView(context: Context) -> UITextView { func makeUIView(context: Context) -> UITextView {
let textView = WrappedTextView(uiState: uiState) let textView = WrappedTextView()
textView.delegate = context.coordinator textView.delegate = context.coordinator
textView.isEditable = true textView.isEditable = true
textView.backgroundColor = .clear textView.backgroundColor = .clear
@ -128,16 +128,6 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
class WrappedTextView: UITextView { class WrappedTextView: UITextView {
private let formattingActions = [#selector(toggleBoldface(_:)), #selector(toggleItalics(_:))] private let formattingActions = [#selector(toggleBoldface(_:)), #selector(toggleItalics(_:))]
unowned var uiState: ComposeUIState
init(uiState: ComposeUIState) {
self.uiState = uiState
super.init(frame: .zero, textContainer: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if formattingActions.contains(action) { if formattingActions.contains(action) {
@ -164,14 +154,6 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
} }
} }
override func paste(_ sender: Any?) {
if UIPasteboard.general.contains(pasteboardTypes: CompositionAttachment.readableTypeIdentifiersForItemProvider) {
uiState.delegate?.paste(itemProviders: UIPasteboard.general.itemProviders)
} else {
super.paste(sender)
}
}
} }
class Coordinator: NSObject, UITextViewDelegate, ComposeInput, ComposeTextViewCaretScrolling { class Coordinator: NSObject, UITextViewDelegate, ComposeInput, ComposeTextViewCaretScrolling {

View File

@ -80,7 +80,7 @@ class MainSidebarMyProfileCollectionViewCell: UICollectionViewListCell {
return return
} }
config.imageProperties.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * avatarImageSize config.imageProperties.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * avatarImageSize
self.contentConfiguration = config self.contentConfiguration = contentConfiguration
} }
} }

View File

@ -245,7 +245,7 @@ extension SplitNavigationController: StatusBarTappableViewController {
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult { func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
let vcs = viewControllers let vcs = viewControllers
if !canShowSecondaryNav || vcs.count < 2 { if !canShowSecondaryNav || vcs.count < 2 {
return (vcs.last! as? StatusBarTappableViewController)?.handleStatusBarTapped(xPosition: xPosition) ?? .continue return (vcs.first! as? StatusBarTappableViewController)?.handleStatusBarTapped(xPosition: xPosition) ?? .continue
} else { } else {
let positionInRoot = rootNav.view.convert(CGPoint(x: xPosition, y: 0), from: view) let positionInRoot = rootNav.view.convert(CGPoint(x: xPosition, y: 0), from: view)
let positionInSecondary = secondaryNav.view.convert(CGPoint(x: xPosition, y: 0), from: view) let positionInSecondary = secondaryNav.view.convert(CGPoint(x: xPosition, y: 0), from: view)