From 066616b005a82cb59e395876b637f419a4f4e175 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 16 Aug 2019 13:27:41 -0500 Subject: [PATCH] Add new images used in context menus to AppAssets where they belong --- iOS/AppAssets.swift | 16 ++++++++++++++++ iOS/MasterFeed/MasterFeedViewController.swift | 10 +++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index d6646cfe2..9d3e76409 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -36,6 +36,14 @@ struct AppAssets { return image.withTintColor(AppAssets.chevronDisclosureColor, renderingMode: .alwaysOriginal) }() + static var copyImage: UIImage = { + return UIImage(systemName: "doc.on.doc")! + }() + + static var editImage: UIImage = { + UIImage(systemName: "square.and.pencil")! + }() + static var faviconTemplateImage: RSImage = { return RSImage(named: "faviconTemplateImage")! }() @@ -52,6 +60,10 @@ struct AppAssets { return UIColor(named: "netNewsWireBlueColor")! }() + static var safariImage: UIImage = { + return UIImage(systemName: "safari")! + }() + static var selectedTextColor: UIColor = { return UIColor(named: "selectedTextColor")! }() @@ -89,4 +101,8 @@ struct AppAssets { return UIColor(named: "timelineUnreadCircleColor")! }() + static var trashImage: UIImage = { + return UIImage(systemName: "trash")! + }() + } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 41391e394..74fc47274 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -694,7 +694,7 @@ private extension MasterFeedViewController { } let title = NSLocalizedString("Open Home Page", comment: "Open Home Page") - let action = UIAction(title: title, image: UIImage(systemName: "safari")) { action in + let action = UIAction(title: title, image: AppAssets.safariImage) { action in UIApplication.shared.open(url, options: [:]) } return action @@ -724,7 +724,7 @@ private extension MasterFeedViewController { } let title = NSLocalizedString("Copy Feed URL", comment: "Copy Feed URL") - let action = UIAction(title: title, image: UIImage(systemName: "doc.on.doc")) { action in + let action = UIAction(title: title, image: AppAssets.copyImage) { action in UIPasteboard.general.url = url } return action @@ -754,7 +754,7 @@ private extension MasterFeedViewController { } let title = NSLocalizedString("Copy Home Page URL", comment: "Copy Home Page URL") - let action = UIAction(title: title, image: UIImage(systemName: "doc.on.doc")) { action in + let action = UIAction(title: title, image: AppAssets.copyImage) { action in UIPasteboard.general.url = url } return action @@ -778,7 +778,7 @@ private extension MasterFeedViewController { func deleteAction(indexPath: IndexPath) -> UIAction { let title = NSLocalizedString("Delete", comment: "Delete") - let action = UIAction(title: title, image: UIImage(systemName: "trash")) { action in + let action = UIAction(title: title, image: AppAssets.trashImage) { action in self.delete(indexPath: indexPath) } return action @@ -786,7 +786,7 @@ private extension MasterFeedViewController { func renameAction(indexPath: IndexPath) -> UIAction { let title = NSLocalizedString("Rename", comment: "Rename") - let action = UIAction(title: title, image: UIImage(systemName: "square.and.pencil")) { action in + let action = UIAction(title: title, image: AppAssets.editImage) { action in self.rename(indexPath: indexPath) } return action