Fix out of bounds composer in the share sheet and in the app Fix #507

This commit is contained in:
Thomas Ricouard 2023-01-29 14:48:32 +01:00
parent e5b6e79fa9
commit dbb8bd2a3d
3 changed files with 63 additions and 50 deletions

View File

@ -37,6 +37,15 @@ class ShareViewController: UIViewController {
childView.view.frame = self.view.bounds childView.view.frame = self.view.bounds
self.view.addSubview(childView.view) self.view.addSubview(childView.view)
childView.didMove(toParent: self) 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)
])
} }
} }

View File

@ -21,67 +21,70 @@ struct StatusEditorAccessoryView: View {
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
Divider() Divider()
HStack(alignment: .center, spacing: 16) { HStack {
PhotosPicker(selection: $viewModel.selectedMedias, ScrollView(.horizontal) {
matching: .any(of: [.images, .videos])) { HStack(alignment: .center, spacing: 16) {
if viewModel.isMediasLoading { PhotosPicker(selection: $viewModel.selectedMedias,
ProgressView() matching: .any(of: [.images, .videos])) {
} else { if viewModel.isMediasLoading {
Image(systemName: "photo.fill.on.rectangle.fill") ProgressView()
} } else {
} Image(systemName: "photo.fill.on.rectangle.fill")
.disabled(viewModel.showPoll) }
}
.disabled(viewModel.showPoll)
Button { Button {
withAnimation { withAnimation {
viewModel.showPoll.toggle() viewModel.showPoll.toggle()
} }
} label: { } label: {
Image(systemName: "chart.bar") Image(systemName: "chart.bar")
} }
.disabled(viewModel.shouldDisablePollButton) .disabled(viewModel.shouldDisablePollButton)
Button { Button {
withAnimation { withAnimation {
viewModel.spoilerOn.toggle() viewModel.spoilerOn.toggle()
} }
isSpoilerTextFocused.toggle() isSpoilerTextFocused.toggle()
} label: { } label: {
Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle") Image(systemName: viewModel.spoilerOn ? "exclamationmark.triangle.fill" : "exclamationmark.triangle")
} }
if !viewModel.mode.isInShareExtension { if !viewModel.mode.isInShareExtension {
Button { Button {
isDraftsSheetDisplayed = true isDraftsSheetDisplayed = true
} label: { } label: {
Image(systemName: "archivebox") Image(systemName: "archivebox")
} }
} }
if !viewModel.customEmojis.isEmpty { if !viewModel.customEmojis.isEmpty {
Button { Button {
isCustomEmojisSheetDisplay = true isCustomEmojisSheetDisplay = true
} label: { } label: {
Image(systemName: "face.smiling.inverse") Image(systemName: "face.smiling.inverse")
} }
} }
Button { Button {
isLanguageSheetDisplayed.toggle() isLanguageSheetDisplayed.toggle()
} label: { } label: {
if let language = viewModel.selectedLanguage { if let language = viewModel.selectedLanguage {
Text(language.uppercased()) Text(language.uppercased())
} else { } else {
Image(systemName: "globe") Image(systemName: "globe")
}
}
} }
.padding(.horizontal, .layoutPadding)
} }
Spacer() Spacer()
characterCountView characterCountView
.padding(.trailing, .layoutPadding)
} }
.frame(height: 20) .frame(height: 20)
.padding(.horizontal, .layoutPadding)
.padding(.vertical, 12) .padding(.vertical, 12)
.background(.ultraThinMaterial) .background(.ultraThinMaterial)
} }

View File

@ -20,6 +20,7 @@ public struct StatusesListView<Fetcher>: View where Fetcher: StatusesFetcher {
StatusRowView(viewModel: .init(status: status, isCompact: false)) StatusRowView(viewModel: .init(status: status, isCompact: false))
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
.shimmering() .shimmering()
.padding(.horizontal, .layoutPadding) .padding(.horizontal, .layoutPadding)
Divider() Divider()
.padding(.vertical, .dividerPadding) .padding(.vertical, .dividerPadding)