mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-23 15:40:37 +00:00
Composer: Better autocomplete fix #146
This commit is contained in:
parent
7b25240f59
commit
5cb010b216
2 changed files with 4 additions and 1 deletions
|
@ -188,7 +188,7 @@ public class Client: ObservableObject, Equatable {
|
|||
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
|
||||
let httpBody = NSMutableData()
|
||||
httpBody.append("--\(boundary)\r\n".data(using: .utf8)!)
|
||||
httpBody.append("Content-Disposition: form-data; name=\"\(filename)\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
|
||||
httpBody.append("Content-Disposition: form-data; name=\"\(filename)\"; filename=\"\(filename)\"\r\n".data(using: .utf8)!)
|
||||
httpBody.append("Content-Type: \(mimeType)\r\n".data(using: .utf8)!)
|
||||
httpBody.append("\r\n".data(using: .utf8)!)
|
||||
httpBody.append(data)
|
||||
|
|
|
@ -318,11 +318,13 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
|
||||
private func loadAutoCompleteResults(query: String) {
|
||||
guard let client, query.utf8.count > 1 else { return }
|
||||
var query = query
|
||||
Task {
|
||||
do {
|
||||
var results: SearchResults?
|
||||
switch query.first {
|
||||
case "#":
|
||||
query.removeFirst()
|
||||
results = try await client.get(endpoint: Search.search(query: query,
|
||||
type: "hashtags",
|
||||
offset: 0,
|
||||
|
@ -332,6 +334,7 @@ public class StatusEditorViewModel: ObservableObject {
|
|||
tagsSuggestions = results?.hashtags ?? []
|
||||
}
|
||||
case "@":
|
||||
query.removeFirst()
|
||||
results = try await client.get(endpoint: Search.search(query: query,
|
||||
type: "accounts",
|
||||
offset: 0,
|
||||
|
|
Loading…
Reference in a new issue