[WIP] Preparation to get relationship into menu on notification-screen (IOS-192)

This commit is contained in:
Nathan Mattes 2024-01-18 16:59:14 +01:00
parent 35c017986a
commit ca3fd69b62
2 changed files with 35 additions and 11 deletions

View File

@ -31,18 +31,41 @@ extension NotificationTableViewCellDelegate where Self: DataSourceProvider & Aut
return
}
//TODO: Update Relationship
_ = try await DataSourceFacade.responseToMenuAction(
dependency: self,
action: action,
menuContext: .init(
author: notification.entity.account,
statusViewModel: nil,
button: button,
barButtonItem: nil
// we only allow to mute/block and to report users on notification-screen
switch action {
case .muteUser(_), .blockUser(_):
_ = try await DataSourceFacade.responseToMenuAction(
dependency: self,
action: action,
menuContext: .init(
author: notification.entity.account,
statusViewModel: nil,
button: button,
barButtonItem: nil
),
completion: { (newRelationship: Mastodon.Entity.Relationship) in
//TODO: Update Relationship.
//TODO: Get Relationship into here, first!
print(newRelationship)
}
)
)
} // end Task
case .reportUser(_):
_ = try await DataSourceFacade.responseToMenuAction(
dependency: self,
action: action,
menuContext: .init(
author: notification.entity.account,
statusViewModel: nil,
button: button,
barButtonItem: nil
)
)
case .translateStatus(_), .showOriginal, .shareUser(_), .blockDomain(_), .bookmarkStatus(_), .hideReblogs(_), .shareStatus, .deleteStatus, .editStatus, .followUser(_):
// Do Nothing
break
}
}
}
}

View File

@ -476,6 +476,7 @@ extension NotificationView: AdaptiveContainerView {
}
extension NotificationView {
@available(*, deprecated, message: "Does way too much")
public typealias AuthorMenuContext = StatusAuthorView.AuthorMenuContext
public func setupAuthorMenu(menuContext: AuthorMenuContext) -> (UIMenu, [UIAccessibilityCustomAction]) {