Compare commits
No commits in common. "cf63384dce2f365165f553f4ef1c861b3375b75c" and "0e60e74a8ac329e7f979c60c995669c1df9f949e" have entirely different histories.
cf63384dce
...
0e60e74a8a
|
@ -29,12 +29,6 @@ class Draft: Codable, ObservableObject {
|
|||
attachments.count > 0
|
||||
}
|
||||
|
||||
var textForPosting: String {
|
||||
// when using dictation, iOS sometimes leaves a U+FFFC OBJECT REPLACEMENT CHARACTER behind in the text,
|
||||
// which we want to strip out before actually posting the status
|
||||
text.replacingOccurrences(of: "\u{fffc}", with: "")
|
||||
}
|
||||
|
||||
init(accountID: String) {
|
||||
self.id = UUID()
|
||||
self.lastModified = Date()
|
||||
|
|
|
@ -197,7 +197,7 @@ struct ComposeView: View {
|
|||
self.isPosting = false
|
||||
|
||||
case let .success(uploadedAttachments):
|
||||
let request = Client.createStatus(text: draft.textForPosting,
|
||||
let request = Client.createStatus(text: draft.text,
|
||||
contentType: Preferences.shared.statusContentType,
|
||||
inReplyTo: draft.inReplyToID,
|
||||
media: uploadedAttachments,
|
||||
|
|
|
@ -149,18 +149,20 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
|
|||
context.coordinator.didChange = textDidChange
|
||||
context.coordinator.uiState = uiState
|
||||
|
||||
// wait until the next runloop iteration so that SwiftUI view updates have finished and
|
||||
// the text view knows its new content size
|
||||
DispatchQueue.main.async {
|
||||
self.textDidChange(uiView)
|
||||
|
||||
if becomeFirstResponder {
|
||||
if becomeFirstResponder {
|
||||
DispatchQueue.main.async {
|
||||
// calling becomeFirstResponder during the SwiftUI update causes a crash on iOS 13
|
||||
uiView.becomeFirstResponder()
|
||||
// can't update @State vars during the SwiftUI update
|
||||
becomeFirstResponder = false
|
||||
}
|
||||
}
|
||||
|
||||
// wait until the next runloop iteration so that SwiftUI view updates have finished and
|
||||
// the text view knows its new content size
|
||||
DispatchQueue.main.async {
|
||||
self.textDidChange(uiView)
|
||||
}
|
||||
}
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
|
|
Loading…
Reference in New Issue