mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-02-02 02:16:50 +01:00
feature: add follow request notification
This commit is contained in:
parent
14da561781
commit
42f63808df
@ -347,7 +347,8 @@
|
||||
"favourite": "favorited your post",
|
||||
"reblog": "rebloged your post",
|
||||
"poll": "Your poll has ended",
|
||||
"mention": "mentioned you"
|
||||
"mention": "mentioned you",
|
||||
"follow_request": "request to follow you"
|
||||
},
|
||||
},
|
||||
"thread": {
|
||||
|
@ -51,7 +51,7 @@
|
||||
"repositoryURL": "https://github.com/onevcat/Kingfisher.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "bbc4bc4def7eb05a7ba8e1219f80ee9be327334e",
|
||||
"revision": "15d199e84677303a7004ed2c5ecaa1a90f3863f8",
|
||||
"version": "6.2.1"
|
||||
}
|
||||
},
|
||||
|
@ -108,6 +108,7 @@ extension NotificationSection {
|
||||
if let actionImage = UIImage(systemName: actionImageName, withConfiguration: UIImage.SymbolConfiguration(pointSize: 12, weight: .semibold))?.withRenderingMode(.alwaysTemplate) {
|
||||
cell.actionImageView.image = actionImage
|
||||
}
|
||||
cell.buttonStackView.isHidden = (type != .followRequest)
|
||||
return cell
|
||||
}
|
||||
case .bottomLoader:
|
||||
|
@ -24,6 +24,8 @@ extension Mastodon.Entity.Notification.NotificationType {
|
||||
color = Asset.Colors.Notification.mention.color
|
||||
case .poll:
|
||||
color = Asset.Colors.brandBlue.color
|
||||
case .followRequest:
|
||||
color = Asset.Colors.brandBlue.color
|
||||
default:
|
||||
color = .clear
|
||||
}
|
||||
@ -45,6 +47,8 @@ extension Mastodon.Entity.Notification.NotificationType {
|
||||
actionText = L10n.Scene.Notification.Action.mention
|
||||
case .poll:
|
||||
actionText = L10n.Scene.Notification.Action.poll
|
||||
case .followRequest:
|
||||
actionText = L10n.Scene.Notification.Action.followRequest
|
||||
default:
|
||||
actionText = ""
|
||||
}
|
||||
@ -66,6 +70,8 @@ extension Mastodon.Entity.Notification.NotificationType {
|
||||
actionImageName = "at"
|
||||
case .poll:
|
||||
actionImageName = "list.bullet"
|
||||
case .followRequest:
|
||||
actionImageName = "person.crop.circle"
|
||||
default:
|
||||
actionImageName = ""
|
||||
}
|
||||
|
@ -371,6 +371,8 @@ internal enum L10n {
|
||||
internal static let favourite = L10n.tr("Localizable", "Scene.Notification.Action.Favourite")
|
||||
/// followed you
|
||||
internal static let follow = L10n.tr("Localizable", "Scene.Notification.Action.Follow")
|
||||
/// request to follow you
|
||||
internal static let followRequest = L10n.tr("Localizable", "Scene.Notification.Action.FollowRequest")
|
||||
/// mentioned you
|
||||
internal static let mention = L10n.tr("Localizable", "Scene.Notification.Action.Mention")
|
||||
/// Your poll has ended
|
||||
|
@ -125,6 +125,7 @@ tap the link to confirm your account.";
|
||||
"Scene.HomeTimeline.Title" = "Home";
|
||||
"Scene.Notification.Action.Favourite" = "favorited your post";
|
||||
"Scene.Notification.Action.Follow" = "followed you";
|
||||
"Scene.Notification.Action.FollowRequest" = "request to follow you";
|
||||
"Scene.Notification.Action.Mention" = "mentioned you";
|
||||
"Scene.Notification.Action.Poll" = "Your poll has ended";
|
||||
"Scene.Notification.Action.Reblog" = "rebloged your post";
|
||||
|
@ -53,7 +53,7 @@ extension NotificationViewModel.LoadLatestState {
|
||||
sinceID: nil,
|
||||
minID: nil,
|
||||
limit: nil,
|
||||
excludeTypes: [.followRequest],
|
||||
excludeTypes: [],
|
||||
accountID: nil
|
||||
)
|
||||
viewModel.context.apiService.allNotifications(
|
||||
|
@ -21,6 +21,10 @@ protocol NotificationTableViewCellDelegate: AnyObject {
|
||||
func notificationStatusTableViewCell(_ cell: NotificationStatusTableViewCell, statusView: StatusView, contentWarningOverlayViewDidPressed contentWarningOverlayView: ContentWarningOverlayView)
|
||||
func notificationStatusTableViewCell(_ cell: NotificationStatusTableViewCell, statusView: StatusView, playerContainerView: PlayerContainerView, contentWarningOverlayViewDidPressed contentWarningOverlayView: ContentWarningOverlayView)
|
||||
|
||||
// func notificationStatusTableViewCell(_ cell: NotificationStatusTableViewCell, notification: MastodonNotification, acceptButtonDidPressed button: UIButton)
|
||||
//
|
||||
// func notificationStatusTableViewCell(_ cell: NotificationStatusTableViewCell, notification: MastodonNotification, denyButtonDidPressed button: UIButton)
|
||||
|
||||
}
|
||||
|
||||
final class NotificationTableViewCell: UITableViewCell {
|
||||
@ -76,6 +80,24 @@ final class NotificationTableViewCell: UITableViewCell {
|
||||
return label
|
||||
}()
|
||||
|
||||
let acceptButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
let actionImage = UIImage(systemName: "checkmark.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 28, weight: .semibold))?.withRenderingMode(.alwaysTemplate)
|
||||
button.setImage(actionImage, for: .normal)
|
||||
button.tintColor = Asset.Colors.Label.secondary.color
|
||||
return button
|
||||
}()
|
||||
|
||||
let rejectButton: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
let actionImage = UIImage(systemName: "xmark.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 28, weight: .semibold))?.withRenderingMode(.alwaysTemplate)
|
||||
button.setImage(actionImage, for: .normal)
|
||||
button.tintColor = Asset.Colors.Label.secondary.color
|
||||
return button
|
||||
}()
|
||||
|
||||
let buttonStackView = UIStackView()
|
||||
|
||||
override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
avatatImageView.af.cancelImageRequest()
|
||||
@ -97,9 +119,8 @@ extension NotificationTableViewCell {
|
||||
func configure() {
|
||||
|
||||
let containerStackView = UIStackView()
|
||||
containerStackView.axis = .horizontal
|
||||
containerStackView.alignment = .center
|
||||
containerStackView.spacing = 4
|
||||
containerStackView.axis = .vertical
|
||||
containerStackView.alignment = .fill
|
||||
containerStackView.layoutMargins = UIEdgeInsets(top: 14, left: 0, bottom: 12, right: 0)
|
||||
containerStackView.isLayoutMarginsRelativeArrangement = true
|
||||
containerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
@ -110,8 +131,13 @@ extension NotificationTableViewCell {
|
||||
contentView.readableContentGuide.trailingAnchor.constraint(equalTo: containerStackView.trailingAnchor),
|
||||
contentView.bottomAnchor.constraint(equalTo: containerStackView.bottomAnchor),
|
||||
])
|
||||
|
||||
let horizontalStackView = UIStackView()
|
||||
horizontalStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
horizontalStackView.axis = .horizontal
|
||||
horizontalStackView.spacing = 6
|
||||
|
||||
containerStackView.addArrangedSubview(avatarContainer)
|
||||
horizontalStackView.addArrangedSubview(avatarContainer)
|
||||
avatarContainer.translatesAutoresizingMaskIntoConstraints = false
|
||||
NSLayoutConstraint.activate([
|
||||
avatarContainer.heightAnchor.constraint(equalToConstant: 47).priority(.required - 1),
|
||||
@ -144,13 +170,23 @@ extension NotificationTableViewCell {
|
||||
])
|
||||
|
||||
nameLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
containerStackView.addArrangedSubview(nameLabel)
|
||||
horizontalStackView.addArrangedSubview(nameLabel)
|
||||
actionLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
containerStackView.addArrangedSubview(actionLabel)
|
||||
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
|
||||
nameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||
horizontalStackView.addArrangedSubview(actionLabel)
|
||||
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal)
|
||||
nameLabel.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
|
||||
containerStackView.addArrangedSubview(horizontalStackView)
|
||||
|
||||
buttonStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
buttonStackView.axis = .horizontal
|
||||
buttonStackView.distribution = .fillEqually
|
||||
acceptButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
denyButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
buttonStackView.addArrangedSubview(acceptButton)
|
||||
buttonStackView.addArrangedSubview(rejectButton)
|
||||
containerStackView.addArrangedSubview(buttonStackView)
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user