diff --git a/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift b/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift index b819b360..04dd06a9 100644 --- a/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift +++ b/Tusker/Views/Notifications/ActionNotificationGroupTableViewCell.swift @@ -75,6 +75,9 @@ class ActionNotificationGroupTableViewCell: UITableViewCell { isGrayscale = Preferences.shared.grayscaleImages + updateTimestamp() + let timestampLabelSize = timestampLabel.sizeThatFits(CGSize(width: .greatestFiniteMagnitude, height: timestampLabel.bounds.height)) + let people = group.notifications.compactMap { mastodonController.persistentContainer.account(for: $0.account.id) } actionAvatarStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } @@ -90,7 +93,8 @@ class ActionNotificationGroupTableViewCell: UITableViewCell { // don't add more avatars if they would overflow or squeeze the timestamp label let avatarViewsWidth = 30 * CGFloat(imageViews.count) let avatarMarginsWidth = 4 * CGFloat(max(0, imageViews.count - 1)) - let maxAvatarStackWidth = verticalStackView.bounds.width - timestampLabel.bounds.width - 8 + // todo: when the cell is first created, verticalStackView.bounds.width is not correct + let maxAvatarStackWidth = verticalStackView.bounds.width - timestampLabelSize.width - 8 let remainingWidth = maxAvatarStackWidth - avatarViewsWidth - avatarMarginsWidth if remainingWidth < 34 { break @@ -102,7 +106,6 @@ class ActionNotificationGroupTableViewCell: UITableViewCell { await updateGrayscaleableUI() } - updateTimestamp() actionLabel.setEmojis(pairs: people.map { ($0.displayOrUserName, $0.emojis) }, identifier: group.id) let doc = try! SwiftSoup.parse(status.content)