forked from shadowfacts/Tusker
Don't show reblog swipe action when reblogging is forbidden
Closes #313
This commit is contained in:
parent
97a2278634
commit
01467574d0
|
@ -74,6 +74,8 @@ protocol StatusSwipeActionContainer: UIView {
|
||||||
var navigationDelegate: any TuskerNavigationDelegate { get }
|
var navigationDelegate: any TuskerNavigationDelegate { get }
|
||||||
var toastableViewController: ToastableViewController? { get }
|
var toastableViewController: ToastableViewController? { get }
|
||||||
|
|
||||||
|
var canReblog: Bool { get }
|
||||||
|
|
||||||
// necessary b/c the reblog-handling logic only exists in the cells
|
// necessary b/c the reblog-handling logic only exists in the cells
|
||||||
func performReplyAction()
|
func performReplyAction()
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,8 @@ private func createFavoriteAction(status: StatusMO, container: StatusSwipeAction
|
||||||
}
|
}
|
||||||
|
|
||||||
private func createReblogAction(status: StatusMO, container: StatusSwipeActionContainer) -> UIContextualAction? {
|
private func createReblogAction(status: StatusMO, container: StatusSwipeActionContainer) -> UIContextualAction? {
|
||||||
guard container.mastodonController.loggedIn else {
|
guard container.mastodonController.loggedIn,
|
||||||
|
container.canReblog else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let title = status.reblogged ? "Unreblog" : "Reblog"
|
let title = status.reblogged ? "Unreblog" : "Reblog"
|
||||||
|
|
|
@ -822,6 +822,10 @@ extension TimelineStatusCollectionViewCell: StatusSwipeActionContainer {
|
||||||
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
||||||
var toastableViewController: ToastableViewController? { delegate }
|
var toastableViewController: ToastableViewController? { delegate }
|
||||||
|
|
||||||
|
var canReblog: Bool {
|
||||||
|
reblogButton.isEnabled
|
||||||
|
}
|
||||||
|
|
||||||
func performReplyAction() {
|
func performReplyAction() {
|
||||||
self.replyPressed()
|
self.replyPressed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,6 +445,10 @@ extension TimelineStatusTableViewCell: StatusSwipeActionContainer {
|
||||||
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
||||||
var toastableViewController: ToastableViewController? { delegate }
|
var toastableViewController: ToastableViewController? { delegate }
|
||||||
|
|
||||||
|
var canReblog: Bool {
|
||||||
|
reblogButton.isEnabled
|
||||||
|
}
|
||||||
|
|
||||||
func performReplyAction() {
|
func performReplyAction() {
|
||||||
self.replyPressed()
|
self.replyPressed()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue