42 lines
1.1 KiB
Swift
42 lines
1.1 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) { (response) in
|
|
if case let .success(status, _) = response {
|
|
self.mastodonController.cache.add(status: status)
|
|
} else {
|
|
// todo: display error message
|
|
UINotificationFeedbackGenerator().notificationOccurred(.error)
|
|
fatalError()
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|