From 1de586f90771546889eebfa5677d44cb2c289568 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 26 Jun 2023 21:41:43 -0700 Subject: [PATCH] Fix reblog with visibility not working --- Tusker/API/ReblogService.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tusker/API/ReblogService.swift b/Tusker/API/ReblogService.swift index 724c9a20..aeb936cd 100644 --- a/Tusker/API/ReblogService.swift +++ b/Tusker/API/ReblogService.swift @@ -17,7 +17,6 @@ class ReblogService { private let status: StatusMO var hapticFeedback = true - var visibility: Visibility? = nil var requireConfirmation = Preferences.shared.confirmBeforeReblog init(status: StatusMO, mastodonController: MastodonController, presenter: any TuskerNavigationDelegate) { @@ -31,7 +30,7 @@ class ReblogService { requireConfirmation { presentConfirmationAlert() } else { - await doToggleReblog() + await doToggleReblog(visibility: nil) } } @@ -48,7 +47,7 @@ class ReblogService { 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() + await self.doToggleReblog(visibility: visibility) } } } @@ -63,7 +62,7 @@ class ReblogService { CustomAlertController.Action(title: "Reblog", image: image, style: .default, handler: { // deliberately retain a strong reference to self Task { - await self.doToggleReblog() + await self.doToggleReblog(visibility: nil) } }) ]) @@ -76,7 +75,7 @@ class ReblogService { presenter.present(alert, animated: true) } - private func doToggleReblog() async { + private func doToggleReblog(visibility: Visibility?) async { let oldValue = status.reblogged status.reblogged.toggle() mastodonController.persistentContainer.statusSubject.send(status.id)