fix: remove ActionToolbarContainer.moreButtonDidPressed
This commit is contained in:
parent
8011298571
commit
b8f3f4c886
|
@ -780,7 +780,8 @@ extension StatusSection {
|
|||
return
|
||||
}
|
||||
let author = status.authorForUserProvider
|
||||
let canReport = authenticationBox.userID != author.id
|
||||
let isMyself = authenticationBox.userID == author.id
|
||||
let canReport = !isMyself
|
||||
let isInSameDomain = authenticationBox.domain == author.domainFromAcct
|
||||
let isMuting = (author.mutingBy ?? Set()).map(\.id).contains(authenticationBox.userID)
|
||||
let isBlocking = (author.blockingBy ?? Set()).map(\.id).contains(authenticationBox.userID)
|
||||
|
@ -788,9 +789,9 @@ extension StatusSection {
|
|||
cell.statusView.actionToolbarContainer.moreButton.showsMenuAsPrimaryAction = true
|
||||
cell.statusView.actionToolbarContainer.moreButton.menu = UserProviderFacade.createProfileActionMenu(
|
||||
for: author,
|
||||
isMyself: isMyself,
|
||||
isMuting: isMuting,
|
||||
isBlocking: isBlocking,
|
||||
canReport: canReport,
|
||||
isInSameDomain: isInSameDomain,
|
||||
isDomainBlocking: isDomainBlocking,
|
||||
provider: userProvider,
|
||||
|
|
|
@ -146,9 +146,9 @@ extension UserProviderFacade {
|
|||
extension UserProviderFacade {
|
||||
static func createProfileActionMenu(
|
||||
for mastodonUser: MastodonUser,
|
||||
isMyself: Bool,
|
||||
isMuting: Bool,
|
||||
isBlocking: Bool,
|
||||
canReport: Bool,
|
||||
isInSameDomain: Bool,
|
||||
isDomainBlocking: Bool,
|
||||
provider: UserProvider,
|
||||
|
@ -161,6 +161,7 @@ extension UserProviderFacade {
|
|||
var children: [UIMenuElement] = []
|
||||
let name = mastodonUser.displayNameWithFallback
|
||||
|
||||
if !isMyself {
|
||||
// mute
|
||||
let muteAction = UIAction(
|
||||
title: isMuting ? L10n.Common.Controls.Firendship.unmuteUser(name) : L10n.Common.Controls.Firendship.mute,
|
||||
|
@ -188,7 +189,9 @@ extension UserProviderFacade {
|
|||
let muteMenu = UIMenu(title: L10n.Common.Controls.Firendship.muteUser(name), image: UIImage(systemName: "speaker.slash"), options: [], children: [muteAction])
|
||||
children.append(muteMenu)
|
||||
}
|
||||
}
|
||||
|
||||
if !isMyself {
|
||||
// block
|
||||
let blockAction = UIAction(
|
||||
title: isBlocking ? L10n.Common.Controls.Firendship.unblockUser(name) : L10n.Common.Controls.Firendship.block,
|
||||
|
@ -216,7 +219,9 @@ extension UserProviderFacade {
|
|||
let blockMenu = UIMenu(title: L10n.Common.Controls.Firendship.blockUser(name), image: UIImage(systemName: "hand.raised"), options: [], children: [blockAction])
|
||||
children.append(blockMenu)
|
||||
}
|
||||
if canReport {
|
||||
}
|
||||
|
||||
if !isMyself {
|
||||
let reportAction = UIAction(title: L10n.Common.Controls.Actions.reportUser(name), image: UIImage(systemName: "flag"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak provider] _ in
|
||||
guard let provider = provider else { return }
|
||||
guard let authenticationBox = provider.context.authenticationService.activeMastodonAuthenticationBox.value else {
|
||||
|
|
|
@ -384,17 +384,23 @@ extension ProfileViewController {
|
|||
self.moreMenuBarButtonItem.menu = nil
|
||||
return
|
||||
}
|
||||
guard let currentMastodonUser = self.viewModel.currentMastodonUser.value else {
|
||||
self.moreMenuBarButtonItem.menu = nil
|
||||
return
|
||||
}
|
||||
guard let currentDomain = self.viewModel.domain.value else { return }
|
||||
let isMuting = relationshipActionOptionSet.contains(.muting)
|
||||
let isBlocking = relationshipActionOptionSet.contains(.blocking)
|
||||
let isDomainBlocking = domains.contains(mastodonUser.domainFromAcct)
|
||||
let needsShareAction = self.viewModel.isMeBarButtonItemsHidden.value
|
||||
let isInSameDomain = mastodonUser.domainFromAcct == currentDomain
|
||||
let isMyself = currentMastodonUser.id == mastodonUser.id
|
||||
|
||||
self.moreMenuBarButtonItem.menu = UserProviderFacade.createProfileActionMenu(
|
||||
for: mastodonUser,
|
||||
isMyself: isMyself,
|
||||
isMuting: isMuting,
|
||||
isBlocking: isBlocking,
|
||||
canReport: true,
|
||||
isInSameDomain: isInSameDomain,
|
||||
isDomainBlocking: isDomainBlocking,
|
||||
provider: self,
|
||||
|
|
|
@ -356,8 +356,4 @@ extension StatusTableViewCell: ActionToolbarContainerDelegate {
|
|||
delegate?.statusTableViewCell(self, actionToolbarContainer: actionToolbarContainer, likeButtonDidPressed: sender)
|
||||
}
|
||||
|
||||
func actionToolbarContainer(_ actionToolbarContainer: ActionToolbarContainer, moreButtonDidPressed sender: UIButton) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ protocol ActionToolbarContainerDelegate: class {
|
|||
func actionToolbarContainer(_ actionToolbarContainer: ActionToolbarContainer, replayButtonDidPressed sender: UIButton)
|
||||
func actionToolbarContainer(_ actionToolbarContainer: ActionToolbarContainer, reblogButtonDidPressed sender: UIButton)
|
||||
func actionToolbarContainer(_ actionToolbarContainer: ActionToolbarContainer, starButtonDidPressed sender: UIButton)
|
||||
func actionToolbarContainer(_ actionToolbarContainer: ActionToolbarContainer, moreButtonDidPressed sender: UIButton)
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +62,6 @@ extension ActionToolbarContainer {
|
|||
replyButton.addTarget(self, action: #selector(ActionToolbarContainer.replyButtonDidPressed(_:)), for: .touchUpInside)
|
||||
reblogButton.addTarget(self, action: #selector(ActionToolbarContainer.reblogButtonDidPressed(_:)), for: .touchUpInside)
|
||||
favoriteButton.addTarget(self, action: #selector(ActionToolbarContainer.favoriteButtonDidPressed(_:)), for: .touchUpInside)
|
||||
moreButton.addTarget(self, action: #selector(ActionToolbarContainer.moreButtonDidPressed(_:)), for: .touchUpInside)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -194,11 +192,6 @@ extension ActionToolbarContainer {
|
|||
delegate?.actionToolbarContainer(self, starButtonDidPressed: sender)
|
||||
}
|
||||
|
||||
@objc private func moreButtonDidPressed(_ sender: UIButton) {
|
||||
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
||||
delegate?.actionToolbarContainer(self, moreButtonDidPressed: sender)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
@ -62,6 +62,6 @@ protocol PutQuery: RequestQuery { }
|
|||
protocol DeleteQuery: RequestQuery { }
|
||||
|
||||
extension DeleteQuery {
|
||||
// By default a `PostQuery` does not has query items
|
||||
// By default a `DeleteQuery` does not has query items
|
||||
var queryItems: [URLQueryItem]? { nil }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue