Fix showing incorrect visibilities in reblog confirmation alert
This commit is contained in:
parent
956b817045
commit
bd162afdcc
|
@ -37,11 +37,15 @@ class ReblogService {
|
|||
|
||||
private func presentConfirmationAlert() {
|
||||
let image: UIImage?
|
||||
let reblogVisibilityActions: [CustomAlertController.MenuAction]?
|
||||
let reblogVisibilityActions: [CustomAlertController.MenuAction]
|
||||
let maximumVisibility = status.visibility
|
||||
if mastodonController.instanceFeatures.reblogVisibility {
|
||||
image = UIImage(systemName: Visibility.public.unfilledImageName)
|
||||
reblogVisibilityActions = [Visibility.unlisted, .private].map { visibility in
|
||||
CustomAlertController.MenuAction(title: "Reblog as \(visibility.displayName)", subtitle: visibility.subtitle, image: UIImage(systemName: visibility.unfilledImageName)) {
|
||||
image = UIImage(systemName: maximumVisibility.unfilledImageName)
|
||||
reblogVisibilityActions = [Visibility.unlisted, .private].compactMap { visibility in
|
||||
guard visibility < maximumVisibility else {
|
||||
return nil
|
||||
}
|
||||
return CustomAlertController.MenuAction(title: "Reblog as \(visibility.displayName)", subtitle: visibility.subtitle, image: UIImage(systemName: visibility.unfilledImageName)) {
|
||||
// deliberately retain a strong reference to self
|
||||
Task {
|
||||
await self.doToggleReblog()
|
||||
|
@ -50,7 +54,7 @@ class ReblogService {
|
|||
}
|
||||
} else {
|
||||
image = nil
|
||||
reblogVisibilityActions = nil
|
||||
reblogVisibilityActions = []
|
||||
}
|
||||
|
||||
let preview = ConfirmReblogStatusPreviewView(status: status)
|
||||
|
@ -63,7 +67,7 @@ class ReblogService {
|
|||
}
|
||||
})
|
||||
])
|
||||
if let reblogVisibilityActions {
|
||||
if !reblogVisibilityActions.isEmpty {
|
||||
var menuAction = CustomAlertController.Action(title: nil, image: UIImage(systemName: "chevron.down"), style: .menu(reblogVisibilityActions), handler: nil)
|
||||
menuAction.isSecondaryMenu = true
|
||||
config.actions.append(menuAction)
|
||||
|
|
Loading…
Reference in New Issue