From 6e6c7a68bd0816b671594c1bb86ffc37d77c62e9 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 7 Aug 2019 12:46:20 -0700 Subject: [PATCH] Adds AppIconShortcutsViewController placeholder message --- .../AppIconShortcutsViewController.swift | 11 ++++++++++- External/Roxas | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Delta/Settings/App Icon Shortcuts/AppIconShortcutsViewController.swift b/Delta/Settings/App Icon Shortcuts/AppIconShortcutsViewController.swift index 8c4e068..af82167 100644 --- a/Delta/Settings/App Icon Shortcuts/AppIconShortcutsViewController.swift +++ b/Delta/Settings/App Icon Shortcuts/AppIconShortcutsViewController.swift @@ -54,7 +54,7 @@ private extension AppIconShortcutsViewController { // Mode self.modeDataSource.numberOfSectionsHandler = { 1 } - self.modeDataSource.numberOfItemsHandler = { _ in 1 } + self.modeDataSource.numberOfItemsHandler = { [weak self] _ in (self?.gamesDataSource.itemCount ?? 0) > 0 ? 1 : 0 } self.modeDataSource.cellIdentifierHandler = { _ in "SwitchCell" } // Shortcuts @@ -111,6 +111,11 @@ private extension AppIconShortcutsViewController cell.artworkImageView.superview?.layoutIfNeeded() } self.dataSource.rowAnimation = .fade + + let placeholderView = RSTPlaceholderView() + placeholderView.textLabel.text = NSLocalizedString("No App Icon Shortcuts", comment: "") + placeholderView.detailTextLabel.text = NSLocalizedString("You can customize the shortcuts that appear when 3D Touching the app icon once you've added some games.", comment: "") + self.dataSource.placeholderView = placeholderView } func configureModeCell(_ cell: SwitchTableViewCell, for indexPath: IndexPath) @@ -237,6 +242,8 @@ extension AppIconShortcutsViewController override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + guard self.dataSource.itemCount > 0 else { return nil } + switch section { case 0: return nil @@ -251,6 +258,8 @@ extension AppIconShortcutsViewController override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { + guard self.dataSource.itemCount > 0 else { return nil } + switch (section, Settings.gameShortcutsMode) { case (0, .recent): return NSLocalizedString("Your most recently played games will appear as shortcuts when 3D touching the app icon.", comment: "") diff --git a/External/Roxas b/External/Roxas index 8ab1eec..89510d7 160000 --- a/External/Roxas +++ b/External/Roxas @@ -1 +1 @@ -Subproject commit 8ab1eecff273609896dff9bb18f17185ffa08f26 +Subproject commit 89510d73ca548da6094348bc2c7b7f1887475d55