mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-03 02:37:37 +01:00
Move task and async/await to call-site (IOS-192)
This commit is contained in:
parent
97d1ab4e5b
commit
e70a67caf0
@ -41,6 +41,7 @@ extension DataSourceFacade {
|
|||||||
assertionFailure()
|
assertionFailure()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await coordinateToProfileScene(
|
await coordinateToProfileScene(
|
||||||
provider: provider,
|
provider: provider,
|
||||||
account: redirectRecord
|
account: redirectRecord
|
||||||
@ -100,13 +101,10 @@ extension DataSourceFacade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
static func coordinateToProfileScene(
|
public static func coordinateToProfileScene(
|
||||||
provider: ViewControllerWithDependencies & AuthContextProvider,
|
provider: ViewControllerWithDependencies & AuthContextProvider,
|
||||||
account: Mastodon.Entity.Account
|
account: Mastodon.Entity.Account
|
||||||
) {
|
) async {
|
||||||
|
|
||||||
Task { @MainActor in
|
|
||||||
|
|
||||||
guard let me = provider.authContext.mastodonAuthenticationBox.authentication.account(),
|
guard let me = provider.authContext.mastodonAuthenticationBox.authentication.account(),
|
||||||
let relationship = try? await provider.context.apiService.relationship(forAccounts: [account], authenticationBox: provider.authContext.mastodonAuthenticationBox).value.first else { return }
|
let relationship = try? await provider.context.apiService.relationship(forAccounts: [account], authenticationBox: provider.authContext.mastodonAuthenticationBox).value.first else { return }
|
||||||
|
|
||||||
@ -125,7 +123,6 @@ extension DataSourceFacade {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
extension DataSourceFacade {
|
extension DataSourceFacade {
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ extension UITableViewDelegate where Self: DataSourceProvider & AuthContextProvid
|
|||||||
}
|
}
|
||||||
switch item {
|
switch item {
|
||||||
case .account(let account, relationship: _):
|
case .account(let account, relationship: _):
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
||||||
case .status(let status):
|
case .status(let status):
|
||||||
await DataSourceFacade.coordinateToStatusThreadScene(
|
await DataSourceFacade.coordinateToStatusThreadScene(
|
||||||
provider: self,
|
provider: self,
|
||||||
|
@ -99,7 +99,9 @@ extension DiscoveryForYouViewController: UITableViewDelegate {
|
|||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
guard case let .account(account, _) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
|
guard case let .account(account, _) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
|
||||||
|
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
Task {
|
||||||
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ extension NotificationTimelineViewController: TableViewControllerNavigateable {
|
|||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: notification.account)
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: notification.account)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -75,7 +75,7 @@ extension SearchHistoryViewController: UICollectionViewDelegate {
|
|||||||
|
|
||||||
switch item {
|
switch item {
|
||||||
case .account(account: let account, relationship: _):
|
case .account(account: let account, relationship: _):
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
||||||
|
|
||||||
case .hashtag(let tag):
|
case .hashtag(let tag):
|
||||||
await DataSourceFacade.coordinateToHashtagScene(
|
await DataSourceFacade.coordinateToHashtagScene(
|
||||||
|
@ -62,7 +62,7 @@ extension SearchResultViewController {
|
|||||||
|
|
||||||
switch item {
|
switch item {
|
||||||
case .account(let account, relationship: _):
|
case .account(let account, relationship: _):
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
||||||
case .status(let status):
|
case .status(let status):
|
||||||
await DataSourceFacade.coordinateToStatusThreadScene(
|
await DataSourceFacade.coordinateToStatusThreadScene(
|
||||||
provider: self,
|
provider: self,
|
||||||
|
@ -216,8 +216,11 @@ extension SettingsCoordinator: ServerDetailsViewControllerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension SettingsCoordinator: AboutInstanceViewControllerDelegate {
|
extension SettingsCoordinator: AboutInstanceViewControllerDelegate {
|
||||||
@MainActor func showAdminAccount(_ viewController: AboutInstanceViewController, account: Mastodon.Entity.Account) {
|
@MainActor
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: viewController, account: account)
|
func showAdminAccount(_ viewController: AboutInstanceViewController, account: Mastodon.Entity.Account) {
|
||||||
|
Task {
|
||||||
|
await DataSourceFacade.coordinateToProfileScene(provider: viewController, account: account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendEmailToAdmin(_ viewController: AboutInstanceViewController, emailAddress: String) {
|
func sendEmailToAdmin(_ viewController: AboutInstanceViewController, emailAddress: String) {
|
||||||
|
@ -91,7 +91,9 @@ extension SuggestionAccountViewController: UITableViewDelegate {
|
|||||||
guard let item = tableViewDiffableDataSource.itemIdentifier(for: indexPath) else { return }
|
guard let item = tableViewDiffableDataSource.itemIdentifier(for: indexPath) else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .account(let account, _):
|
case .account(let account, _):
|
||||||
DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
Task {
|
||||||
|
await DataSourceFacade.coordinateToProfileScene(provider: self, account: account)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tableView.deselectRow(at: indexPath, animated: true)
|
tableView.deselectRow(at: indexPath, animated: true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user