mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Add Reddit Feed adding functionality
This commit is contained in:
parent
0ec250ec24
commit
e7f42905dc
@ -97,6 +97,11 @@
|
||||
511D43EF231FBDE900FB1562 /* LaunchScreenPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 511D43ED231FBDE800FB1562 /* LaunchScreenPad.storyboard */; };
|
||||
511D4419231FC02D00FB1562 /* KeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 511D4410231FC02D00FB1562 /* KeyboardManager.swift */; };
|
||||
51236339236915B100951F16 /* RoundedProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512363372369155100951F16 /* RoundedProgressView.swift */; };
|
||||
512392BE24E33A3C00F11704 /* RedditSelectAccountTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE603246AF37B00731738 /* RedditSelectAccountTableViewController.swift */; };
|
||||
512392BF24E33A3C00F11704 /* RedditSelectSortTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE607246AFC9900731738 /* RedditSelectSortTableViewController.swift */; };
|
||||
512392C024E33A3C00F11704 /* RedditAdd.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 516AE5FF246AF34100731738 /* RedditAdd.storyboard */; };
|
||||
512392C124E33A3C00F11704 /* RedditSelectTypeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE601246AF36100731738 /* RedditSelectTypeTableViewController.swift */; };
|
||||
512392C224E33A3C00F11704 /* RedditEnterDetailTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE605246AF3A900731738 /* RedditEnterDetailTableViewController.swift */; };
|
||||
5125E6CA24AE461D002A7562 /* TimelineLayoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17B223DB24AC24D2001E4592 /* TimelineLayoutView.swift */; };
|
||||
5126EE97226CB48A00C22AFC /* SceneCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5126EE96226CB48A00C22AFC /* SceneCoordinator.swift */; };
|
||||
5127B238222B4849006D641D /* DetailKeyboardDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5127B236222B4849006D641D /* DetailKeyboardDelegate.swift */; };
|
||||
@ -4139,6 +4144,7 @@
|
||||
511D43CF231FA62200FB1562 /* DetailKeyboardShortcuts.plist in Resources */,
|
||||
51A1699A235E10D700EB091F /* Settings.storyboard in Resources */,
|
||||
49F40DF92335B71000552BF4 /* newsfoot.js in Resources */,
|
||||
512392C024E33A3C00F11704 /* RedditAdd.storyboard in Resources */,
|
||||
51F85BEF2272520B00C787DC /* Thanks.rtf in Resources */,
|
||||
51CE1C0923621EDA005548FC /* RefreshProgressView.xib in Resources */,
|
||||
84C9FC9D2262A1A900D921D6 /* Assets.xcassets in Resources */,
|
||||
@ -4942,11 +4948,13 @@
|
||||
C5A6ED6D23C9B0C800AB6BE2 /* UIActivityViewController-Extensions.swift in Sources */,
|
||||
5108F6D42375EEEF001ABC45 /* TimelinePreviewTableViewController.swift in Sources */,
|
||||
84CAFCA522BC8C08007694F0 /* FetchRequestQueue.swift in Sources */,
|
||||
512392BE24E33A3C00F11704 /* RedditSelectAccountTableViewController.swift in Sources */,
|
||||
515A517B243E90260089E588 /* ExtensionPoint.swift in Sources */,
|
||||
51C4529C22650A1000C03939 /* SingleFaviconDownloader.swift in Sources */,
|
||||
51E595A6228CC36500FCC42B /* ArticleStatusSyncTimer.swift in Sources */,
|
||||
51F9F3F723DF6DB200A314FD /* ArticleIconSchemeHandler.swift in Sources */,
|
||||
512AF9C2236ED52C0066F8BE /* ImageHeaderView.swift in Sources */,
|
||||
512392C124E33A3C00F11704 /* RedditSelectTypeTableViewController.swift in Sources */,
|
||||
515A5181243E90260089E588 /* ExtensionPointIdentifer.swift in Sources */,
|
||||
51A1699F235E10D700EB091F /* AboutViewController.swift in Sources */,
|
||||
51C45290226509C100C03939 /* PseudoFeed.swift in Sources */,
|
||||
@ -4960,6 +4968,7 @@
|
||||
51EF0F7E2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift in Sources */,
|
||||
51A1699B235E10D700EB091F /* AccountInspectorViewController.swift in Sources */,
|
||||
512D554423C804DE0023FFFA /* OpenInSafariActivity.swift in Sources */,
|
||||
512392C224E33A3C00F11704 /* RedditEnterDetailTableViewController.swift in Sources */,
|
||||
51C452762265091600C03939 /* MasterTimelineViewController.swift in Sources */,
|
||||
5108F6D823763094001ABC45 /* TickMarkSlider.swift in Sources */,
|
||||
51C452882265093600C03939 /* AddWebFeedViewController.swift in Sources */,
|
||||
@ -4980,6 +4989,7 @@
|
||||
51C4529B22650A1000C03939 /* FaviconDownloader.swift in Sources */,
|
||||
84DEE56622C32CA4005FC42C /* SmartFeedDelegate.swift in Sources */,
|
||||
512E09012268907400BDCFDD /* MasterFeedTableViewSectionHeader.swift in Sources */,
|
||||
512392BF24E33A3C00F11704 /* RedditSelectSortTableViewController.swift in Sources */,
|
||||
516AE9E02372269A007DEEAA /* IconImage.swift in Sources */,
|
||||
519ED456244828C3007F8E94 /* AddExtensionPointViewController.swift in Sources */,
|
||||
51C45268226508F600C03939 /* MasterFeedUnreadCountView.swift in Sources */,
|
||||
|
@ -11,7 +11,7 @@
|
||||
<!--Add Web Feed-->
|
||||
<scene sceneID="2Tc-JN-edX">
|
||||
<objects>
|
||||
<tableViewController id="7aE-6a-iP7" customClass="AddWebFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableViewController storyboardIdentifier="AddWebFeedViewController" id="7aE-6a-iP7" customClass="AddWebFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" dataMode="static" style="insetGrouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="D0S-TM-mtm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
|
@ -12,6 +12,12 @@ import RSCore
|
||||
import RSTree
|
||||
import RSParser
|
||||
|
||||
enum AddFeedType {
|
||||
case web
|
||||
case reddit
|
||||
case twitter
|
||||
}
|
||||
|
||||
class AddWebFeedViewController: UITableViewController {
|
||||
|
||||
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
|
||||
@ -25,6 +31,7 @@ class AddWebFeedViewController: UITableViewController {
|
||||
private var folderLabel = ""
|
||||
private var userCancelled = false
|
||||
|
||||
var addFeedType = AddFeedType.web
|
||||
var initialFeed: String?
|
||||
var initialFeedName: String?
|
||||
|
||||
@ -33,6 +40,17 @@ class AddWebFeedViewController: UITableViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
switch addFeedType {
|
||||
case .reddit:
|
||||
navigationItem.title = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed")
|
||||
navigationItem.leftBarButtonItem = nil
|
||||
case .twitter:
|
||||
navigationItem.title = NSLocalizedString("Add Twitter Feed", comment: "Add Twitter Feed")
|
||||
navigationItem.leftBarButtonItem = nil
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
activityIndicator.isHidden = true
|
||||
activityIndicator.color = .label
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17147" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="q78-0w-suH">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17147" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="fak-6k-FqE">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
@ -123,6 +123,13 @@
|
||||
<outlet property="delegate" destination="q78-0w-suH" id="j69-O6-ths"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Select Reddit Type" id="sDs-V8-FbQ">
|
||||
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="PvO-Kb-jDe">
|
||||
<connections>
|
||||
<action selector="cancel:" destination="q78-0w-suH" id="G70-O2-P1M"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="yI5-IG-7Sl" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
@ -215,10 +222,10 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="836" y="173"/>
|
||||
</scene>
|
||||
<!--Select Type-->
|
||||
<!--Select Sort Order-->
|
||||
<scene sceneID="fgY-Vy-10A">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="RedditSelectSortTableViewController" title="Select Type" id="IlC-3Q-oEI" customClass="RedditSelectSortTableViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableViewController storyboardIdentifier="RedditSelectSortTableViewController" title="Select Sort Order" id="IlC-3Q-oEI" customClass="RedditSelectSortTableViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="insetGrouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="fZZ-h8-KOR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@ -226,11 +233,11 @@
|
||||
<sections>
|
||||
<tableViewSection id="ExH-4T-drs">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="Two-PX-Viz" detailTextLabel="0ye-pS-sK4" style="IBUITableViewCellStyleSubtitle" id="55H-tz-eaT" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="Two-PX-Viz" detailTextLabel="0ye-pS-sK4" style="IBUITableViewCellStyleSubtitle" id="55H-tz-eaT" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="18" width="374" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="55H-tz-eaT" id="hMA-SY-f5j">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="59"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Best" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="Two-PX-Viz">
|
||||
@ -250,11 +257,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="zH0-LJ-jQI" detailTextLabel="l2u-CB-A9e" style="IBUITableViewCellStyleSubtitle" id="HA0-YT-b8c" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="zH0-LJ-jQI" detailTextLabel="l2u-CB-A9e" style="IBUITableViewCellStyleSubtitle" id="HA0-YT-b8c" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="77" width="374" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="HA0-YT-b8c" id="OcV-IL-7kf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="59"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Hot" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="zH0-LJ-jQI">
|
||||
@ -274,11 +281,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="NkD-IS-qVP" detailTextLabel="Qra-AN-CyW" style="IBUITableViewCellStyleSubtitle" id="UhD-9i-fap" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="NkD-IS-qVP" detailTextLabel="Qra-AN-CyW" style="IBUITableViewCellStyleSubtitle" id="UhD-9i-fap" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="136" width="374" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="UhD-9i-fap" id="8bk-pA-IdP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="59"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="New" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="NkD-IS-qVP">
|
||||
@ -298,11 +305,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="cQv-hE-hhj" detailTextLabel="6XP-xO-a2Z" style="IBUITableViewCellStyleSubtitle" id="hT6-IN-s9D" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="cQv-hE-hhj" detailTextLabel="6XP-xO-a2Z" style="IBUITableViewCellStyleSubtitle" id="hT6-IN-s9D" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="195" width="374" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="hT6-IN-s9D" id="KR1-8i-PxS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="59"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Top" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="cQv-hE-hhj">
|
||||
@ -322,11 +329,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="xqK-wP-umX" detailTextLabel="6AI-Dt-0ix" style="IBUITableViewCellStyleSubtitle" id="Iz4-re-FWT" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="xqK-wP-umX" detailTextLabel="6AI-Dt-0ix" style="IBUITableViewCellStyleSubtitle" id="Iz4-re-FWT" customClass="VibrantTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="254" width="374" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Iz4-re-FWT" id="1k3-3E-F1T">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="59"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="343" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Rising" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="xqK-wP-umX">
|
||||
@ -360,6 +367,22 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1529" y="173"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="J2T-Ji-NG0">
|
||||
<objects>
|
||||
<navigationController id="fak-6k-FqE" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="eDp-09-xHT">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="q78-0w-suH" kind="relationship" relationship="rootViewController" id="QJq-wm-92D"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="3Vk-Oj-BST" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1257" y="173"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
|
@ -11,13 +11,12 @@ import Foundation
|
||||
import UIKit
|
||||
import Account
|
||||
|
||||
class RedditEnterDetailTableViewController: UITableViewController, SelectURLBuilder {
|
||||
class RedditEnterDetailTableViewController: UITableViewController {
|
||||
|
||||
@IBOutlet weak var detailTextField: UITextField!
|
||||
|
||||
var nextBarButtonItem = UIBarButtonItem()
|
||||
var redditFeedType: RedditFeedType?
|
||||
weak var delegate: SelectURLBuilderDelegate?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -38,7 +37,6 @@ class RedditEnterDetailTableViewController: UITableViewController, SelectURLBuil
|
||||
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
||||
selectSort.redditFeedType = redditFeedType
|
||||
selectSort.subreddit = detailTextField.text?.collapsingWhitespace
|
||||
selectSort.delegate = delegate
|
||||
navigationController?.pushViewController(selectSort, animated: true)
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,11 @@ import Foundation
|
||||
import UIKit
|
||||
import Account
|
||||
|
||||
class RedditSelectAccountTableViewController: UITableViewController, SelectURLBuilder {
|
||||
class RedditSelectAccountTableViewController: UITableViewController {
|
||||
|
||||
private var redditFeedProviders = [RedditFeedProvider]()
|
||||
|
||||
var redditFeedType: RedditFeedType?
|
||||
weak var delegate: SelectURLBuilderDelegate?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -37,7 +36,6 @@ class RedditSelectAccountTableViewController: UITableViewController, SelectURLBu
|
||||
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
||||
selectSort.redditFeedType = redditFeedType
|
||||
selectSort.username = redditFeedProviders[indexPath.row].username
|
||||
selectSort.delegate = delegate
|
||||
navigationController?.pushViewController(selectSort, animated: true)
|
||||
}
|
||||
|
||||
|
@ -9,16 +9,11 @@
|
||||
import UIKit
|
||||
import Account
|
||||
|
||||
class RedditSelectSortTableViewController: UITableViewController, SelectURLBuilder {
|
||||
class RedditSelectSortTableViewController: UITableViewController {
|
||||
|
||||
weak var delegate: SelectURLBuilderDelegate?
|
||||
var redditFeedType: RedditFeedType?
|
||||
var username: String?
|
||||
var subreddit: String?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
@ -39,11 +34,13 @@ class RedditSelectSortTableViewController: UITableViewController, SelectURLBuild
|
||||
}
|
||||
|
||||
guard let redditFeedType = redditFeedType else { return }
|
||||
let url = RedditFeedProvider.buildURL(redditFeedType, username: username, subreddit: subreddit, sort: sort)?.absoluteString
|
||||
|
||||
if let url = RedditFeedProvider.buildURL(redditFeedType, username: username, subreddit: subreddit, sort: sort) {
|
||||
delegate?.selectURLBuilderDidBuildURL(url)
|
||||
}
|
||||
dismiss(animated: true)
|
||||
let addViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddWebFeedViewController") as! AddWebFeedViewController
|
||||
addViewController.addFeedType = .reddit
|
||||
addViewController.initialFeed = url
|
||||
navigationController?.pushViewController(addViewController, animated: true)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,14 +9,12 @@
|
||||
import UIKit
|
||||
import Account
|
||||
|
||||
class RedditSelectTypeTableViewController: UITableViewController, SelectURLBuilder {
|
||||
class RedditSelectTypeTableViewController: UITableViewController {
|
||||
|
||||
weak var delegate: SelectURLBuilderDelegate?
|
||||
@IBAction func cancel(_ sender: Any) {
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
switch indexPath.row {
|
||||
case 0:
|
||||
@ -25,28 +23,23 @@ class RedditSelectTypeTableViewController: UITableViewController, SelectURLBuild
|
||||
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
||||
selectSort.redditFeedType = .home
|
||||
selectSort.username = redditFeedProviders.first!.username
|
||||
selectSort.delegate = delegate
|
||||
navigationController?.pushViewController(selectSort, animated: true)
|
||||
} else {
|
||||
let selectAccount = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectAccountTableViewController.self)
|
||||
selectAccount.redditFeedType = .home
|
||||
selectAccount.delegate = delegate
|
||||
navigationController?.pushViewController(selectAccount, animated: true)
|
||||
}
|
||||
case 1:
|
||||
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
||||
selectSort.redditFeedType = .popular
|
||||
selectSort.delegate = delegate
|
||||
navigationController?.pushViewController(selectSort, animated: true)
|
||||
case 2:
|
||||
let selectSort = UIStoryboard.redditAdd.instantiateController(ofType: RedditSelectSortTableViewController.self)
|
||||
selectSort.redditFeedType = .all
|
||||
selectSort.delegate = delegate
|
||||
navigationController?.pushViewController(selectSort, animated: true)
|
||||
case 3:
|
||||
let enterDetail = UIStoryboard.redditAdd.instantiateController(ofType: RedditEnterDetailTableViewController.self)
|
||||
enterDetail.redditFeedType = .subreddit
|
||||
enterDetail.delegate = delegate
|
||||
navigationController?.pushViewController(enterDetail, animated: true)
|
||||
default:
|
||||
fatalError()
|
||||
|
@ -402,7 +402,12 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
|
||||
let addWebFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addWebFeedAction = UIAlertAction(title: addWebFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddFeed()
|
||||
self.coordinator.showAddWebFeed()
|
||||
}
|
||||
|
||||
let addRedditFeedActionTitle = NSLocalizedString("Add Reddit Feed", comment: "Add Reddit Feed")
|
||||
let addRedditFeedAction = UIAlertAction(title: addRedditFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddRedditFeed()
|
||||
}
|
||||
|
||||
let addWebFolderdActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
@ -411,6 +416,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
alertController.addAction(addWebFeedAction)
|
||||
alertController.addAction(addRedditFeedAction)
|
||||
alertController.addAction(addWebFolderAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
|
@ -95,7 +95,7 @@ class RootSplitViewController: UISplitViewController {
|
||||
}
|
||||
|
||||
@objc func addNewFeed(_ sender: Any?) {
|
||||
coordinator.showAddFeed()
|
||||
coordinator.showAddWebFeed()
|
||||
}
|
||||
|
||||
@objc func addNewFolder(_ sender: Any?) {
|
||||
|
@ -384,7 +384,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
case .readArticle:
|
||||
self.handleReadArticle(activity.userInfo)
|
||||
case .addFeedIntent:
|
||||
self.showAddFeed()
|
||||
self.showAddWebFeed()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
rootSplitViewController.present(feedInspectorNavController, animated: true)
|
||||
}
|
||||
|
||||
func showAddFeed(initialFeed: String? = nil, initialFeedName: String? = nil) {
|
||||
func showAddWebFeed(initialFeed: String? = nil, initialFeedName: String? = nil) {
|
||||
|
||||
// Since Add Feed can be opened from anywhere with a keyboard shortcut, we have to deselect any currently selected feeds
|
||||
selectFeed(nil)
|
||||
@ -1183,6 +1183,13 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
masterFeedViewController.present(addNavViewController, animated: true)
|
||||
}
|
||||
|
||||
func showAddRedditFeed() {
|
||||
let addNavViewController = UIStoryboard.redditAdd.instantiateInitialViewController() as! UINavigationController
|
||||
addNavViewController.modalPresentationStyle = .formSheet
|
||||
addNavViewController.preferredContentSize = AddWebFeedViewController.preferredContentSizeForFormSheetDisplay
|
||||
masterFeedViewController.present(addNavViewController, animated: true)
|
||||
}
|
||||
|
||||
func showAddFolder() {
|
||||
let addNavViewController = UIStoryboard.add.instantiateViewController(withIdentifier: "AddFolderViewControllerNav") as! UINavigationController
|
||||
addNavViewController.modalPresentationStyle = .formSheet
|
||||
|
@ -100,7 +100,7 @@ private extension SceneDelegate {
|
||||
case "com.ranchero.NetNewsWire.ShowSearch":
|
||||
coordinator.showSearch()
|
||||
case "com.ranchero.NetNewsWire.ShowAdd":
|
||||
coordinator.showAddFeed()
|
||||
coordinator.showAddWebFeed()
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user