From 622df06d4a146612f4207a12e75b8d79458bf35e Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Mon, 9 Oct 2023 14:22:26 +0200 Subject: [PATCH] Load admin-account (IOS-20) --- Mastodon/Scene/Settings/SettingsCoordinator.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Mastodon/Scene/Settings/SettingsCoordinator.swift b/Mastodon/Scene/Settings/SettingsCoordinator.swift index 9fc2ef65d..17796da96 100644 --- a/Mastodon/Scene/Settings/SettingsCoordinator.swift +++ b/Mastodon/Scene/Settings/SettingsCoordinator.swift @@ -207,12 +207,15 @@ extension SettingsCoordinator: ServerDetailsViewControllerDelegate { extension SettingsCoordinator: AboutInstanceViewControllerDelegate { @MainActor func showAdminAccount(_ viewController: AboutInstanceViewController, account: Mastodon.Entity.Account) { + Task { + let user = try await appContext.apiService.fetchUser(username: account.username, domain: authContext.mastodonAuthenticationBox.domain, authenticationBox: authContext.mastodonAuthenticationBox) - //TODO: Get CoreData-profile from account + let profileViewModel = ProfileViewModel(context: appContext, authContext: authContext, optionalMastodonUser: user) - let profileViewModel = ProfileViewModel(context: appContext, authContext: authContext, optionalMastodonUser: nil) - - sceneCoordinator.present(scene: .profile(viewModel: profileViewModel), transition: .show) + _ = await MainActor.run { + sceneCoordinator.present(scene: .profile(viewModel: profileViewModel), transition: .show) + } + } } func sendEmailToAdmin(_ viewController: AboutInstanceViewController, emailAddress: String) {