Few fixes for the field in DM + fix async upload for images

This commit is contained in:
Thomas Ricouard 2023-01-22 17:49:47 +01:00
parent a20d259bb2
commit b527fafd37
2 changed files with 6 additions and 2 deletions

View file

@ -115,11 +115,12 @@ public struct ConversationDetailView: View {
} label: { } label: {
Image(systemName: "plus") Image(systemName: "plus")
} }
.padding(.bottom, 5) .padding(.bottom, 6)
TextField("New messge", text: $viewModel.newMessageText, axis: .vertical) TextField("New messge", text: $viewModel.newMessageText, axis: .vertical)
.textFieldStyle(.roundedBorder) .textFieldStyle(.roundedBorder)
.focused($isMessageFieldFocused) .focused($isMessageFieldFocused)
.keyboardType(.default) .keyboardType(.default)
.font(.scaledBody)
if !viewModel.newMessageText.isEmpty { if !viewModel.newMessageText.isEmpty {
Button { Button {
Task { Task {
@ -132,7 +133,7 @@ public struct ConversationDetailView: View {
Image(systemName: "paperplane") Image(systemName: "paperplane")
} }
} }
.keyboardShortcut("n", modifiers: .command) .keyboardShortcut(.return, modifiers: .command)
.padding(.bottom, 5) .padding(.bottom, 5)
} }
} }

View file

@ -482,6 +482,9 @@ public class StatusEditorViewModel: ObservableObject {
movieTransferable: nil, movieTransferable: nil,
mediaAttachment: uploadedMedia, mediaAttachment: uploadedMedia,
error: nil) error: nil)
if let uploadedMedia, uploadedMedia.url == nil {
scheduleAsyncMediaRefresh(mediaAttachement: uploadedMedia)
}
} else if let videoURL = originalContainer.movieTransferable?.url, } else if let videoURL = originalContainer.movieTransferable?.url,
let data = try? Data(contentsOf: videoURL) { let data = try? Data(contentsOf: videoURL) {
let uploadedMedia = try await uploadMedia(data: data, mimeType: videoURL.mimeType()) let uploadedMedia = try await uploadMedia(data: data, mimeType: videoURL.mimeType())