From c5fed06581e8c0403588a01cfe28a6f5047627d6 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 2 Sep 2019 15:45:09 -0500 Subject: [PATCH] Add refresh home screen shortcut. --- iOS/AppDelegate.swift | 8 ++++++-- iOS/SceneDelegate.swift | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 7efd477d5..69cb07811 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -206,11 +206,15 @@ private extension AppDelegate { let searchIcon = UIApplicationShortcutIcon(systemImageName: "magnifyingglass") let searchItem = UIApplicationShortcutItem(type: "com.ranchero.NetNewsWire.ShowSearch", localizedTitle: searchTitle, localizedSubtitle: nil, icon: searchIcon, userInfo: nil) - let addTitle = NSLocalizedString("Add", comment: "Add") + let addTitle = NSLocalizedString("Add Feed", comment: "Add Feed") let addIcon = UIApplicationShortcutIcon(systemImageName: "plus") let addItem = UIApplicationShortcutItem(type: "com.ranchero.NetNewsWire.ShowAdd", localizedTitle: addTitle, localizedSubtitle: nil, icon: addIcon, userInfo: nil) - UIApplication.shared.shortcutItems = [addItem, searchItem, unreadItem] + let refreshTitle = NSLocalizedString("Refresh", comment: "Refresh") + let refreshIcon = UIApplicationShortcutIcon(systemImageName: "arrow.clockwise") + let refreshItem = UIApplicationShortcutItem(type: "com.ranchero.NetNewsWire.Refresh", localizedTitle: refreshTitle, localizedSubtitle: nil, icon: refreshIcon, userInfo: nil) + + UIApplication.shared.shortcutItems = [addItem, searchItem, unreadItem, refreshItem] } } diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 03e7cab9a..f3c06e376 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -7,6 +7,7 @@ // import UIKit +import Account class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -66,6 +67,8 @@ private extension SceneDelegate { coordinator.showSearch() case "com.ranchero.NetNewsWire.ShowAdd": coordinator.showAdd() + case "com.ranchero.NetNewsWire.Refresh": + AccountManager.shared.refreshAll(errorHandler: ErrorHandler.log) default: break }