Compare commits

...

5 Commits

8 changed files with 44 additions and 13 deletions

View File

@ -134,6 +134,16 @@ public class InstanceFeatures: ObservableObject {
} }
} }
public var statusEditNotifications: Bool {
// pleroma doesn't seem to support 'update' type notifications, even though it supports edits
hasMastodonVersion(3, 5, 0)
}
public var statusNotifications: Bool {
// pleroma doesn't support notifications for new posts from an account
hasMastodonVersion(3, 3, 0)
}
public var needsEditAttachmentsInSeparateRequest: Bool { public var needsEditAttachmentsInSeparateRequest: Bool {
instanceType.isPleroma(.akkoma(nil)) instanceType.isPleroma(.akkoma(nil))
} }

View File

@ -146,7 +146,7 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell {
avatarStack.arrangedSubviews.forEach { $0.removeFromSuperview() } avatarStack.arrangedSubviews.forEach { $0.removeFromSuperview() }
for avatarURL in people.lazy.compactMap(\.avatar).prefix(10) { for avatarURL in people.lazy.compactMap(\.avatar).prefix(10) {
let imageView = CachedImageView(cache: .avatars) let imageView = CachedImageView(cache: .avatars)
imageView.contentMode = .scaleAspectFit imageView.contentMode = .scaleAspectFill
imageView.layer.masksToBounds = true imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * 30 imageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * 30
imageView.layer.cornerCurve = .continuous imageView.layer.cornerCurve = .continuous

View File

@ -121,6 +121,7 @@ class FollowNotificationGroupCollectionViewCell: UICollectionViewListCell {
avatarStack.arrangedSubviews.forEach { $0.removeFromSuperview() } avatarStack.arrangedSubviews.forEach { $0.removeFromSuperview() }
for avatarURL in people.lazy.compactMap(\.avatar).prefix(10) { for avatarURL in people.lazy.compactMap(\.avatar).prefix(10) {
let imageView = CachedImageView(cache: .avatars) let imageView = CachedImageView(cache: .avatars)
imageView.contentMode = .scaleAspectFill
imageView.layer.masksToBounds = true imageView.layer.masksToBounds = true
imageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * 30 imageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadiusFraction * 30
imageView.layer.cornerCurve = .continuous imageView.layer.cornerCurve = .continuous

View File

@ -20,6 +20,7 @@ class FollowRequestNotificationCollectionViewCell: UICollectionViewListCell {
} }
private let avatarImageView = CachedImageView(cache: .avatars).configure { private let avatarImageView = CachedImageView(cache: .avatars).configure {
$0.contentMode = .scaleAspectFill
$0.layer.masksToBounds = true $0.layer.masksToBounds = true
$0.layer.cornerCurve = .continuous $0.layer.cornerCurve = .continuous
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([

View File

@ -398,13 +398,19 @@ extension NotificationsCollectionViewController {
var types = Set(Notification.Kind.allCases) var types = Set(Notification.Kind.allCases)
types.remove(.unknown) types.remove(.unknown)
allowedTypes.forEach { types.remove($0) } allowedTypes.forEach { types.remove($0) }
if !mastodonController.instanceFeatures.statusEditNotifications {
types.remove(.update)
}
if !mastodonController.instanceFeatures.statusNotifications {
types.remove(.status)
}
return Client.getNotifications(excludedTypes: Array(types), range: range) return Client.getNotifications(excludedTypes: Array(types), range: range)
} }
} }
private func validateNotifications(_ notifications: [Pachyderm.Notification]) -> [Pachyderm.Notification] { private func validateNotifications(_ notifications: [Pachyderm.Notification]) -> [Pachyderm.Notification] {
return notifications.compactMap { notif in return notifications.compactMap { notif in
if notif.status == nil && (notif.kind == .mention || notif.kind == .reblog || notif.kind == .favourite) { if notif.status == nil && (notif.kind == .mention || notif.kind == .reblog || notif.kind == .favourite || notif.kind == .status) {
let crumb = Breadcrumb(level: .fatal, category: "notifications") let crumb = Breadcrumb(level: .fatal, category: "notifications")
crumb.data = [ crumb.data = [
"id": notif.id, "id": notif.id,

View File

@ -486,6 +486,7 @@ class CustomAlertPresentationAnimation: NSObject, UIViewControllerAnimatedTransi
let container = transitionContext.containerView let container = transitionContext.containerView
container.addSubview(alert.view) container.addSubview(alert.view)
alert.view.frame = container.bounds
guard transitionContext.isAnimated else { guard transitionContext.isAnimated else {
presenter.view.tintAdjustmentMode = .dimmed presenter.view.tintAdjustmentMode = .dimmed

View File

@ -28,6 +28,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
private static let avatarImageViewSize: CGFloat = 50 private static let avatarImageViewSize: CGFloat = 50
private(set) lazy var avatarImageView = CachedImageView(cache: .avatars).configure { private(set) lazy var avatarImageView = CachedImageView(cache: .avatars).configure {
$0.contentMode = .scaleAspectFill
$0.layer.masksToBounds = true $0.layer.masksToBounds = true
$0.layer.cornerCurve = .continuous $0.layer.cornerCurve = .continuous
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([

View File

@ -75,6 +75,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
private static let avatarImageViewSize: CGFloat = 50 private static let avatarImageViewSize: CGFloat = 50
private(set) lazy var avatarImageView = CachedImageView(cache: .avatars).configure { private(set) lazy var avatarImageView = CachedImageView(cache: .avatars).configure {
$0.contentMode = .scaleAspectFill
$0.layer.masksToBounds = true $0.layer.masksToBounds = true
$0.layer.cornerCurve = .continuous $0.layer.cornerCurve = .continuous
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
@ -535,6 +536,21 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
fatalError() fatalError()
} }
self.statusState = state
let reblogStatus: StatusMO?
if let rebloggedStatus = status.reblog {
reblogStatus = status
reblogStatusID = statusID
rebloggerID = status.account.id
status = rebloggedStatus
} else {
reblogStatus = nil
reblogStatusID = nil
rebloggerID = nil
}
switch filterResult { switch filterResult {
case .allow: case .allow:
setContentViewMode(.status) setContentViewMode(.status)
@ -545,6 +561,10 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
attrStr.append(showStr) attrStr.append(showStr)
filteredLabel.attributedText = attrStr filteredLabel.attributedText = attrStr
setContentViewMode(.filtered) setContentViewMode(.filtered)
// still update id properties, so that info for other methods (e.g., context menus) is correct
self.statusID = status.id
self.accountID = status.account.id
return return
case .hide: case .hide:
fatalError("unreachable") fatalError("unreachable")
@ -552,20 +572,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
createObservers() createObservers()
self.statusState = state
var hideTimelineReason = true var hideTimelineReason = true
if let rebloggedStatus = status.reblog { if let reblogStatus {
reblogStatusID = statusID
rebloggerID = status.account.id
hideTimelineReason = false hideTimelineReason = false
updateRebloggerLabel(reblogger: status.account) updateRebloggerLabel(reblogger: reblogStatus.account)
status = rebloggedStatus
} else {
reblogStatusID = nil
rebloggerID = nil
} }
if showFollowedHashtags { if showFollowedHashtags {