diff --git a/Mastodon/Scene/Discovery/ForYou/ProfileCardView+ViewModel.swift b/Mastodon/Scene/Discovery/ForYou/ProfileCardView+ViewModel.swift index f375ee478..b9ce95d35 100644 --- a/Mastodon/Scene/Discovery/ForYou/ProfileCardView+ViewModel.swift +++ b/Mastodon/Scene/Discovery/ForYou/ProfileCardView+ViewModel.swift @@ -21,9 +21,6 @@ extension ProfileCardView { var disposeBag = Set() public let relationshipViewModel = RelationshipViewModel() - - @Published public var userInterfaceStyle: UIUserInterfaceStyle? - @Published public var backgroundColor: UIColor? // Author @Published public var authorBannerImageURL: URL? @@ -46,32 +43,11 @@ extension ProfileCardView { @Published public var groupedAccessibilityLabel = "" @Published public var familiarFollowers: Mastodon.Entity.FamiliarFollowers? - - init() { - backgroundColor = .systemBackground - $userInterfaceStyle - .sink { [weak self] userInterfaceStyle in - guard let self = self else { return } - guard let userInterfaceStyle = userInterfaceStyle else { return } - switch userInterfaceStyle { - case .dark: - self.backgroundColor = .secondarySystemBackground - case .light, .unspecified: - self.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color - @unknown default: - self.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color - assertionFailure() - // do nothing - } - } - .store(in: &disposeBag) - } } } extension ProfileCardView.ViewModel { func bind(view: ProfileCardView) { - bindAppearacne(view: view) bindHeader(view: view) bindUser(view: view) bindBio(view: view) @@ -81,18 +57,6 @@ extension ProfileCardView.ViewModel { // bindAccessibility(view: view) } - private func bindAppearacne(view: ProfileCardView) { - userInterfaceStyle = view.traitCollection.userInterfaceStyle - - $backgroundColor - .assign(to: \.backgroundColor, on: view.container) - .store(in: &disposeBag) - $backgroundColor - .assign(to: \.backgroundColor, on: view.avatarButtonBackgroundView) - .store(in: &disposeBag) - } - - private func bindHeader(view: ProfileCardView) { $authorBannerImageURL .sink { url in diff --git a/Mastodon/Scene/Discovery/ForYou/ProfileCardView.swift b/Mastodon/Scene/Discovery/ForYou/ProfileCardView.swift index 1407c745c..7a2cadb2a 100644 --- a/Mastodon/Scene/Discovery/ForYou/ProfileCardView.swift +++ b/Mastodon/Scene/Discovery/ForYou/ProfileCardView.swift @@ -136,6 +136,7 @@ extension ProfileCardView { container.axis = .vertical container.spacing = 8 container.translatesAutoresizingMaskIntoConstraints = false + container.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color addSubview(container) container.pinToParent() @@ -184,6 +185,7 @@ extension ProfileCardView { avatarButton.heightAnchor.constraint(equalToConstant: ProfileCardView.avatarSize.height).priority(.required - 1), ]) + avatarButtonBackgroundView.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color avatarButtonBackgroundView.layer.masksToBounds = true avatarButtonBackgroundView.layer.cornerCurve = .continuous avatarButtonBackgroundView.layer.cornerRadius = 12 + 1 @@ -256,12 +258,6 @@ extension ProfileCardView { familiarFollowersDashboardView.addGestureRecognizer(familiarFollowersDashboardViewTapGestureRecognizer) } - public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - - viewModel.userInterfaceStyle = traitCollection.userInterfaceStyle - } - public override func layoutSubviews() { updateInfoContainerLayout() super.layoutSubviews() diff --git a/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Scene/Discovery/profile.card.background.colorset/Contents.json b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Scene/Discovery/profile.card.background.colorset/Contents.json index 1fc21a878..9c8c3063a 100644 --- a/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Scene/Discovery/profile.card.background.colorset/Contents.json +++ b/MastodonSDK/Sources/MastodonAsset/Assets.xcassets/Scene/Discovery/profile.card.background.colorset/Contents.json @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "4", - "green" : "5", - "red" : "6" + "blue" : "0x1E", + "green" : "0x1C", + "red" : "0x1C" } }, "idiom" : "universal"