Update in-memory following/blocking states upon (un)follow/block action (IOS-140)

This commit is contained in:
Marcus Kida 2023-05-09 16:03:37 +02:00
parent b8744c24fc
commit 3e6d75e1b5
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
3 changed files with 12 additions and 0 deletions

View File

@ -28,5 +28,6 @@ extension DataSourceFacade {
try await dependency.context.apiService.getBlocked(
authenticationBox: authBox
)
dependency.context.authenticationService.fetchFollowingAndBlockedAsync()
} // end func
}

View File

@ -24,6 +24,7 @@ extension DataSourceFacade {
user: user,
authenticationBox: dependency.authContext.mastodonAuthenticationBox
)
dependency.context.authenticationService.fetchFollowingAndBlockedAsync()
} // end func
}

View File

@ -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<Void, Never>()
init(