diff --git a/Tusker/Preferences/StatusSwipeAction.swift b/Tusker/Preferences/StatusSwipeAction.swift index f6cccb8d62..03a7d70150 100644 --- a/Tusker/Preferences/StatusSwipeAction.swift +++ b/Tusker/Preferences/StatusSwipeAction.swift @@ -74,6 +74,8 @@ protocol StatusSwipeActionContainer: UIView { var navigationDelegate: any TuskerNavigationDelegate { get } var toastableViewController: ToastableViewController? { get } + var canReblog: Bool { get } + // necessary b/c the reblog-handling logic only exists in the cells func performReplyAction() } @@ -108,7 +110,8 @@ private func createFavoriteAction(status: StatusMO, container: StatusSwipeAction } private func createReblogAction(status: StatusMO, container: StatusSwipeActionContainer) -> UIContextualAction? { - guard container.mastodonController.loggedIn else { + guard container.mastodonController.loggedIn, + container.canReblog else { return nil } let title = status.reblogged ? "Unreblog" : "Reblog" diff --git a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift index e34ec77b47..462918f471 100644 --- a/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusCollectionViewCell.swift @@ -822,6 +822,10 @@ extension TimelineStatusCollectionViewCell: StatusSwipeActionContainer { var navigationDelegate: TuskerNavigationDelegate { delegate! } var toastableViewController: ToastableViewController? { delegate } + var canReblog: Bool { + reblogButton.isEnabled + } + func performReplyAction() { self.replyPressed() } diff --git a/Tusker/Views/Status/TimelineStatusTableViewCell.swift b/Tusker/Views/Status/TimelineStatusTableViewCell.swift index fcd4d81d71..71fd77ee7f 100644 --- a/Tusker/Views/Status/TimelineStatusTableViewCell.swift +++ b/Tusker/Views/Status/TimelineStatusTableViewCell.swift @@ -445,6 +445,10 @@ extension TimelineStatusTableViewCell: StatusSwipeActionContainer { var navigationDelegate: TuskerNavigationDelegate { delegate! } var toastableViewController: ToastableViewController? { delegate } + var canReblog: Bool { + reblogButton.isEnabled + } + func performReplyAction() { self.replyPressed() }