From 4778d48b6703f5be5808b990e58d149a9db10676 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 21 Feb 2019 16:13:05 -0800 Subject: [PATCH] Hides syncing status Settings row when no syncing service is selected --- Delta/Settings/SettingsViewController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Delta/Settings/SettingsViewController.swift b/Delta/Settings/SettingsViewController.swift index ccb782e..2572fbc 100644 --- a/Delta/Settings/SettingsViewController.swift +++ b/Delta/Settings/SettingsViewController.swift @@ -203,10 +203,10 @@ private extension SettingsViewController case .syncingService: let selectedIndexPath = self.tableView.indexPathForSelectedRow - let indexPath = IndexPath(row: SyncingRow.service.rawValue, section: Section.syncing.rawValue) - self.tableView.reloadRows(at: [indexPath], with: .none) + self.tableView.reloadSections(IndexSet(integer: Section.syncing.rawValue), with: .none) - if indexPath == selectedIndexPath + let syncingServiceIndexPath = IndexPath(row: SyncingRow.service.rawValue, section: Section.syncing.rawValue) + if selectedIndexPath == syncingServiceIndexPath { self.tableView.selectRow(at: selectedIndexPath, animated: true, scrollPosition: .none) } @@ -233,6 +233,7 @@ extension SettingsViewController { case .controllers: return 1 // Temporarily hide other controller indexes until controller logic is finalized case .controllerSkins: return System.allCases.count + case .syncing: return Settings.syncingService == .none ? 1 : super.tableView(tableView, numberOfRowsInSection: sectionIndex) default: if isSectionHidden(section) {