Fx more actions not workign
This commit is contained in:
parent
cf48e4e973
commit
d4bf289716
|
@ -80,28 +80,28 @@ public final class Status: /*StatusProtocol,*/ Decodable {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unfavourite")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unfavourite")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func pin(_ status: Status) -> Request<Status> {
|
public static func pin(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/pin")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/pin")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func unpin(_ status: Status) -> Request<Status> {
|
public static func unpin(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/unpin")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unpin")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func bookmark(_ status: Status) -> Request<Status> {
|
public static func bookmark(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/bookmark")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/bookmark")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func unbookmark(_ statusID: String) -> Request<Status> {
|
public static func unbookmark(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unbookmark")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unbookmark")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func muteConversation(_ status: Status) -> Request<Status> {
|
public static func muteConversation(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/mute")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/mute")
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func unmuteConversation(_ status: Status) -> Request<Status> {
|
public static func unmuteConversation(_ statusID: String) -> Request<Status> {
|
||||||
return Request<Status>(method: .post, path: "/api/v1/statuses/\(status.id)/unmute")
|
return Request<Status>(method: .post, path: "/api/v1/statuses/\(statusID)/unmute")
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
|
||||||
|
|
||||||
class AccountActivity: MastodonActivity {
|
class AccountActivity: MastodonActivity {
|
||||||
|
|
||||||
|
@ -15,17 +14,17 @@ class AccountActivity: MastodonActivity {
|
||||||
return .action
|
return .action
|
||||||
}
|
}
|
||||||
|
|
||||||
var account: Account?
|
var account: AccountMO?
|
||||||
|
|
||||||
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
||||||
for case is Account in activityItems {
|
for case is AccountMO in activityItems {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override func prepare(withActivityItems activityItems: [Any]) {
|
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
|
self.account = account
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class BookmarkStatusActivity: StatusActivity {
|
||||||
override func perform() {
|
override func perform() {
|
||||||
guard let status = status else { return }
|
guard let status = status else { return }
|
||||||
|
|
||||||
let request = Status.bookmark(status)
|
let request = Status.bookmark(status.id)
|
||||||
mastodonController.run(request) { (response) in
|
mastodonController.run(request) { (response) in
|
||||||
if case let .success(status, _) = response {
|
if case let .success(status, _) = response {
|
||||||
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class PinStatusActivity: StatusActivity {
|
||||||
override func perform() {
|
override func perform() {
|
||||||
guard let status = status else { return }
|
guard let status = status else { return }
|
||||||
|
|
||||||
let request = Status.pin(status)
|
let request = Status.pin(status.id)
|
||||||
mastodonController.run(request) { (response) in
|
mastodonController.run(request) { (response) in
|
||||||
if case let .success(status, _) = response {
|
if case let .success(status, _) = response {
|
||||||
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
|
||||||
|
|
||||||
class StatusActivity: MastodonActivity {
|
class StatusActivity: MastodonActivity {
|
||||||
|
|
||||||
|
@ -15,17 +14,17 @@ class StatusActivity: MastodonActivity {
|
||||||
return .action
|
return .action
|
||||||
}
|
}
|
||||||
|
|
||||||
var status: Status?
|
var status: StatusMO?
|
||||||
|
|
||||||
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
|
||||||
for case is Status in activityItems {
|
for case is StatusMO in activityItems {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override func prepare(withActivityItems activityItems: [Any]) {
|
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
|
self.status = status
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class UnpinStatusActivity: StatusActivity {
|
||||||
override func perform() {
|
override func perform() {
|
||||||
guard let status = status else { return }
|
guard let status = status else { return }
|
||||||
|
|
||||||
let request = Status.unpin(status)
|
let request = Status.unpin(status.id)
|
||||||
mastodonController.run(request) { (response) in
|
mastodonController.run(request) { (response) in
|
||||||
if case let .success(status, _) = response {
|
if case let .success(status, _) = response {
|
||||||
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
self.mastodonController.persistentContainer.addOrUpdate(status: status, incrementReferenceCount: false)
|
||||||
|
|
Loading…
Reference in New Issue