Merge pull request #820 from pietropizzi/fix-profile-avatar-border-color

Fix: Profile Avatar Border Color is correct in Dark Mode
This commit is contained in:
Nathan Mattes 2022-12-26 13:55:28 +01:00 committed by GitHub
commit a65b643ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -28,7 +28,6 @@ final class ProfileHeaderView: UIView {
static let avatarImageViewSize = CGSize(width: 98, height: 98)
static let avatarImageViewCornerRadius: CGFloat = 25
static let avatarImageViewBorderColor = UIColor.white
static let avatarImageViewBorderWidth: CGFloat = 2
static let friendshipActionButtonSize = CGSize(width: 108, height: 34)
static let bannerImageViewPlaceholderColor = UIColor.systemGray
@ -90,7 +89,6 @@ final class ProfileHeaderView: UIView {
view.layer.masksToBounds = true
view.layer.cornerRadius = ProfileHeaderView.avatarImageViewCornerRadius
view.layer.cornerCurve = .continuous
view.layer.borderColor = ProfileHeaderView.avatarImageViewBorderColor.cgColor
view.layer.borderWidth = ProfileHeaderView.avatarImageViewBorderWidth
return view
}()
@ -242,14 +240,13 @@ final class ProfileHeaderView: UIView {
extension ProfileHeaderView {
private func _init() {
backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor
avatarButton.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor
ThemeService.shared.currentTheme
let currentTheme = ThemeService.shared.currentTheme
setColors(from: currentTheme.value)
currentTheme
.receive(on: DispatchQueue.main)
.sink { [weak self] theme in
guard let self = self else { return }
self.backgroundColor = theme.systemBackgroundColor
self.avatarButton.backgroundColor = theme.secondarySystemBackgroundColor
self?.setColors(from: theme)
}
.store(in: &_disposeBag)
@ -455,6 +452,12 @@ extension ProfileHeaderView {
updateLayoutMargins()
}
private func setColors(from theme: Theme) {
backgroundColor = theme.systemBackgroundColor
avatarButton.backgroundColor = theme.secondarySystemBackgroundColor
avatarImageViewBackgroundView.layer.borderColor = theme.systemBackgroundColor.cgColor
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

View File

@ -29,6 +29,6 @@ SPEC CHECKSUMS:
SwiftGen: 1366a7f71aeef49954ca5a63ba4bef6b0f24138c
XLPagerTabStrip: 61c57fd61f611ee5f01ff1495ad6fbee8bf496c5
PODFILE CHECKSUM: 9bca0a8bef019bda7253d8b5cdbce4c53a141398
PODFILE CHECKSUM: 5b1dbf90a3e6fff01240ad0a2ceb2bc7f7bb4e36
COCOAPODS: 1.11.3