Add tapping hashtags to show tag timeline
This commit is contained in:
parent
48465e68f8
commit
fa002fbed6
|
@ -14,14 +14,17 @@ class MainTabBarViewController: UITabBarController {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
viewControllers = [
|
viewControllers = [
|
||||||
TimelineTableViewController.create(for: .home),
|
navigationController(for: TimelineTableViewController.create(for: .home)),
|
||||||
TimelineTableViewController.create(for: .public(local: false)),
|
navigationController(for: TimelineTableViewController.create(for: .public(local: false))),
|
||||||
TimelineTableViewController.create(for: .public(local: true)),
|
navigationController(for: TimelineTableViewController.create(for: .public(local: true))),
|
||||||
NotificationsTableViewController.create(),
|
NotificationsTableViewController.create(),
|
||||||
PreferencesTableViewController.create()
|
PreferencesTableViewController.create()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func navigationController(for vc: UIViewController) -> UINavigationController {
|
||||||
|
return UINavigationController(rootViewController: vc)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// MARK: - Navigation
|
// MARK: - Navigation
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="CK3-h7-JHA">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.15" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="6nb-nb-cMm">
|
||||||
<device id="retina4_7" orientation="portrait">
|
<device id="retina4_7" orientation="portrait">
|
||||||
<adaptation id="fullscreen"/>
|
<adaptation id="fullscreen"/>
|
||||||
</device>
|
</device>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.9"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
|
@ -49,25 +49,5 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1410" y="-359"/>
|
<point key="canvasLocation" x="1410" y="-359"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Item-->
|
|
||||||
<scene sceneID="yNQ-ej-ymp">
|
|
||||||
<objects>
|
|
||||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="CK3-h7-JHA" sceneMemberID="viewController">
|
|
||||||
<tabBarItem key="tabBarItem" title="Item" id="2mE-wd-ffe"/>
|
|
||||||
<toolbarItems/>
|
|
||||||
<simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
|
|
||||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="kM6-kS-XRr">
|
|
||||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</navigationBar>
|
|
||||||
<nil name="viewControllers"/>
|
|
||||||
<connections>
|
|
||||||
<segue destination="6nb-nb-cMm" kind="relationship" relationship="rootViewController" id="Ga2-04-Wda"/>
|
|
||||||
</connections>
|
|
||||||
</navigationController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="2IM-IS-Cf8" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="-138.40000000000001" y="-90.404797601199405"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
</scenes>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -12,8 +12,7 @@ import Pachyderm
|
||||||
class TimelineTableViewController: UITableViewController {
|
class TimelineTableViewController: UITableViewController {
|
||||||
|
|
||||||
static func create(for timeline: Timeline) -> UIViewController {
|
static func create(for timeline: Timeline) -> UIViewController {
|
||||||
guard let navigationController = UIStoryboard(name: "Timeline", bundle: nil).instantiateInitialViewController() as? UINavigationController,
|
guard let timelineController = UIStoryboard(name: "Timeline", bundle: nil).instantiateInitialViewController() as? TimelineTableViewController else { fatalError() }
|
||||||
let timelineController = navigationController.topViewController as? TimelineTableViewController else { fatalError() }
|
|
||||||
timelineController.timeline = timeline
|
timelineController.timeline = timeline
|
||||||
|
|
||||||
let title: String
|
let title: String
|
||||||
|
@ -29,10 +28,9 @@ class TimelineTableViewController: UITableViewController {
|
||||||
case .direct:
|
case .direct:
|
||||||
title = "Direct"
|
title = "Direct"
|
||||||
}
|
}
|
||||||
navigationController.tabBarItem.title = title
|
timelineController.title = title
|
||||||
timelineController.navigationItem.title = title
|
|
||||||
|
|
||||||
return navigationController
|
return timelineController
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy var favoriteActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 137/131, height: 30)).image { _ in
|
lazy var favoriteActionImage: UIImage = UIGraphicsImageRenderer(size: CGSize(width: 30 * 137/131, height: 30)).image { _ in
|
||||||
|
|
|
@ -53,7 +53,12 @@ extension TuskerNavigationDelegate where Self: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func selected(tag: Hashtag) {
|
func selected(tag: Hashtag) {
|
||||||
|
guard let navigationController = navigationController else {
|
||||||
|
fatalError("Can't show hashtag timeline when not in navigation controller")
|
||||||
|
}
|
||||||
|
let timeline = Timeline.tag(hashtag: tag.name)
|
||||||
|
let vc = TimelineTableViewController.create(for: timeline)
|
||||||
|
navigationController.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func selected(url: URL) {
|
func selected(url: URL) {
|
||||||
|
|
Loading…
Reference in New Issue