diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 25f20be3eb..2613721661 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -218,8 +218,6 @@ D6934F402BAA19EC002B1C8D /* VideoActivityItemSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6934F3F2BAA19EC002B1C8D /* VideoActivityItemSource.swift */; }; D6934F422BAC7D6E002B1C8D /* VideoControlsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6934F412BAC7D6E002B1C8D /* VideoControlsViewController.swift */; }; D693A72825CF282E003A14E2 /* TrendingHashtagsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693A72725CF282E003A14E2 /* TrendingHashtagsViewController.swift */; }; - D693A72F25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693A72D25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift */; }; - D693A73025CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D693A72E25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.xib */; }; D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */; }; D693DE5923FE24310061E07D /* InteractivePushTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5823FE24300061E07D /* InteractivePushTransition.swift */; }; D6945C2F23AC47C3005C403C /* SavedDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6945C2E23AC47C3005C403C /* SavedDataManager.swift */; }; @@ -654,8 +652,6 @@ D6934F3F2BAA19EC002B1C8D /* VideoActivityItemSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoActivityItemSource.swift; sourceTree = ""; }; D6934F412BAC7D6E002B1C8D /* VideoControlsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoControlsViewController.swift; sourceTree = ""; }; D693A72725CF282E003A14E2 /* TrendingHashtagsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingHashtagsViewController.swift; sourceTree = ""; }; - D693A72D25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturedProfileCollectionViewCell.swift; sourceTree = ""; }; - D693A72E25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FeaturedProfileCollectionViewCell.xib; sourceTree = ""; }; D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnhancedNavigationViewController.swift; sourceTree = ""; }; D693DE5823FE24300061E07D /* InteractivePushTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractivePushTransition.swift; sourceTree = ""; }; D6945C2E23AC47C3005C403C /* SavedDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SavedDataManager.swift; sourceTree = ""; }; @@ -991,8 +987,6 @@ D601FA81297EEC3F00A8E8B5 /* SuggestedProfileCardCollectionViewCell.swift */, D601FA82297EEC3F00A8E8B5 /* SuggestedProfileCardCollectionViewCell.xib */, D6BC74852AFC4772000DD603 /* SuggestedProfileCardView.swift */, - D693A72D25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift */, - D693A72E25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.xib */, D6C3F4FA299035650009FCFF /* TrendsViewController.swift */, D68329EE299540050026EB24 /* MoreTrendsFooterCollectionViewCell.swift */, D6DD996A2998611A0015C962 /* SuggestedProfilesViewController.swift */, @@ -2020,7 +2014,6 @@ buildActionMask = 2147483647; files = ( D6E77D0D286E6B7300D8B732 /* TrendingLinkCardCollectionViewCell.xib in Resources */, - D693A73025CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.xib in Resources */, D61AC1D9232EA42D00C54D2D /* InstanceTableViewCell.xib in Resources */, D691296E2BA75ADF005C58ED /* PrivacyInfo.xcprivacy in Resources */, D6412B0B24B0D4C600F5412E /* ProfileHeaderView.xib in Resources */, @@ -2261,7 +2254,6 @@ D61DC84D28F500D200B82C6E /* ProfileViewController.swift in Sources */, D6187BED2BFA840B00B3A281 /* FollowRequestNotificationViewController.swift in Sources */, D600891F29848DE2005B4D00 /* AddInstancePinnedTimelineView.swift in Sources */, - D693A72F25CF91C6003A14E2 /* FeaturedProfileCollectionViewCell.swift in Sources */, D627943223A5466600D38C68 /* SelectableTableViewCell.swift in Sources */, D64B96812BC3279D002C8990 /* PrefsAccountView.swift in Sources */, D6EAE0DB2550CC8A002DB0AC /* FocusableTextField.swift in Sources */, diff --git a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift b/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift deleted file mode 100644 index b253e068f4..0000000000 --- a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift +++ /dev/null @@ -1,152 +0,0 @@ -// -// FeaturedProfileCollectionViewCell.swift -// Tusker -// -// Created by Shadowfacts on 2/6/21. -// Copyright © 2021 Shadowfacts. All rights reserved. -// - -import UIKit -import Pachyderm - -class FeaturedProfileCollectionViewCell: UICollectionViewCell { - - @IBOutlet weak var clippingView: UIView! - @IBOutlet weak var headerImageView: UIImageView! - @IBOutlet weak var avatarContainerView: UIView! - @IBOutlet weak var avatarImageView: UIImageView! - @IBOutlet weak var displayNameLabel: AccountDisplayNameLabel! - @IBOutlet weak var noteTextView: StatusContentTextView! - - var account: Account? - - private var accountImagesTask: Task? - - deinit { - accountImagesTask?.cancel() - } - - override func awakeFromNib() { - super.awakeFromNib() - - avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView) - avatarContainerView.layer.cornerCurve = .continuous - avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView) - avatarImageView.layer.cornerCurve = .continuous - - displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 20, weight: .semibold)) - displayNameLabel.adjustsFontForContentSizeCategory = true - - noteTextView.adjustsFontForContentSizeCategory = true - noteTextView.textContainer.lineBreakMode = .byTruncatingTail - noteTextView.textContainerInset = UIEdgeInsets(top: 16, left: 4, bottom: 16, right: 4) - - backgroundColor = .clear - clippingView.backgroundColor = .appBackground - clippingView.layer.cornerRadius = 5 - clippingView.layer.cornerCurve = .continuous - clippingView.layer.borderWidth = 1 - clippingView.layer.masksToBounds = true - layer.shadowOpacity = 0.2 - layer.shadowRadius = 8 - layer.shadowOffset = .zero - layer.masksToBounds = false - updateLayerColors() - - NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil) - } - - func updateUI(account: Account) { - self.account = account - - displayNameLabel.updateForAccountDisplayName(account: account) - - noteTextView.setBodyTextFromHTML(account.note) - noteTextView.setEmojis(account.emojis, identifier: account.id) - - avatarImageView.image = nil - headerImageView.image = nil - - accountImagesTask?.cancel() - accountImagesTask = Task { - await updateImages(account: account) - } - } - - private nonisolated func updateImages(account: Account) async { - await withTaskGroup(of: Void.self) { group in - group.addTask { - guard let avatar = account.avatar, - let image = await ImageCache.avatars.get(avatar).1 else { - return - } - await MainActor.run { - self.avatarImageView.image = image - } - } - group.addTask { - guard let header = account.header, - let image = await ImageCache.headers.get(header).1 else { - return - } - await MainActor.run { - self.headerImageView.image = image - } - } - await group.waitForAll() - } - } - - private func updateLayerColors() { - if traitCollection.userInterfaceStyle == .dark { - clippingView.layer.borderColor = UIColor.darkGray.withAlphaComponent(0.5).cgColor - layer.shadowColor = UIColor.darkGray.cgColor - } else { - clippingView.layer.borderColor = UIColor.lightGray.withAlphaComponent(0.5).cgColor - layer.shadowColor = UIColor.black.cgColor - } - } - - // Unneeded on visionOS because there is no light/dark mode - #if !os(visionOS) - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - updateLayerColors() - } - #endif - - override func layoutSubviews() { - super.layoutSubviews() - - layer.shadowPath = CGPath(roundedRect: bounds, cornerWidth: 5, cornerHeight: 5, transform: nil) - } - - @objc private func preferencesChanged() { - avatarContainerView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarContainerView) - avatarImageView.layer.cornerRadius = Preferences.shared.avatarStyle.cornerRadius(for: avatarImageView) - - if let account = account { - displayNameLabel.updateForAccountDisplayName(account: account) - } - } - - // MARK: Accessibility - - override var isAccessibilityElement: Bool { - get { true } - set {} - } - - override var accessibilityAttributedLabel: NSAttributedString? { - get { - guard let account else { - return nil - } - let s = NSMutableAttributedString(string: "\(account.displayNameWithoutCustomEmoji), ") - s.append(noteTextView.attributedText) - return s - } - set {} - } - -} diff --git a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.xib b/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.xib deleted file mode 100644 index 0c1d02e434..0000000000 --- a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.xib +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -