fix: discovery For You profile card has the same color in the true dark mode issue

This commit is contained in:
CMK 2022-07-15 03:32:23 +08:00
parent 5365fabe01
commit 65dcf7d6c2
1 changed files with 10 additions and 2 deletions

View File

@ -58,7 +58,12 @@ extension ProfileCardView {
guard let userInterfaceStyle = userInterfaceStyle else { return }
switch userInterfaceStyle {
case .dark:
self.backgroundColor = theme.systemBackgroundColor
switch theme.themeName {
case .mastodon:
self.backgroundColor = theme.systemBackgroundColor
case .system:
self.backgroundColor = theme.secondarySystemBackgroundColor
}
case .light, .unspecified:
self.backgroundColor = Asset.Scene.Discovery.profileCardBackground.color
@unknown default:
@ -99,7 +104,10 @@ extension ProfileCardView.ViewModel {
private func bindHeader(view: ProfileCardView) {
$authorBannerImageURL
.sink { url in
guard let url = url else { return }
guard let url = url, !url.absoluteString.hasSuffix("missing.png") else {
view.bannerImageView.image = .placeholder(color: .systemGray3)
return
}
view.bannerImageView.af.setImage(
withURL: url,
placeholderImage: .placeholder(color: .systemGray3),