2019-11-19 17:08:11 +00:00
|
|
|
//
|
|
|
|
// TimelineStatusTableViewCell.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 8/16/18.
|
|
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import Combine
|
|
|
|
import Pachyderm
|
|
|
|
|
|
|
|
class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|
|
|
|
|
|
|
static let relativeDateFormatter: RelativeDateTimeFormatter = {
|
|
|
|
let formatter = RelativeDateTimeFormatter()
|
|
|
|
formatter.dateTimeStyle = .numeric
|
2021-06-07 02:12:50 +00:00
|
|
|
formatter.unitsStyle = .full
|
2019-11-19 17:08:11 +00:00
|
|
|
return formatter
|
|
|
|
}()
|
|
|
|
|
2020-03-02 00:40:32 +00:00
|
|
|
@IBOutlet weak var reblogLabel: EmojiLabel!
|
2022-07-11 18:42:49 +00:00
|
|
|
@IBOutlet weak var reblogSpacer: UIView!
|
2019-11-19 17:08:11 +00:00
|
|
|
@IBOutlet weak var timestampLabel: UILabel!
|
|
|
|
@IBOutlet weak var pinImageView: UIImageView!
|
2022-04-08 22:42:15 +00:00
|
|
|
@IBOutlet weak var actionsContainerView: UIView!
|
|
|
|
@IBOutlet weak var actionsContainerHeightConstraint: NSLayoutConstraint!
|
|
|
|
@IBOutlet weak var verticalStackToActionsContainerConstraint: NSLayoutConstraint!
|
|
|
|
@IBOutlet weak var verticalStackToSuperviewConstraint: NSLayoutConstraint!
|
2019-11-19 17:08:11 +00:00
|
|
|
|
|
|
|
var reblogStatusID: String?
|
|
|
|
var rebloggerID: String?
|
|
|
|
|
2020-06-17 03:00:48 +00:00
|
|
|
var showPinned = false
|
|
|
|
var showReplyIndicator = true
|
2019-11-19 17:08:11 +00:00
|
|
|
|
|
|
|
var updateTimestampWorkItem: DispatchWorkItem?
|
|
|
|
|
|
|
|
var rebloggerAccountUpdater: Cancellable?
|
|
|
|
|
|
|
|
deinit {
|
|
|
|
rebloggerAccountUpdater?.cancel()
|
2020-01-20 04:10:52 +00:00
|
|
|
updateTimestampWorkItem?.cancel()
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
override func awakeFromNib() {
|
|
|
|
super.awakeFromNib()
|
2022-11-04 02:15:54 +00:00
|
|
|
|
|
|
|
isAccessibilityElement = true
|
2020-08-16 18:40:06 +00:00
|
|
|
|
2022-11-04 02:15:54 +00:00
|
|
|
reblogLabel.font = .preferredFont(forTextStyle: .body)
|
|
|
|
reblogLabel.adjustsFontForContentSizeCategory = true
|
2019-11-19 17:08:11 +00:00
|
|
|
reblogLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(reblogLabelPressed)))
|
2022-11-04 02:15:54 +00:00
|
|
|
|
|
|
|
avatarImageView.addInteraction(UIContextMenuInteraction(delegate: self))
|
|
|
|
|
|
|
|
displayNameLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).addingAttributes([
|
|
|
|
.traits: [
|
|
|
|
UIFontDescriptor.TraitKey.weight: UIFont.Weight.semibold.rawValue,
|
|
|
|
]
|
|
|
|
]), size: 0)
|
|
|
|
displayNameLabel.adjustsFontForContentSizeCategory = true
|
|
|
|
|
|
|
|
usernameLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).addingAttributes([
|
|
|
|
.traits: [
|
|
|
|
UIFontDescriptor.TraitKey.weight: UIFont.Weight.light.rawValue,
|
|
|
|
]
|
|
|
|
]), size: 0)
|
|
|
|
usernameLabel.adjustsFontForContentSizeCategory = true
|
|
|
|
|
|
|
|
timestampLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).addingAttributes([
|
|
|
|
.traits: [
|
|
|
|
UIFontDescriptor.TraitKey.weight: UIFont.Weight.light.rawValue,
|
|
|
|
]
|
|
|
|
]), size: 0)
|
|
|
|
timestampLabel.adjustsFontForContentSizeCategory = true
|
2019-11-19 17:08:11 +00:00
|
|
|
|
2022-11-04 02:15:54 +00:00
|
|
|
metaIndicatorsView.primaryAxis = .vertical
|
|
|
|
metaIndicatorsView.secondaryAxisAlignment = .trailing
|
2020-08-16 18:40:06 +00:00
|
|
|
|
2022-11-04 02:15:54 +00:00
|
|
|
contentWarningLabel.font = UIFont(descriptor: .preferredFontDescriptor(withTextStyle: .body).addingAttributes([
|
|
|
|
.traits: [
|
|
|
|
UIFontDescriptor.TraitKey.weight: UIFont.Weight.bold.rawValue,
|
|
|
|
]
|
|
|
|
]), size: 0)
|
|
|
|
contentWarningLabel.adjustsFontForContentSizeCategory = true
|
2020-09-07 22:49:25 +00:00
|
|
|
|
2022-11-04 02:15:54 +00:00
|
|
|
contentTextView.defaultFont = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 16))
|
|
|
|
contentTextView.adjustsFontForContentSizeCategory = true
|
2021-04-28 23:11:41 +00:00
|
|
|
|
2022-11-04 02:15:54 +00:00
|
|
|
// todo: double check this on RTL layouts
|
|
|
|
replyButton.imageView!.leadingAnchor.constraint(equalTo: contentTextView.leadingAnchor).isActive = true
|
2022-04-08 22:42:15 +00:00
|
|
|
|
|
|
|
updateActionsVisibility()
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
2020-01-06 00:54:28 +00:00
|
|
|
|
|
|
|
override func createObserversIfNecessary() {
|
|
|
|
super.createObserversIfNecessary()
|
|
|
|
|
2020-05-02 16:45:28 +00:00
|
|
|
if rebloggerAccountUpdater == nil {
|
|
|
|
rebloggerAccountUpdater = mastodonController.persistentContainer.accountSubject
|
|
|
|
.receive(on: DispatchQueue.main)
|
2021-06-26 20:51:54 +00:00
|
|
|
.filter { [unowned self] in $0 == self.rebloggerID }
|
2020-05-02 16:45:28 +00:00
|
|
|
.sink { [unowned self] in
|
2020-08-16 19:06:19 +00:00
|
|
|
if let mastodonController = self.mastodonController,
|
|
|
|
let reblogger = mastodonController.persistentContainer.account(for: $0) {
|
2020-05-02 16:45:28 +00:00
|
|
|
self.updateRebloggerLabel(reblogger: reblogger)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-06 00:54:28 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 23:38:49 +00:00
|
|
|
override func doUpdateUI(status: StatusMO, state: StatusState) {
|
|
|
|
var status = status
|
|
|
|
|
2020-04-12 16:54:27 +00:00
|
|
|
if let rebloggedStatus = status.reblog {
|
2019-11-19 17:08:11 +00:00
|
|
|
reblogStatusID = statusID
|
|
|
|
rebloggerID = status.account.id
|
|
|
|
reblogLabel.isHidden = false
|
2022-07-11 18:42:49 +00:00
|
|
|
reblogSpacer.isHidden = false
|
2020-06-16 03:22:34 +00:00
|
|
|
updateRebloggerLabel(reblogger: status.account)
|
2020-06-17 02:01:01 +00:00
|
|
|
|
|
|
|
status = rebloggedStatus
|
2022-01-23 15:58:36 +00:00
|
|
|
// necessary b/c statusID is initially set to the reblog status ID in updateUI(statusID:state:)
|
2020-09-17 23:38:49 +00:00
|
|
|
statusID = rebloggedStatus.id
|
2019-11-19 17:08:11 +00:00
|
|
|
} else {
|
|
|
|
reblogStatusID = nil
|
|
|
|
rebloggerID = nil
|
|
|
|
reblogLabel.isHidden = true
|
2022-07-11 18:42:49 +00:00
|
|
|
reblogSpacer.isHidden = true
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
2020-09-17 23:38:49 +00:00
|
|
|
super.doUpdateUI(status: status, state: state)
|
|
|
|
|
|
|
|
doUpdateTimestamp(status: status)
|
2019-11-19 17:08:11 +00:00
|
|
|
|
2022-02-04 04:16:31 +00:00
|
|
|
timestampLabel.isHidden = showPinned
|
|
|
|
pinImageView.isHidden = !showPinned
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 18:59:58 +00:00
|
|
|
override func updateGrayscaleableUI(account: AccountMO, status: StatusMO) {
|
|
|
|
super.updateGrayscaleableUI(account: account, status: status)
|
2020-06-17 21:45:34 +00:00
|
|
|
|
2019-11-19 17:08:11 +00:00
|
|
|
if let rebloggerID = rebloggerID,
|
2020-12-29 16:56:40 +00:00
|
|
|
reblogLabel.hasEmojis,
|
2020-04-12 16:54:27 +00:00
|
|
|
let reblogger = mastodonController.persistentContainer.account(for: rebloggerID) {
|
2019-11-19 17:08:11 +00:00
|
|
|
updateRebloggerLabel(reblogger: reblogger)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-12 16:54:27 +00:00
|
|
|
private func updateRebloggerLabel(reblogger: AccountMO) {
|
2020-03-02 00:40:32 +00:00
|
|
|
if Preferences.shared.hideCustomEmojiInUsernames {
|
|
|
|
reblogLabel.text = "Reblogged by \(reblogger.displayNameWithoutCustomEmoji)"
|
|
|
|
reblogLabel.removeEmojis()
|
|
|
|
} else {
|
|
|
|
reblogLabel.text = "Reblogged by \(reblogger.displayOrUserName)"
|
|
|
|
reblogLabel.setEmojis(reblogger.emojis, identifier: reblogger.id)
|
|
|
|
}
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
2020-06-17 22:00:13 +00:00
|
|
|
override func updateStatusIconsForPreferences(_ status: StatusMO) {
|
2022-01-23 15:58:36 +00:00
|
|
|
if showReplyIndicator {
|
|
|
|
metaIndicatorsView.allowedIndicators = .all
|
|
|
|
} else {
|
|
|
|
metaIndicatorsView.allowedIndicators = .all.subtracting(.reply)
|
|
|
|
}
|
2022-04-08 22:42:15 +00:00
|
|
|
|
|
|
|
let oldState = actionsContainerView.isHidden
|
|
|
|
if oldState != Preferences.shared.hideActionsInTimeline {
|
|
|
|
updateActionsVisibility()
|
2022-07-11 18:42:49 +00:00
|
|
|
if #available(iOS 16.0, *) {
|
|
|
|
invalidateIntrinsicContentSize()
|
|
|
|
} else {
|
|
|
|
// not really accurate, but it notifies the vc our height has changed
|
|
|
|
delegate?.statusCellCollapsedStateChanged(self)
|
|
|
|
}
|
2022-04-08 22:42:15 +00:00
|
|
|
}
|
|
|
|
|
2020-06-17 22:00:13 +00:00
|
|
|
super.updateStatusIconsForPreferences(status)
|
2020-06-17 21:45:34 +00:00
|
|
|
}
|
|
|
|
|
2022-04-08 22:42:15 +00:00
|
|
|
private func updateActionsVisibility() {
|
|
|
|
if Preferences.shared.hideActionsInTimeline {
|
|
|
|
actionsContainerView.isHidden = true
|
|
|
|
} else {
|
|
|
|
actionsContainerView.isHidden = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 23:38:49 +00:00
|
|
|
private func updateTimestamp() {
|
2020-03-15 16:17:19 +00:00
|
|
|
// if the mastodonController is nil (i.e. the delegate is nil), then the screen this cell was a part of has been deallocated
|
|
|
|
// so we bail out immediately, since there's nothing to update
|
2021-01-13 03:17:30 +00:00
|
|
|
// if the status cannot be found, it may have already been discarded due to not being on screen, so we do nothing
|
|
|
|
guard let mastodonController = mastodonController,
|
|
|
|
let status = mastodonController.persistentContainer.status(for: statusID) else { return }
|
2019-11-19 17:08:11 +00:00
|
|
|
|
2020-09-17 23:38:49 +00:00
|
|
|
doUpdateTimestamp(status: status)
|
|
|
|
}
|
|
|
|
|
|
|
|
private func doUpdateTimestamp(status: StatusMO) {
|
2019-11-19 17:08:11 +00:00
|
|
|
timestampLabel.text = status.createdAt.timeAgoString()
|
|
|
|
|
|
|
|
let delay: DispatchTimeInterval?
|
|
|
|
switch status.createdAt.timeAgo().1 {
|
|
|
|
case .second:
|
|
|
|
delay = .seconds(10)
|
|
|
|
case .minute:
|
|
|
|
delay = .seconds(60)
|
|
|
|
default:
|
|
|
|
delay = nil
|
|
|
|
}
|
|
|
|
if let delay = delay {
|
2020-03-01 23:33:44 +00:00
|
|
|
if updateTimestampWorkItem == nil {
|
|
|
|
updateTimestampWorkItem = DispatchWorkItem { [weak self] in
|
|
|
|
self?.updateTimestamp()
|
|
|
|
}
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: updateTimestampWorkItem!)
|
|
|
|
} else {
|
|
|
|
updateTimestampWorkItem = nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 04:48:36 +00:00
|
|
|
func reply() {
|
|
|
|
if Preferences.shared.mentionReblogger,
|
|
|
|
let rebloggerID = rebloggerID,
|
2020-05-02 23:52:35 +00:00
|
|
|
let rebloggerAccount = mastodonController.persistentContainer.account(for: rebloggerID) {
|
2020-08-31 23:28:50 +00:00
|
|
|
delegate?.compose(inReplyToID: statusID, mentioningAcct: rebloggerAccount.acct)
|
2020-01-20 04:48:36 +00:00
|
|
|
} else {
|
2020-08-31 23:28:50 +00:00
|
|
|
delegate?.compose(inReplyToID: statusID)
|
2020-01-20 04:48:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-19 17:08:11 +00:00
|
|
|
override func prepareForReuse() {
|
|
|
|
super.prepareForReuse()
|
|
|
|
updateTimestampWorkItem?.cancel()
|
|
|
|
updateTimestampWorkItem = nil
|
|
|
|
showPinned = false
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc func reblogLabelPressed() {
|
|
|
|
guard let rebloggerID = rebloggerID else { return }
|
|
|
|
delegate?.selected(account: rebloggerID)
|
|
|
|
}
|
|
|
|
|
2020-01-20 04:48:36 +00:00
|
|
|
override func replyPressed() {
|
|
|
|
reply()
|
|
|
|
}
|
|
|
|
|
2021-06-07 02:12:50 +00:00
|
|
|
// MARK: - Accessibility
|
|
|
|
|
2022-11-12 20:04:44 +00:00
|
|
|
override var accessibilityAttributedLabel: NSAttributedString? {
|
2021-06-07 02:12:50 +00:00
|
|
|
get {
|
|
|
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
|
|
|
|
return nil
|
|
|
|
}
|
2022-11-12 20:04:44 +00:00
|
|
|
var str = AttributedString("\(status.account.displayOrUserName), ")
|
|
|
|
if statusState.collapsed ?? false {
|
|
|
|
if !status.spoilerText.isEmpty {
|
|
|
|
str += AttributedString(status.spoilerText)
|
|
|
|
str += ", "
|
|
|
|
}
|
|
|
|
str += "collapsed"
|
|
|
|
} else {
|
|
|
|
str += AttributedString(contentTextView.attributedText)
|
|
|
|
}
|
|
|
|
|
2021-06-07 02:12:50 +00:00
|
|
|
if status.attachments.count > 0 {
|
2022-11-12 20:04:44 +00:00
|
|
|
// TODO: localize me
|
|
|
|
str += AttributedString(", \(status.attachments.count) attachment\(status.attachments.count > 1 ? "s" : "")")
|
2021-06-07 02:12:50 +00:00
|
|
|
}
|
|
|
|
if status.poll != nil {
|
|
|
|
str += ", poll"
|
|
|
|
}
|
2022-11-12 20:04:44 +00:00
|
|
|
str += AttributedString(", \(status.createdAt.formatted(.relative(presentation: .numeric)))")
|
|
|
|
if status.visibility < .unlisted {
|
|
|
|
str += AttributedString(", \(status.visibility.displayName)")
|
|
|
|
}
|
|
|
|
if status.localOnly {
|
|
|
|
str += ", local"
|
|
|
|
}
|
|
|
|
if let rebloggerID,
|
2021-06-07 02:12:50 +00:00
|
|
|
let reblogger = mastodonController.persistentContainer.account(for: rebloggerID) {
|
2022-11-12 20:04:44 +00:00
|
|
|
str += AttributedString(", reblogged by \(reblogger.displayOrUserName)")
|
|
|
|
}
|
|
|
|
return NSAttributedString(str)
|
|
|
|
}
|
|
|
|
set {}
|
|
|
|
}
|
|
|
|
|
|
|
|
override var accessibilityHint: String? {
|
|
|
|
get {
|
|
|
|
if statusState.collapsed ?? false {
|
|
|
|
return "Double tap to expand the post."
|
|
|
|
} else {
|
|
|
|
return nil
|
2021-06-07 02:12:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
set {}
|
|
|
|
}
|
2021-06-07 02:31:11 +00:00
|
|
|
|
|
|
|
override func accessibilityActivate() -> Bool {
|
2022-11-12 20:04:44 +00:00
|
|
|
if statusState.collapsed ?? false {
|
|
|
|
collapseButtonPressed()
|
|
|
|
} else {
|
|
|
|
didSelectCell()
|
|
|
|
}
|
2021-06-07 02:31:11 +00:00
|
|
|
return true
|
|
|
|
}
|
2019-11-19 17:08:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-12-14 16:59:31 +00:00
|
|
|
extension TimelineStatusTableViewCell: SelectableTableViewCell {
|
|
|
|
func didSelectCell() {
|
|
|
|
delegate?.selected(status: statusID, state: statusState.copy())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-19 17:08:11 +00:00
|
|
|
extension TimelineStatusTableViewCell: TableViewSwipeActionProvider {
|
|
|
|
|
|
|
|
func leadingSwipeActionsConfiguration() -> UISwipeActionsConfiguration? {
|
2022-11-27 01:13:16 +00:00
|
|
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
|
|
|
|
return nil
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
2022-11-27 01:13:16 +00:00
|
|
|
return UISwipeActionsConfiguration(actions: Preferences.shared.leadingStatusSwipeActions.compactMap { $0.createAction(status: status, container: self) })
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func trailingSwipeActionsConfiguration() -> UISwipeActionsConfiguration? {
|
2022-11-27 01:13:16 +00:00
|
|
|
guard let status = mastodonController.persistentContainer.status(for: statusID) else {
|
|
|
|
return nil
|
2020-09-13 19:51:06 +00:00
|
|
|
}
|
2022-11-27 01:13:16 +00:00
|
|
|
return UISwipeActionsConfiguration(actions: Preferences.shared.trailingStatusSwipeActions.compactMap { $0.createAction(status: status, container: self) })
|
2019-11-19 17:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-12-14 23:44:41 +00:00
|
|
|
|
|
|
|
extension TimelineStatusTableViewCell: DraggableTableViewCell {
|
|
|
|
func dragItemsForBeginning(session: UIDragSession) -> [UIDragItem] {
|
2021-06-12 23:22:51 +00:00
|
|
|
// the poll options view is tracking while the user is dragging between options
|
|
|
|
// while that's happening, don't initiate a drag
|
2020-12-14 23:44:41 +00:00
|
|
|
guard let status = mastodonController.persistentContainer.status(for: statusID),
|
2021-06-12 23:22:51 +00:00
|
|
|
let accountID = mastodonController.accountInfo?.id,
|
|
|
|
!pollView.isTracking else {
|
2020-12-14 23:44:41 +00:00
|
|
|
return []
|
|
|
|
}
|
|
|
|
let provider = NSItemProvider(object: status.url! as NSURL)
|
|
|
|
let activity = UserActivityManager.showConversationActivity(mainStatusID: status.id, accountID: accountID)
|
2022-05-13 21:10:18 +00:00
|
|
|
activity.displaysAuxiliaryScene = true
|
2020-12-14 23:44:41 +00:00
|
|
|
provider.registerObject(activity, visibility: .all)
|
|
|
|
return [UIDragItem(itemProvider: provider)]
|
|
|
|
}
|
|
|
|
}
|
2021-04-28 23:11:41 +00:00
|
|
|
|
|
|
|
extension TimelineStatusTableViewCell: UIContextMenuInteractionDelegate {
|
|
|
|
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
|
|
|
return UIContextMenuConfiguration(identifier: nil) {
|
|
|
|
ProfileViewController(accountID: self.accountID, mastodonController: self.mastodonController)
|
|
|
|
} actionProvider: { (_) in
|
2022-05-02 03:04:56 +00:00
|
|
|
return UIMenu(title: "", image: nil, identifier: nil, options: [], children: self.delegate?.actionsForProfile(accountID: self.accountID, sourceView: self.avatarImageView) ?? [])
|
2021-04-28 23:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-14 02:25:28 +00:00
|
|
|
|
|
|
|
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) {
|
|
|
|
if let viewController = animator.previewViewController,
|
2022-05-02 03:04:56 +00:00
|
|
|
let delegate = delegate {
|
2021-05-14 02:25:28 +00:00
|
|
|
animator.preferredCommitStyle = .pop
|
|
|
|
animator.addCompletion {
|
|
|
|
if let customPresenting = viewController as? CustomPreviewPresenting {
|
|
|
|
customPresenting.presentFromPreview(presenter: delegate)
|
|
|
|
} else {
|
|
|
|
delegate.show(viewController)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-28 23:11:41 +00:00
|
|
|
}
|
2022-05-02 03:04:56 +00:00
|
|
|
|
|
|
|
extension TimelineStatusTableViewCell: MenuPreviewProvider {
|
|
|
|
func getPreviewProviders(for location: CGPoint, sourceViewController: UIViewController) -> PreviewProviders? {
|
|
|
|
guard let mastodonController = mastodonController,
|
|
|
|
let status = mastodonController.persistentContainer.status(for: statusID) else {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
content: { ConversationTableViewController(for: self.statusID, state: self.statusState.copy(), mastodonController: mastodonController) },
|
|
|
|
actions: { self.delegate?.actionsForStatus(status, sourceView: self) ?? [] }
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2022-11-27 01:13:16 +00:00
|
|
|
|
|
|
|
extension TimelineStatusTableViewCell: StatusSwipeActionContainer {
|
|
|
|
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
|
|
|
var toastableViewController: ToastableViewController? { delegate }
|
|
|
|
|
|
|
|
func performReplyAction() {
|
|
|
|
self.replyPressed()
|
|
|
|
}
|
|
|
|
}
|