Refactors SourceViewController into dedicated tab

* Updates UI to use source icons + tint colors
* Adds Edit button + swipe actions
This commit is contained in:
Riley Testut
2023-10-17 14:49:13 -05:00
parent 9930f62f2f
commit 1b56ac708f
16 changed files with 520 additions and 688 deletions

View File

@@ -131,6 +131,8 @@ extension AppBannerView
}
}
}
self.style = .app
let values = AppValues(app: app)
self.titleLabel.text = app.name // Don't use values.name since that already includes "beta".
@@ -147,6 +149,22 @@ extension AppBannerView
self.accessibilityLabel = values.name
}
}
func configure(for source: Source)
{
self.style = .source
self.titleLabel.text = source.name
let subtitle = source.subtitle ?? source.sourceURL.absoluteString
self.subtitleLabel.text = subtitle
let tintColor = source.effectiveTintColor ?? .altPrimary
self.tintColor = tintColor
let accessibilityLabel = source.name + "\n" + subtitle
self.accessibilityLabel = accessibilityLabel
}
}
private extension AppBannerView
@@ -162,20 +180,28 @@ private extension AppBannerView
switch self.style
{
case .app:
self.directionalLayoutMargins.trailing = self.stackView.directionalLayoutMargins.trailing
self.iconImageViewHeightConstraint.constant = 60
self.iconImageView.style = .icon
self.titleLabel.textColor = .label
self.button.style = .pill
self.backgroundEffectView.contentView.backgroundColor = UIColor(resource: .blurTint)
self.backgroundEffectView.backgroundColor = tintColor
case .source:
self.directionalLayoutMargins.trailing = 20
self.iconImageViewHeightConstraint.constant = 44
self.iconImageView.style = .circular
self.titleLabel.textColor = .white
self.button.style = .custom
self.backgroundEffectView.contentView.backgroundColor = tintColor?.adjustedForDisplay
self.backgroundEffectView.backgroundColor = nil