37 lines
1002 B
Swift
37 lines
1002 B
Swift
//
|
|
// UnpinStatusActivity.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 1/4/20.
|
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import Pachyderm
|
|
|
|
class UnpinStatusActivity: StatusActivity {
|
|
override var activityType: UIActivity.ActivityType? {
|
|
return .unpinStatus
|
|
}
|
|
|
|
override var activityTitle: String? {
|
|
return NSLocalizedString("Unpin", comment: "unpin status activity title")
|
|
}
|
|
|
|
override var activityImage: UIImage? {
|
|
return UIImage(systemName: "pin.slash")
|
|
}
|
|
|
|
override func perform() {
|
|
guard let status = status else { return }
|
|
|
|
let request = Status.unpin(status)
|
|
mastodonController.run(request).then { (status, _) -> Void in
|
|
self.mastodonController.cache.add(status: status)
|
|
}.catch { (error) -> Void in
|
|
print("could not unpin status: \(error)")
|
|
UINotificationFeedbackGenerator().notificationOccurred(.error)
|
|
}
|
|
}
|
|
}
|