Put existing actions into their section (IOS-103)

This commit is contained in:
Nathan Mattes 2023-06-02 16:08:48 +02:00
parent 846fa44369
commit 6b2fe91112
1 changed files with 28 additions and 31 deletions

View File

@ -158,48 +158,45 @@ extension StatusAuthorView {
public func setupAuthorMenu(menuContext: AuthorMenuContext) -> (UIMenu, [UIAccessibilityCustomAction]) {
var actions: [[MastodonMenu.Action]] = []
var upperActions: [MastodonMenu.Action] = []
var postActions: [MastodonMenu.Action] = []
var userActions: [MastodonMenu.Action] = []
if menuContext.isMyself {
upperActions.append(.editStatus)
postActions.append(.editStatus)
}
if !menuContext.isMyself {
if let statusLanguage = menuContext.statusLanguage, menuContext.isTranslationEnabled, !menuContext.isTranslated {
upperActions.append(
.translateStatus(.init(language: statusLanguage))
)
}
upperActions.append(contentsOf: [
.muteUser(.init(
name: menuContext.name,
isMuting: menuContext.isMuting
)),
.blockUser(.init(
name: menuContext.name,
isBlocking: menuContext.isBlocking
)),
.reportUser(
.init(name: menuContext.name)
)
])
if let statusLanguage = menuContext.statusLanguage, menuContext.isTranslationEnabled, !menuContext.isTranslated {
postActions.append(
.translateStatus(.init(language: statusLanguage))
)
}
upperActions.append(contentsOf: [
.bookmarkStatus(
.init(isBookmarking: menuContext.isBookmarking)
),
.shareStatus
])
actions.append(upperActions)
postActions.append(.bookmarkStatus(.init(isBookmarking: menuContext.isBookmarking)))
postActions.append(.shareStatus)
if menuContext.isMyself == false {
userActions.append(.muteUser(.init(
name: menuContext.name,
isMuting: menuContext.isMuting
)))
userActions.append(.blockUser(.init(
name: menuContext.name,
isBlocking: menuContext.isBlocking
)))
userActions.append(.reportUser(
.init(name: menuContext.name)
))
}
actions.append(postActions)
actions.append(userActions)
if menuContext.isMyself {
actions.append([.deleteStatus])
}
let menu = MastodonMenu.setupMenu(
actions: actions,
delegate: self.statusView!