39 lines
1.0 KiB
Swift
39 lines
1.0 KiB
Swift
//
|
|
// UnbookmarkStatusActivity.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 12/14/19.
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import Pachyderm
|
|
|
|
class UnbookmarkStatusActivity: StatusActivity {
|
|
|
|
override var activityType: UIActivity.ActivityType? {
|
|
return .unbookmarkStatus
|
|
}
|
|
|
|
override var activityTitle: String? {
|
|
return NSLocalizedString("Unbookmark", comment: "unbookmark status activity title")
|
|
}
|
|
|
|
override var activityImage: UIImage? {
|
|
return UIImage(systemName: "bookmark.fill")
|
|
}
|
|
|
|
override func perform() {
|
|
guard let status = status else { return }
|
|
|
|
let request = Status.unbookmark(status)
|
|
mastodonController.run(request).then { (status, _) -> Void in
|
|
self.mastodonController.cache.add(status: status)
|
|
}.catch { (error) -> Void in
|
|
print("could not unbookmark status: \(error)")
|
|
UINotificationFeedbackGenerator().notificationOccurred(.error)
|
|
}
|
|
}
|
|
|
|
}
|