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.searchController = searchController
|
||||||
navigationItem.hidesSearchBarWhenScrolling = false
|
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) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
@ -107,15 +107,12 @@ class AddSavedHashtagViewController: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func selectHashtag(_ hashtag: Hashtag) {
|
private func selectHashtag(_ hashtag: Hashtag) {
|
||||||
let context = mastodonController.persistentContainer.viewContext
|
show(HashtagTimelineViewController(for: hashtag, mastodonController: mastodonController), sender: nil)
|
||||||
_ = SavedHashtag(hashtag: hashtag, context: context)
|
|
||||||
try! context.save()
|
|
||||||
presentingViewController!.dismiss(animated: true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Interaction
|
// MARK: - Interaction
|
||||||
|
|
||||||
@objc func cancelButtonPressed() {
|
@objc func doneButtonPressed() {
|
||||||
dismiss(animated: true)
|
dismiss(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,11 +125,6 @@ extension AddSavedHashtagViewController {
|
||||||
enum Item: Hashable {
|
enum Item: Hashable {
|
||||||
case tag(Hashtag)
|
case tag(Hashtag)
|
||||||
}
|
}
|
||||||
// class DataSource: UITableViewDiffableDataSource<Section, Item> {
|
|
||||||
// override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AddSavedHashtagViewController: UICollectionViewDelegate {
|
extension AddSavedHashtagViewController: UICollectionViewDelegate {
|
||||||
|
|
|
@ -437,7 +437,7 @@ extension ExploreViewController {
|
||||||
case let .savedHashtag(hashtag):
|
case let .savedHashtag(hashtag):
|
||||||
return hashtag.name
|
return hashtag.name
|
||||||
case .addSavedHashtag:
|
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):
|
case let .savedInstance(url):
|
||||||
return url.host!
|
return url.host!
|
||||||
case .findInstance:
|
case .findInstance:
|
||||||
|
|
Loading…
Reference in New Issue