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
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
)
}
}
}
extension FamiliarFollowersViewController: UserTableViewCellDelegate {}

View File

@ -119,14 +119,4 @@ extension FollowerListViewController: UITableViewDelegate, AutoGenerateTableView
}
// MARK: - 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
)
}
}
}
extension FollowerListViewController: UserTableViewCellDelegate {}

View File

@ -117,14 +117,4 @@ extension FollowingListViewController: UITableViewDelegate, AutoGenerateTableVie
}
// MARK: - 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
)
}
}
}
extension FollowingListViewController: UserTableViewCellDelegate {}

View File

@ -109,14 +109,4 @@ extension FavoritedByViewController: UITableViewDelegate, AutoGenerateTableViewD
}
// MARK: - 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
)
}
}
}
extension FavoritedByViewController: UserTableViewCellDelegate {}

View File

@ -109,14 +109,4 @@ extension RebloggedByViewController: UITableViewDelegate, AutoGenerateTableViewD
}
// MARK: - 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
)
}
}
}
extension RebloggedByViewController: UserTableViewCellDelegate {}

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 { }
// MARK: - 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
)
}
}
}
extension SearchResultViewController: UserTableViewCellDelegate {}