diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift index 2cf6e3419..3f8693476 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift @@ -28,5 +28,6 @@ extension DataSourceFacade { try await dependency.context.apiService.getBlocked( authenticationBox: authBox ) + dependency.context.authenticationService.fetchFollowingAndBlockedAsync() } // end func } diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift index a85de703a..2c221bc9b 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift @@ -24,6 +24,7 @@ extension DataSourceFacade { user: user, authenticationBox: dependency.authContext.mastodonAuthenticationBox ) + dependency.context.authenticationService.fetchFollowingAndBlockedAsync() } // end func } diff --git a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift index a865286cb..10a37613e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift @@ -67,6 +67,16 @@ public final class AuthenticationService: NSObject { return (ids, maxID) } + public func fetchFollowingAndBlockedAsync() { + /// we're dispatching this as a separate async call to not block the callee + Task { + for authBox in mastodonAuthenticationBoxes { + do { try await fetchFollowedBlockedUserIds(authBox) } + catch {} + } + } + } + public let updateActiveUserAccountPublisher = PassthroughSubject() init(