From d05b450cc57242c062de63cdb023cecc83eec818 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 11 Aug 2020 20:41:20 -0500 Subject: [PATCH] Use colorful smart feed icons on iOS --- iOS/AppAssets.swift | 9 ++++++--- iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift | 14 +++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 4cf633fb4..c2b7b28d1 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -206,7 +206,8 @@ struct AppAssets { }() static var starredFeedImage: IconImage = { - return IconImage(UIImage(systemName: "star.fill")!) + let image = UIImage(systemName: "star.fill")! + return IconImage(image, isSymbol: true, preferredColor: AppAssets.starColor.cgColor) }() static var tickMarkColor: UIColor = { @@ -219,7 +220,8 @@ struct AppAssets { }() static var todayFeedImage: IconImage = { - return IconImage(UIImage(systemName: "sun.max.fill")!) + let image = UIImage(systemName: "sun.max.fill")! + return IconImage(image, isSymbol: true, preferredColor: UIColor.systemOrange.cgColor) }() static var trashImage: UIImage = { @@ -227,7 +229,8 @@ struct AppAssets { }() static var unreadFeedImage: IconImage = { - return IconImage(UIImage(systemName: "largecircle.fill.circle")!) + let image = UIImage(systemName: "largecircle.fill.circle")! + return IconImage(image, isSymbol: true, preferredColor: AppAssets.secondaryAccentColor.cgColor) }() static var vibrantTextColor: UIColor = { diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift index bf9d4652b..7b8390079 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift @@ -155,10 +155,22 @@ class MasterFeedTableViewCell : VibrantTableViewCell { override func updateVibrancy(animated: Bool) { super.updateVibrancy(animated: animated) - let iconTintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor + + let iconTintColor: UIColor + if isHighlighted || isSelected { + iconTintColor = AppAssets.vibrantTextColor + } else { + if let preferredColor = iconImage?.preferredColor { + iconTintColor = UIColor(cgColor: preferredColor) + } else { + iconTintColor = AppAssets.secondaryAccentColor + } + } + UIView.animate(withDuration: duration(animated: animated)) { self.iconView.tintColor = iconTintColor } + updateLabelVibrancy(titleView, color: labelColor, animated: animated) }