mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-13 16:53:29 +01:00
Refactors SourceViewController into dedicated tab
* Updates UI to use source icons + tint colors * Adds Edit button + swipe actions
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user