From dbb8bd2a3d5186cc9c7228ecbd316f5c02ac3eae Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 29 Jan 2023 14:48:32 +0100 Subject: [PATCH] Fix out of bounds composer in the share sheet and in the app Fix #507 --- .../ShareViewController.swift | 9 ++ .../StatusEditorAccessoryView.swift | 103 +++++++++--------- .../Status/List/StatusesListView.swift | 1 + 3 files changed, 63 insertions(+), 50 deletions(-) diff --git a/IceCubesShareExtension/ShareViewController.swift b/IceCubesShareExtension/ShareViewController.swift index 7c0436c5..91f85bdb 100644 --- a/IceCubesShareExtension/ShareViewController.swift +++ b/IceCubesShareExtension/ShareViewController.swift @@ -37,6 +37,15 @@ class ShareViewController: UIViewController { childView.view.frame = self.view.bounds self.view.addSubview(childView.view) childView.didMove(toParent: self) + + childView.view.translatesAutoresizingMaskIntoConstraints = false + + NSLayoutConstraint.activate([ + childView.view.topAnchor.constraint(equalTo: self.view.topAnchor), + childView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), + childView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), + childView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor) + ]) } } diff --git a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift index 69342f4c..802b721e 100644 --- a/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift +++ b/Packages/Status/Sources/Status/Editor/Components/StatusEditorAccessoryView.swift @@ -21,67 +21,70 @@ struct StatusEditorAccessoryView: View { var body: some View { VStack(spacing: 0) { Divider() - HStack(alignment: .center, spacing: 16) { - PhotosPicker(selection: $viewModel.selectedMedias, - matching: .any(of: [.images, .videos])) { - if viewModel.isMediasLoading { - ProgressView() - } else { - Image(systemName: "photo.fill.on.rectangle.fill") - } - } - .disabled(viewModel.showPoll) + HStack { + ScrollView(.horizontal) { + HStack(alignment: .center, spacing: 16) { + PhotosPicker(selection: $viewModel.selectedMedias, + matching: .any(of: [.images, .videos])) { + if viewModel.isMediasLoading { + ProgressView() + } else { + Image(systemName: "photo.fill.on.rectangle.fill") + } + } + .disabled(viewModel.showPoll) - Button { - withAnimation { - viewModel.showPoll.toggle() - } - } label: { - Image(systemName: "chart.bar") - } - .disabled(viewModel.shouldDisablePollButton) + Button { + withAnimation { + viewModel.showPoll.toggle() + } + } label: { + Image(systemName: "chart.bar") + } + .disabled(viewModel.shouldDisablePollButton) - Button { - withAnimation { - viewModel.spoilerOn.toggle() - } - isSpoilerTextFocused.toggle() - } label: { - Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle") - } + Button { + withAnimation { + viewModel.spoilerOn.toggle() + } + isSpoilerTextFocused.toggle() + } label: { + Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle") + } - if !viewModel.mode.isInShareExtension { - Button { - isDraftsSheetDisplayed = true - } label: { - Image(systemName: "archivebox") - } - } + if !viewModel.mode.isInShareExtension { + Button { + isDraftsSheetDisplayed = true + } label: { + Image(systemName: "archivebox") + } + } - if !viewModel.customEmojis.isEmpty { - Button { - isCustomEmojisSheetDisplay = true - } label: { - Image(systemName: "face.smiling.inverse") - } - } + if !viewModel.customEmojis.isEmpty { + Button { + isCustomEmojisSheetDisplay = true + } label: { + Image(systemName: "face.smiling.inverse") + } + } - Button { - isLanguageSheetDisplayed.toggle() - } label: { - if let language = viewModel.selectedLanguage { - Text(language.uppercased()) - } else { - Image(systemName: "globe") + Button { + isLanguageSheetDisplayed.toggle() + } label: { + if let language = viewModel.selectedLanguage { + Text(language.uppercased()) + } else { + Image(systemName: "globe") + } + } } + .padding(.horizontal, .layoutPadding) } - Spacer() - characterCountView + .padding(.trailing, .layoutPadding) } .frame(height: 20) - .padding(.horizontal, .layoutPadding) .padding(.vertical, 12) .background(.ultraThinMaterial) } diff --git a/Packages/Status/Sources/Status/List/StatusesListView.swift b/Packages/Status/Sources/Status/List/StatusesListView.swift index 04ce92d6..a17cb3e4 100644 --- a/Packages/Status/Sources/Status/List/StatusesListView.swift +++ b/Packages/Status/Sources/Status/List/StatusesListView.swift @@ -20,6 +20,7 @@ public struct StatusesListView: View where Fetcher: StatusesFetcher { StatusRowView(viewModel: .init(status: status, isCompact: false)) .redacted(reason: .placeholder) .shimmering() + .padding(.horizontal, .layoutPadding) Divider() .padding(.vertical, .dividerPadding)