Compare commits
No commits in common. "7f1247951420eae2db5b1ae3f778c4e2f5100c8a" and "3c9692d5b285ca3e94fbd66a93225a97ab70981a" have entirely different histories.
7f12479514
...
3c9692d5b2
|
@ -77,8 +77,7 @@ class PostService: ObservableObject {
|
|||
pollOptions: draft.poll?.pollOptions.map(\.text),
|
||||
pollExpiresIn: draft.poll == nil ? nil : Int(draft.poll!.duration),
|
||||
pollMultiple: draft.poll?.multiple,
|
||||
localOnly: mastodonController.instanceFeatures.localOnlyPosts ? draft.localOnly : nil,
|
||||
idempotencyKey: draft.id.uuidString
|
||||
localOnly: mastodonController.instanceFeatures.localOnlyPosts ? draft.localOnly : nil
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -113,9 +113,6 @@ public class Client {
|
|||
var urlRequest = URLRequest(url: url, timeoutInterval: timeoutInterval)
|
||||
urlRequest.httpMethod = request.method.name
|
||||
urlRequest.httpBody = request.body.data
|
||||
for (name, value) in request.headers {
|
||||
urlRequest.setValue(value, forHTTPHeaderField: name)
|
||||
}
|
||||
if let mimeType = request.body.mimeType {
|
||||
urlRequest.setValue(mimeType, forHTTPHeaderField: "Content-Type")
|
||||
}
|
||||
|
@ -400,22 +397,19 @@ public class Client {
|
|||
pollOptions: [String]? = nil,
|
||||
pollExpiresIn: Int? = nil,
|
||||
pollMultiple: Bool? = nil,
|
||||
localOnly: Bool? = nil, /* hometown only, not glitch */
|
||||
idempotencyKey: String) -> Request<Status> {
|
||||
var req = Request<Status>(method: .post, path: "/api/v1/statuses", body: ParametersBody([
|
||||
"status" => text,
|
||||
"content_type" => contentType.mimeType,
|
||||
"in_reply_to_id" => inReplyTo,
|
||||
"sensitive" => sensitive,
|
||||
"spoiler_text" => spoilerText,
|
||||
"visibility" => visibility?.rawValue,
|
||||
"language" => language,
|
||||
"poll[expires_in]" => pollExpiresIn,
|
||||
"poll[multiple]" => pollMultiple,
|
||||
"local_only" => localOnly,
|
||||
] + "media_ids" => mediaIDs + "poll[options]" => pollOptions))
|
||||
req.headers["Idempotency-Key"] = idempotencyKey
|
||||
return req
|
||||
localOnly: Bool? = nil /* hometown only, not glitch */) -> Request<Status> {
|
||||
return Request<Status>(method: .post, path: "/api/v1/statuses", body: ParametersBody([
|
||||
"status" => text,
|
||||
"content_type" => contentType.mimeType,
|
||||
"in_reply_to_id" => inReplyTo,
|
||||
"sensitive" => sensitive,
|
||||
"spoiler_text" => spoilerText,
|
||||
"visibility" => visibility?.rawValue,
|
||||
"language" => language,
|
||||
"poll[expires_in]" => pollExpiresIn,
|
||||
"poll[multiple]" => pollMultiple,
|
||||
"local_only" => localOnly,
|
||||
] + "media_ids" => mediaIDs + "poll[options]" => pollOptions))
|
||||
}
|
||||
|
||||
public static func editStatus(
|
||||
|
|
|
@ -13,7 +13,6 @@ public struct Request<ResultType: Decodable>: Sendable {
|
|||
let endpoint: Endpoint
|
||||
let body: Body
|
||||
var queryParameters: [Parameter]
|
||||
var headers: [String: String] = [:]
|
||||
var additionalAcceptableHTTPCodes: [Int] = []
|
||||
|
||||
init(method: Method, path: Endpoint, body: Body = EmptyBody(), queryParameters: [Parameter] = []) {
|
||||
|
|
|
@ -79,14 +79,7 @@ class ShareViewController: UIViewController {
|
|||
var attachments: [DraftAttachment] = []
|
||||
|
||||
for itemProvider in inputItem.attachments ?? [] {
|
||||
// attachments have the highest priority, but only given this heuristic
|
||||
// otherwise attachment decoding ends up being overzealous
|
||||
let likelyAttachment = [UTType.image, .movie].contains(where: { itemProvider.hasItemConformingToTypeIdentifier($0.identifier) })
|
||||
|
||||
if likelyAttachment,
|
||||
let attachment: DraftAttachment = await getObject(from: itemProvider) {
|
||||
attachments.append(attachment)
|
||||
} else if let attached: NSURL = await getObject(from: itemProvider) {
|
||||
if let attached: NSURL = await getObject(from: itemProvider) {
|
||||
if url == nil {
|
||||
url = attached as URL
|
||||
}
|
||||
|
@ -94,6 +87,8 @@ class ShareViewController: UIViewController {
|
|||
if text.isEmpty {
|
||||
text = s as String
|
||||
}
|
||||
} else if let attachment: DraftAttachment = await getObject(from: itemProvider) {
|
||||
attachments.append(attachment)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue