mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-28 16:20:10 +01:00
Fix background color (IOS-194)
This commit is contained in:
parent
c45252b294
commit
32520be6c9
@ -21,9 +21,6 @@ extension ProfileCardView {
|
|||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
public let relationshipViewModel = RelationshipViewModel()
|
public let relationshipViewModel = RelationshipViewModel()
|
||||||
|
|
||||||
@Published public var userInterfaceStyle: UIUserInterfaceStyle?
|
|
||||||
@Published public var backgroundColor: UIColor?
|
|
||||||
|
|
||||||
// Author
|
// Author
|
||||||
@Published public var authorBannerImageURL: URL?
|
@Published public var authorBannerImageURL: URL?
|
||||||
@ -46,32 +43,11 @@ extension ProfileCardView {
|
|||||||
@Published public var groupedAccessibilityLabel = ""
|
@Published public var groupedAccessibilityLabel = ""
|
||||||
|
|
||||||
@Published public var familiarFollowers: Mastodon.Entity.FamiliarFollowers?
|
@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 {
|
extension ProfileCardView.ViewModel {
|
||||||
func bind(view: ProfileCardView) {
|
func bind(view: ProfileCardView) {
|
||||||
bindAppearacne(view: view)
|
|
||||||
bindHeader(view: view)
|
bindHeader(view: view)
|
||||||
bindUser(view: view)
|
bindUser(view: view)
|
||||||
bindBio(view: view)
|
bindBio(view: view)
|
||||||
@ -81,18 +57,6 @@ extension ProfileCardView.ViewModel {
|
|||||||
// bindAccessibility(view: view)
|
// 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) {
|
private func bindHeader(view: ProfileCardView) {
|
||||||
$authorBannerImageURL
|
$authorBannerImageURL
|
||||||
.sink { url in
|
.sink { url in
|
||||||
|
@ -136,6 +136,7 @@ extension ProfileCardView {
|
|||||||
container.axis = .vertical
|
container.axis = .vertical
|
||||||
container.spacing = 8
|
container.spacing = 8
|
||||||
container.translatesAutoresizingMaskIntoConstraints = false
|
container.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
container.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color
|
||||||
addSubview(container)
|
addSubview(container)
|
||||||
container.pinToParent()
|
container.pinToParent()
|
||||||
|
|
||||||
@ -184,6 +185,7 @@ extension ProfileCardView {
|
|||||||
avatarButton.heightAnchor.constraint(equalToConstant: ProfileCardView.avatarSize.height).priority(.required - 1),
|
avatarButton.heightAnchor.constraint(equalToConstant: ProfileCardView.avatarSize.height).priority(.required - 1),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
avatarButtonBackgroundView.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color
|
||||||
avatarButtonBackgroundView.layer.masksToBounds = true
|
avatarButtonBackgroundView.layer.masksToBounds = true
|
||||||
avatarButtonBackgroundView.layer.cornerCurve = .continuous
|
avatarButtonBackgroundView.layer.cornerCurve = .continuous
|
||||||
avatarButtonBackgroundView.layer.cornerRadius = 12 + 1
|
avatarButtonBackgroundView.layer.cornerRadius = 12 + 1
|
||||||
@ -256,12 +258,6 @@ extension ProfileCardView {
|
|||||||
familiarFollowersDashboardView.addGestureRecognizer(familiarFollowersDashboardViewTapGestureRecognizer)
|
familiarFollowersDashboardView.addGestureRecognizer(familiarFollowersDashboardViewTapGestureRecognizer)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
|
||||||
super.traitCollectionDidChange(previousTraitCollection)
|
|
||||||
|
|
||||||
viewModel.userInterfaceStyle = traitCollection.userInterfaceStyle
|
|
||||||
}
|
|
||||||
|
|
||||||
public override func layoutSubviews() {
|
public override func layoutSubviews() {
|
||||||
updateInfoContainerLayout()
|
updateInfoContainerLayout()
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
"color-space" : "srgb",
|
"color-space" : "srgb",
|
||||||
"components" : {
|
"components" : {
|
||||||
"alpha" : "1.000",
|
"alpha" : "1.000",
|
||||||
"blue" : "4",
|
"blue" : "0x1E",
|
||||||
"green" : "5",
|
"green" : "0x1C",
|
||||||
"red" : "6"
|
"red" : "0x1C"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"idiom" : "universal"
|
"idiom" : "universal"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user