This commit is contained in:
Thomas Ricouard 2023-10-16 09:16:17 +02:00
parent 518e69d49d
commit f08c90f8a0
2 changed files with 9 additions and 6 deletions

View file

@ -10,7 +10,7 @@ struct StatusEditorMediaView: View {
@Environment(Theme.self) private var theme
@Environment(CurrentInstance.self) private var currentInstance
var viewModel: StatusEditorViewModel
@State private var editingContainer: StatusEditorMediaContainer?
@Binding var editingContainer: StatusEditorMediaContainer?
@State private var isErrorDisplayed: Bool = false
@ -40,10 +40,6 @@ struct StatusEditorMediaView: View {
}
.padding(.horizontal, .layoutPadding)
}
.sheet(item: $editingContainer) { container in
StatusEditorMediaEditView(viewModel: viewModel, container: container)
.preferredColorScheme(theme.selectedScheme == .dark ? .dark : .light)
}
}
private func makeVideoAttachement(container: StatusEditorMediaContainer) -> some View {

View file

@ -26,6 +26,8 @@ public struct StatusEditorView: View {
@State private var isDismissAlertPresented: Bool = false
@State private var isLanguageConfirmPresented = false
@State private var editingContainer: StatusEditorMediaContainer?
public init(mode: StatusEditorViewModel.Mode) {
_viewModel = .init(initialValue: .init(mode: mode))
@ -47,7 +49,8 @@ public struct StatusEditorView: View {
.placeholder(String(localized: "status.editor.text.placeholder"))
.setKeyboardType(preferences.isSocialKeyboardEnabled ? .twitter : .default)
.padding(.horizontal, .layoutPadding)
StatusEditorMediaView(viewModel: viewModel)
StatusEditorMediaView(viewModel: viewModel,
editingContainer: $editingContainer)
if let status = viewModel.embeddedStatus {
StatusEmbeddedView(status: status, client: client, routerPath: RouterPath())
.padding(.horizontal, .layoutPadding)
@ -166,6 +169,10 @@ public struct StatusEditorView: View {
}
}
}
.sheet(item: $editingContainer) { container in
StatusEditorMediaEditView(viewModel: viewModel, container: container)
.preferredColorScheme(theme.selectedScheme == .dark ? .dark : .light)
}
.interactiveDismissDisabled(viewModel.shouldDisplayDismissWarning)
.onChange(of: appAccounts.currentClient) { _, newValue in
if viewModel.mode.isInShareExtension {