Remove duplicate code (IOS-140)

This commit is contained in:
Marcus Kida 2023-05-09 15:44:39 +02:00
parent 93533654f8
commit dbf6e6b467
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
8 changed files with 20 additions and 76 deletions

View File

@ -44,3 +44,15 @@ extension DataSourceFacade {
} }
} }
} }
extension UserTableViewCellDelegate where Self: NeedsDependency & AuthContextProvider {
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -93,14 +93,4 @@ extension FamiliarFollowersViewController: UITableViewDelegate, AutoGenerateTabl
} }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension FamiliarFollowersViewController: UserTableViewCellDelegate { extension FamiliarFollowersViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -119,14 +119,4 @@ extension FollowerListViewController: UITableViewDelegate, AutoGenerateTableView
} }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension FollowerListViewController: UserTableViewCellDelegate { extension FollowerListViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -117,14 +117,4 @@ extension FollowingListViewController: UITableViewDelegate, AutoGenerateTableVie
} }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension FollowingListViewController: UserTableViewCellDelegate { extension FollowingListViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -109,14 +109,4 @@ extension FavoritedByViewController: UITableViewDelegate, AutoGenerateTableViewD
} }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension FavoritedByViewController: UserTableViewCellDelegate { extension FavoritedByViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -109,14 +109,4 @@ extension RebloggedByViewController: UITableViewDelegate, AutoGenerateTableViewD
} }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension RebloggedByViewController: UserTableViewCellDelegate { extension RebloggedByViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}

View File

@ -124,14 +124,6 @@ extension SearchHistoryViewController: SearchHistorySectionHeaderCollectionReusa
) )
} }
} }
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
} }
extension SearchHistoryViewController: UserTableViewCellDelegate {}

View File

@ -259,14 +259,4 @@ extension SearchResultViewController: UITableViewDelegate, AutoGenerateTableView
extension SearchResultViewController: StatusTableViewCellDelegate { } extension SearchResultViewController: StatusTableViewCellDelegate { }
// MARK: - UserTableViewCellDelegate // MARK: - UserTableViewCellDelegate
extension SearchResultViewController: UserTableViewCellDelegate { extension SearchResultViewController: UserTableViewCellDelegate {}
func userView(_ view: UserView, didTapButtonWith state: UserView.ButtonState, for user: MastodonUser) {
Task {
try await DataSourceFacade.responseToUserViewButtonAction(
dependency: self,
user: user.asRecord,
buttonState: state
)
}
}
}