Reduce nested-ness of tasks (IOS-192)

Thank you @kimar
This commit is contained in:
Nathan Mattes 2024-01-11 15:28:18 +01:00
parent c6788f5a43
commit b8ba69b930
2 changed files with 16 additions and 21 deletions

View File

@ -56,7 +56,6 @@ extension DataSourceFacade {
) async {
provider.coordinator.showLoading()
Task {
do {
guard let account = try await provider.context.apiService.fetchUser(
username: username,
@ -73,7 +72,6 @@ extension DataSourceFacade {
provider.coordinator.hideLoading()
}
}
}
@MainActor
static func coordinateToProfileScene(
@ -83,7 +81,6 @@ extension DataSourceFacade {
) async {
provider.coordinator.showLoading()
Task {
do {
let account = try await provider.context.apiService.accountInfo(
domain: domain,
@ -98,7 +95,6 @@ extension DataSourceFacade {
provider.coordinator.hideLoading()
}
}
}
@MainActor
public static func coordinateToProfileScene(

View File

@ -142,13 +142,12 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
authenticationViewModel
.authenticated.sink { (domain, account) in
Task {
Task { @MainActor in
do {
_ = try await self.context.authenticationService.activeMastodonUser(domain: domain, userID: account.id)
FileManager.default.store(account: account, forUserID: MastodonUserIdentifier(domain: domain, userID: account.id))
Task { @MainActor in
self.coordinator.setup()
}
} catch {
assertionFailure(error.localizedDescription)
}