From 729756606030e59666fb7af3507bcc9a3faf5d2a Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 28 Nov 2022 19:12:07 -0500 Subject: [PATCH] Fix some swipe actions getting called off the main thread --- Tusker/Preferences/StatusSwipeAction.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tusker/Preferences/StatusSwipeAction.swift b/Tusker/Preferences/StatusSwipeAction.swift index 2dd22bf43b..00064d513e 100644 --- a/Tusker/Preferences/StatusSwipeAction.swift +++ b/Tusker/Preferences/StatusSwipeAction.swift @@ -97,7 +97,7 @@ private func createFavoriteAction(status: StatusMO, container: StatusSwipeAction } let title = status.favourited ? "Unfavorite" : "Favorite" let action = UIContextualAction(style: .normal, title: title) { [unowned container] _, _, completion in - Task { + Task { @MainActor in await FavoriteService(status: status, mastodonController: container.mastodonController, presenter: container.navigationDelegate).toggleFavorite() completion(true) } @@ -113,7 +113,7 @@ private func createReblogAction(status: StatusMO, container: StatusSwipeActionCo } let title = status.reblogged ? "Unreblog" : "Reblog" let action = UIContextualAction(style: .normal, title: title) { [unowned container] _, _, completion in - Task { + Task { @MainActor in await ReblogService(status: status, mastodonController: container.mastodonController, presenter: container.navigationDelegate).toggleReblog() completion(true) }