diff --git a/TESTING.md b/TESTING.md index 6c77bf2..3cac859 100644 --- a/TESTING.md +++ b/TESTING.md @@ -590,16 +590,18 @@ source update are published, and installs or updates Gotcha through AltStore PAL ## Settings, accessibility, and lifecycle - [ ] Settings opens from the gear button on Home and is not a tab. -- [ ] Home, Issues, Repositories, Pull Requests, Milestones, Actions, and Server - Activity use the destination name as the primary navigation title and the - selected server as the smaller subtitle; changing servers updates both. +- [ ] Home, Issues, Repositories, Pull Requests, Milestones, and Actions use the + destination name as the primary navigation title and the selected server + as the smaller subtitle; changing servers updates both. - [ ] Primary Navigation always keeps Home first and allows up to four ordered, - unique choices from Issues, Repos, Pulls, Milestones, Actions, and Server - Activity. Add, remove, and reorder destinations with native table - controls; tab order updates immediately, omitted destinations remain on - Home, and the configuration survives relaunch and server changes. An - upgrade from the previous build starts with Issues, Repos, Pulls, and - Milestones. + unique choices from Issues, Repos, Pulls, Milestones, and Actions. Server + Activity remains only the **All users** Home timeline. Outside Edit mode, + rows cannot add, remove, or reorder destinations. In Edit mode, native + insert, delete, and reorder controls perform all three operations; tab + order updates immediately, omitted destinations remain on Home, and the + configuration survives relaunch and server changes. Existing saved + Server Activity tabs are removed during migration. An upgrade from the + previous build otherwise preserves its destination order. - [ ] Appearance changes between Auto, Light, and Dark immediately; Auto follows the simulator system appearance. - [ ] Icon and appearance settings remain selected after relaunch. diff --git a/crates/app/src/domain.rs b/crates/app/src/domain.rs index 8514f67..301d162 100644 --- a/crates/app/src/domain.rs +++ b/crates/app/src/domain.rs @@ -110,7 +110,10 @@ pub fn normalize_primary_destinations(destinations: &mut Vec String? { - section == 0 ? "Shown After Home" : "Available on Home" + section == 0 ? "Shown After Home" : "Available Destinations" } override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? { section == 0 - ? "Choose up to four destinations. Tap Edit to reorder them. Home is always first." + ? "Tap Edit to add, remove, or reorder up to four destinations. Home is always first." : "Destinations not in the tab bar remain available as buttons on Home." } @@ -49,19 +49,18 @@ final class NavigationSettingsViewController: UITableViewController { if indexPath.section == 1 && selected.count == 4 { content.textProperties.color = .secondaryLabel content.imageProperties.tintColor = .tertiaryLabel - cell.selectionStyle = .none - } else if indexPath.section == 1 { - let add = UIImageView(image: UIImage(systemName: "plus.circle.fill")) - add.tintColor = .tintColor - cell.accessoryView = add - cell.accessibilityHint = "Adds this destination to the tab bar" } + cell.selectionStyle = .none cell.contentConfiguration = content return cell } + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + tableView.isEditing && (indexPath.section == 0 || selected.count < 4) + } + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { - indexPath.section == 0 + tableView.isEditing && indexPath.section == 0 } override func tableView( @@ -93,7 +92,8 @@ final class NavigationSettingsViewController: UITableViewController { _ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath ) -> UITableViewCell.EditingStyle { - indexPath.section == 0 ? .delete : .none + if indexPath.section == 0 { return .delete } + return selected.count < 4 ? .insert : .none } override func tableView( @@ -101,18 +101,20 @@ final class NavigationSettingsViewController: UITableViewController { commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath ) { - guard editingStyle == .delete, indexPath.section == 0 else { return } - selected.remove(at: indexPath.row) + switch (editingStyle, indexPath.section) { + case (.delete, 0): + selected.remove(at: indexPath.row) + case (.insert, 1) where selected.count < 4: + selected.append(available[indexPath.row]) + default: + return + } save() tableView.reloadData() } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) - guard indexPath.section == 1, selected.count < 4 else { return } - selected.append(available[indexPath.row]) - save() - tableView.reloadData() } private func save() {