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() {
|
private func presentConfirmationAlert() {
|
||||||
let image: UIImage?
|
let image: UIImage?
|
||||||
let reblogVisibilityActions: [CustomAlertController.MenuAction]?
|
let reblogVisibilityActions: [CustomAlertController.MenuAction]
|
||||||
|
let maximumVisibility = status.visibility
|
||||||
if mastodonController.instanceFeatures.reblogVisibility {
|
if mastodonController.instanceFeatures.reblogVisibility {
|
||||||
image = UIImage(systemName: Visibility.public.unfilledImageName)
|
image = UIImage(systemName: maximumVisibility.unfilledImageName)
|
||||||
reblogVisibilityActions = [Visibility.unlisted, .private].map { visibility in
|
reblogVisibilityActions = [Visibility.unlisted, .private].compactMap { visibility in
|
||||||
CustomAlertController.MenuAction(title: "Reblog as \(visibility.displayName)", subtitle: visibility.subtitle, image: UIImage(systemName: visibility.unfilledImageName)) {
|
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
|
// deliberately retain a strong reference to self
|
||||||
Task {
|
Task {
|
||||||
await self.doToggleReblog()
|
await self.doToggleReblog()
|
||||||
|
@ -50,7 +54,7 @@ class ReblogService {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
image = nil
|
image = nil
|
||||||
reblogVisibilityActions = nil
|
reblogVisibilityActions = []
|
||||||
}
|
}
|
||||||
|
|
||||||
let preview = ConfirmReblogStatusPreviewView(status: status)
|
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)
|
var menuAction = CustomAlertController.Action(title: nil, image: UIImage(systemName: "chevron.down"), style: .menu(reblogVisibilityActions), handler: nil)
|
||||||
menuAction.isSecondaryMenu = true
|
menuAction.isSecondaryMenu = true
|
||||||
config.actions.append(menuAction)
|
config.actions.append(menuAction)
|
||||||
|
|
Loading…
Reference in New Issue