Fx more actions not workign

This commit is contained in:
Shadowfacts 2020-05-14 21:57:00 -04:00
parent cf48e4e973
commit d4bf289716
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
6 changed files with 19 additions and 21 deletions

View File

@ -80,28 +80,28 @@ public final class Status: /*StatusProtocol,*/ Decodable {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unfavourite")
}
public static func pin(_ status: Status) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/pin")
public static func pin(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/pin")
}
public static func unpin(_ status: Status) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/unpin")
public static func unpin(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unpin")
}
public static func bookmark(_ status: Status) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/bookmark")
public static func bookmark(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/bookmark")
}
public static func unbookmark(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unbookmark")
}
public static func muteConversation(_ status: Status) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/mute")
public static func muteConversation(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/mute")
}
public static func unmuteConversation(_ status: Status) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/unmute")
public static func unmuteConversation(_ statusID: String) -> Request<Status> {
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unmute")
}
private enum CodingKeys: String, CodingKey {

View File

@ -7,7 +7,6 @@
//
import UIKit
import Pachyderm
class AccountActivity: MastodonActivity {
@ -15,17 +14,17 @@ class AccountActivity: MastodonActivity {
return .action
}
var account: Account?
var account: AccountMO?
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
for case is Account in activityItems {
for case is AccountMO in activityItems {
return true
}
return false
}
override func prepare(withActivityItems activityItems: [Any]) {
for case let account as Account in activityItems {
for case let account as AccountMO in activityItems {
self.account = account
return
}

View File

@ -26,7 +26,7 @@ class BookmarkStatusActivity: StatusActivity {
override func perform() {
guard let status = status else { return }
let request = Status.bookmark(status)
let request = Status.bookmark(status.id)
mastodonController.run(request) { (response) in
if case let .success(status, _) = response {
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)

View File

@ -25,7 +25,7 @@ class PinStatusActivity: StatusActivity {
override func perform() {
guard let status = status else { return }
let request = Status.pin(status)
let request = Status.pin(status.id)
mastodonController.run(request) { (response) in
if case let .success(status, _) = response {
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)

View File

@ -7,7 +7,6 @@
//
import UIKit
import Pachyderm
class StatusActivity: MastodonActivity {
@ -15,17 +14,17 @@ class StatusActivity: MastodonActivity {
return .action
}
var status: Status?
var status: StatusMO?
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
for case is Status in activityItems {
for case is StatusMO in activityItems {
return true
}
return false
}
override func prepare(withActivityItems activityItems: [Any]) {
for case let status as Status in activityItems {
for case let status as StatusMO in activityItems {
self.status = status
return
}

View File

@ -25,7 +25,7 @@ class UnpinStatusActivity: StatusActivity {
override func perform() {
guard let status = status else { return }
let request = Status.unpin(status)
let request = Status.unpin(status.id)
mastodonController.run(request) { (response) in
if case let .success(status, _) = response {
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)