From 9c916b335e3b9aa5dd347f1edd08847092c00485 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 21 Nov 2019 15:01:39 +0100 Subject: [PATCH] Highlight item when in favorites --- Passepartout-iOS/Global/Theme.swift | 10 ++++++++++ .../Scenes/ProviderPoolViewController.swift | 3 +++ 2 files changed, 13 insertions(+) diff --git a/Passepartout-iOS/Global/Theme.swift b/Passepartout-iOS/Global/Theme.swift index b1bbc671..85d059e2 100644 --- a/Passepartout-iOS/Global/Theme.swift +++ b/Passepartout-iOS/Global/Theme.swift @@ -160,6 +160,16 @@ extension UIActivityIndicatorView { } } +extension UIBarButtonItem { + func apply(_ theme: Theme) { + tintColor = nil + } + + func applyAccent(_ theme: Theme) { + tintColor = theme.palette.accent1 + } +} + // XXX: status bar is broken extension MFMailComposeViewController { func apply(_ theme: Theme) { diff --git a/Passepartout-iOS/Scenes/ProviderPoolViewController.swift b/Passepartout-iOS/Scenes/ProviderPoolViewController.swift index 1e3276c2..0cfd94c9 100644 --- a/Passepartout-iOS/Scenes/ProviderPoolViewController.swift +++ b/Passepartout-iOS/Scenes/ProviderPoolViewController.swift @@ -94,6 +94,9 @@ class ProviderPoolViewController: UIViewController { isShowingFavorites = !isShowingFavorites if isShowingFavorites { reloadFavorites() + navigationItem.rightBarButtonItem?.applyAccent(.current) + } else { + navigationItem.rightBarButtonItem?.apply(.current) } tableView.reloadData() }