forked from shadowfacts/Tusker
Allow saving or following hashtag from Add screen
This commit is contained in:
parent
478ba3db28
commit
3c80ec8b43
|
@ -84,7 +84,7 @@ class AddSavedHashtagViewController: UIViewController {
|
|||
navigationItem.searchController = searchController
|
||||
navigationItem.hidesSearchBarWhenScrolling = false
|
||||
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelButtonPressed))
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneButtonPressed))
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
@ -107,15 +107,12 @@ class AddSavedHashtagViewController: UIViewController {
|
|||
}
|
||||
|
||||
private func selectHashtag(_ hashtag: Hashtag) {
|
||||
let context = mastodonController.persistentContainer.viewContext
|
||||
_ = SavedHashtag(hashtag: hashtag, context: context)
|
||||
try! context.save()
|
||||
presentingViewController!.dismiss(animated: true)
|
||||
show(HashtagTimelineViewController(for: hashtag, mastodonController: mastodonController), sender: nil)
|
||||
}
|
||||
|
||||
// MARK: - Interaction
|
||||
|
||||
@objc func cancelButtonPressed() {
|
||||
@objc func doneButtonPressed() {
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
||||
|
@ -128,11 +125,6 @@ extension AddSavedHashtagViewController {
|
|||
enum Item: Hashable {
|
||||
case tag(Hashtag)
|
||||
}
|
||||
// class DataSource: UITableViewDiffableDataSource<Section, Item> {
|
||||
// override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
extension AddSavedHashtagViewController: UICollectionViewDelegate {
|
||||
|
|
|
@ -437,7 +437,7 @@ extension ExploreViewController {
|
|||
case let .savedHashtag(hashtag):
|
||||
return hashtag.name
|
||||
case .addSavedHashtag:
|
||||
return NSLocalizedString("Save Hashtag...", comment: "save hashtag nav item title")
|
||||
return NSLocalizedString("Add Hashtag...", comment: "save hashtag nav item title")
|
||||
case let .savedInstance(url):
|
||||
return url.host!
|
||||
case .findInstance:
|
||||
|
|
Loading…
Reference in New Issue