From 961b5cfa2d1675ea3b378cb19a1bd36701518350 Mon Sep 17 00:00:00 2001 From: meb Date: Sat, 3 May 2025 22:37:14 +0200 Subject: [PATCH 1/2] add quick add to searchbar button --- Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj | 4 +- .../Search/SearchTableViewController.swift | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj b/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj index fd409f7..8a5be70 100644 --- a/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj +++ b/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj @@ -869,7 +869,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 67; DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = FMXL9R3NPC; + DEVELOPMENT_TEAM = 7Q6Z688L3B; INFOPLIST_FILE = Pr0gramm/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.pr0gramm.Pr0grammApp; PRODUCT_NAME = pr0gramm; @@ -888,7 +888,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 67; DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = FMXL9R3NPC; + DEVELOPMENT_TEAM = 7Q6Z688L3B; INFOPLIST_FILE = Pr0gramm/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.pr0gramm.Pr0grammApp; PRODUCT_NAME = pr0gramm; diff --git a/Pr0gramm/Pr0gramm/Search/SearchTableViewController.swift b/Pr0gramm/Pr0gramm/Search/SearchTableViewController.swift index 4db65cf..6eb0b99 100644 --- a/Pr0gramm/Pr0gramm/Search/SearchTableViewController.swift +++ b/Pr0gramm/Pr0gramm/Search/SearchTableViewController.swift @@ -57,12 +57,53 @@ class SearchTableViewController: UITableViewController, Storyboarded { } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "searchTextCell")! - cell.textLabel?.text = AppSettings.latestSearchStrings[indexPath.row] + let cell = tableView.dequeueReusableCell(withIdentifier: "searchTextCell") ?? UITableViewCell(style: .default, reuseIdentifier: "searchTextCell") + + // Configure label + let searchText = AppSettings.latestSearchStrings[indexPath.row] + cell.textLabel?.text = searchText cell.textLabel?.textColor = #colorLiteral(red: 0.9490196078, green: 0.9607843137, blue: 0.9568627451, alpha: 1) + + // Add arrow button if not already added + let buttonTag = 999 + if cell.contentView.viewWithTag(buttonTag) == nil { + let button = UIButton(type: .system) + let config = UIImage.SymbolConfiguration(pointSize: 16, weight: .medium) + let image = UIImage(systemName: "arrow.up.right", withConfiguration: config) + button.setImage(image, for: .normal) + button.tintColor = .white + button.tag = buttonTag + button.addTarget(self, action: #selector(didTapArrowButton(_:)), for: .touchUpInside) + cell.contentView.addSubview(button) + + // Layout + button.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + button.centerYAnchor.constraint(equalTo: cell.contentView.centerYAnchor), + button.trailingAnchor.constraint(equalTo: cell.contentView.trailingAnchor, constant: -16), + button.widthAnchor.constraint(equalToConstant: 30), + button.heightAnchor.constraint(equalToConstant: 30) + ]) + } + + // Store index path as accessibility identifier for retrieval + if let button = cell.contentView.viewWithTag(buttonTag) as? UIButton { + button.accessibilityIdentifier = "\(indexPath.row)" + } + return cell } + @objc func didTapArrowButton(_ sender: UIButton) { + guard let id = sender.accessibilityIdentifier, + let index = Int(id), + index < AppSettings.latestSearchStrings.count else { return } + + let text = AppSettings.latestSearchStrings[index] + searchController.searchBar.text = text + searchController.searchBar.becomeFirstResponder() + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { search(searchString: AppSettings.latestSearchStrings[indexPath.row]) } From ec0536f90712556c81a1aec00d6e2a14ad43b69b Mon Sep 17 00:00:00 2001 From: meb Date: Sat, 3 May 2025 22:48:30 +0200 Subject: [PATCH 2/2] revert dev team --- Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj b/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj index 8a5be70..fd409f7 100644 --- a/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj +++ b/Pr0gramm/Pr0gramm.xcodeproj/project.pbxproj @@ -869,7 +869,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 67; DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = 7Q6Z688L3B; + DEVELOPMENT_TEAM = FMXL9R3NPC; INFOPLIST_FILE = Pr0gramm/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.pr0gramm.Pr0grammApp; PRODUCT_NAME = pr0gramm; @@ -888,7 +888,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 67; DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = 7Q6Z688L3B; + DEVELOPMENT_TEAM = FMXL9R3NPC; INFOPLIST_FILE = Pr0gramm/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.pr0gramm.Pr0grammApp; PRODUCT_NAME = pr0gramm;