Download not one but all authenticated users at start

This commit is contained in:
Nathan Mattes 2023-06-02 11:21:54 +02:00
parent 081727865f
commit c5cfca93ea
1 changed files with 7 additions and 2 deletions

View File

@ -47,12 +47,17 @@ extension APIService {
// FIXME: This is a dirty hack to make the performance-stuff work. // FIXME: This is a dirty hack to make the performance-stuff work.
// Problem is, that we don't persist the user on disk anymore. So we have to fetch // Problem is, that we don't persist the user on disk anymore. So we have to fetch
// it when we need it to display on the home timeline. // it when we need it to display on the home timeline.
_ = try await authenticatedUserInfo(authenticationBox: authenticationBox).value for authentication in AuthenticationServiceProvider.shared.authentications {
_ = try await accountInfo(domain: authentication.domain,
userID: authentication.userID,
authorization: Mastodon.API.OAuth.Authorization(accessToken: authentication.userAccessToken)).value
}
NotificationCenter.default.post(name: .userFetched, object: nil) NotificationCenter.default.post(name: .userFetched, object: nil)
try await managedObjectContext.performChanges { try await managedObjectContext.performChanges {
guard let me = authenticationBox.authentication.user(in: managedObjectContext) else { guard let me = authenticationBox.authentication.user(in: managedObjectContext) else {
assertionFailure() assertionFailure()
return return
} }