Removed old UIKit Settings code
This commit is contained in:
parent
622dba7c14
commit
5ee4055eb4
|
@ -790,9 +790,6 @@
|
||||||
5144EA50227B8E4500D19003 /* AccountsFeedbin.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountsFeedbin.xib; sourceTree = "<group>"; };
|
5144EA50227B8E4500D19003 /* AccountsFeedbin.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountsFeedbin.xib; sourceTree = "<group>"; };
|
||||||
514B7C8223205EFB00BAC947 /* RootSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootSplitViewController.swift; sourceTree = "<group>"; };
|
514B7C8223205EFB00BAC947 /* RootSplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootSplitViewController.swift; sourceTree = "<group>"; };
|
||||||
514B7D1E23219F3C00BAC947 /* AddControllerType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddControllerType.swift; sourceTree = "<group>"; };
|
514B7D1E23219F3C00BAC947 /* AddControllerType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddControllerType.swift; sourceTree = "<group>"; };
|
||||||
51543684228F6753005E1CDF /* DetailAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailAccountViewController.swift; sourceTree = "<group>"; };
|
|
||||||
515436872291D75D005E1CDF /* AddLocalAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddLocalAccountViewController.swift; sourceTree = "<group>"; };
|
|
||||||
515436892291FED9005E1CDF /* FeedbinAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbinAccountViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51554BFC228B6EB50055115A /* SyncDatabase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SyncDatabase.xcodeproj; path = Frameworks/SyncDatabase/SyncDatabase.xcodeproj; sourceTree = SOURCE_ROOT; };
|
51554BFC228B6EB50055115A /* SyncDatabase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SyncDatabase.xcodeproj; path = Frameworks/SyncDatabase/SyncDatabase.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||||
515ADE3F22E11FAE006B2460 /* SystemMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemMessageViewController.swift; sourceTree = "<group>"; };
|
515ADE3F22E11FAE006B2460 /* SystemMessageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemMessageViewController.swift; sourceTree = "<group>"; };
|
||||||
515D4FCB2325815A00EE1167 /* SafariExt.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = SafariExt.js; sourceTree = "<group>"; };
|
515D4FCB2325815A00EE1167 /* SafariExt.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = SafariExt.js; sourceTree = "<group>"; };
|
||||||
|
@ -805,8 +802,6 @@
|
||||||
5183CCDE226F1FCC0010922C /* UINavigationController+Progress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Progress.swift"; sourceTree = "<group>"; };
|
5183CCDE226F1FCC0010922C /* UINavigationController+Progress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Progress.swift"; sourceTree = "<group>"; };
|
||||||
5183CCE4226F4DFA0010922C /* RefreshInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshInterval.swift; sourceTree = "<group>"; };
|
5183CCE4226F4DFA0010922C /* RefreshInterval.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshInterval.swift; sourceTree = "<group>"; };
|
||||||
5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountRefreshTimer.swift; sourceTree = "<group>"; };
|
5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountRefreshTimer.swift; sourceTree = "<group>"; };
|
||||||
5183CCEC22711DCE0010922C /* Settings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = "<group>"; };
|
|
||||||
5183CCEE227125970010922C /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51934CC1230F5963006127BE /* ThemedNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedNavigationController.swift; sourceTree = "<group>"; };
|
51934CC1230F5963006127BE /* ThemedNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedNavigationController.swift; sourceTree = "<group>"; };
|
||||||
51934CCD2310792F006127BE /* ActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityManager.swift; sourceTree = "<group>"; };
|
51934CCD2310792F006127BE /* ActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityManager.swift; sourceTree = "<group>"; };
|
||||||
51934CCF23108953006127BE /* ActivityID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityID.swift; sourceTree = "<group>"; };
|
51934CCF23108953006127BE /* ActivityID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityID.swift; sourceTree = "<group>"; };
|
||||||
|
@ -844,13 +839,10 @@
|
||||||
51E3EB32229AB02C00645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
|
51E3EB32229AB02C00645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
|
||||||
51E3EB3C229AB08300645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
|
51E3EB3C229AB08300645299 /* ErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorHandler.swift; sourceTree = "<group>"; };
|
||||||
51E595A4228CC36500FCC42B /* ArticleStatusSyncTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleStatusSyncTimer.swift; sourceTree = "<group>"; };
|
51E595A4228CC36500FCC42B /* ArticleStatusSyncTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleStatusSyncTimer.swift; sourceTree = "<group>"; };
|
||||||
51E595AA228DF94C00FCC42B /* SettingsTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SettingsTableViewCell.xib; sourceTree = "<group>"; };
|
|
||||||
51E595AC228E1C2100FCC42B /* AddAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51EAED95231363EF00A9EEE3 /* NonIntrinsicButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicButton.swift; sourceTree = "<group>"; };
|
51EAED95231363EF00A9EEE3 /* NonIntrinsicButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NonIntrinsicButton.swift; sourceTree = "<group>"; };
|
||||||
51EC114B2149FE3300B296E3 /* FolderTreeMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FolderTreeMenu.swift; path = AddFeed/FolderTreeMenu.swift; sourceTree = "<group>"; };
|
51EC114B2149FE3300B296E3 /* FolderTreeMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FolderTreeMenu.swift; path = AddFeed/FolderTreeMenu.swift; sourceTree = "<group>"; };
|
||||||
51EF0F76227716200050506E /* FaviconGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconGenerator.swift; sourceTree = "<group>"; };
|
51EF0F76227716200050506E /* FaviconGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaviconGenerator.swift; sourceTree = "<group>"; };
|
||||||
51EF0F78227716380050506E /* ColorHash.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorHash.swift; sourceTree = "<group>"; };
|
51EF0F78227716380050506E /* ColorHash.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorHash.swift; sourceTree = "<group>"; };
|
||||||
51EF0F7B2277919E0050506E /* TimelineNumberOfLinesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineNumberOfLinesViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51EF0F7D2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineAccessibilityCellLayout.swift; sourceTree = "<group>"; };
|
51EF0F7D2277A57D0050506E /* MasterTimelineAccessibilityCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineAccessibilityCellLayout.swift; sourceTree = "<group>"; };
|
||||||
51EF0F7F2277A8330050506E /* MasterTimelineCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineCellLayout.swift; sourceTree = "<group>"; };
|
51EF0F7F2277A8330050506E /* MasterTimelineCellLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterTimelineCellLayout.swift; sourceTree = "<group>"; };
|
||||||
51EF0F8D2279C9260050506E /* AccountsAdd.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountsAdd.xib; sourceTree = "<group>"; };
|
51EF0F8D2279C9260050506E /* AccountsAdd.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountsAdd.xib; sourceTree = "<group>"; };
|
||||||
|
@ -858,8 +850,6 @@
|
||||||
51EF0F912279CA620050506E /* AccountsAddTableCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsAddTableCellView.swift; sourceTree = "<group>"; };
|
51EF0F912279CA620050506E /* AccountsAddTableCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsAddTableCellView.swift; sourceTree = "<group>"; };
|
||||||
51F35D0822AFD4760003CE1B /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
51F35D0822AFD4760003CE1B /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||||
51F772EC22B2789B0087D9D1 /* SettingsDetailAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsDetailAccountView.swift; sourceTree = "<group>"; };
|
51F772EC22B2789B0087D9D1 /* SettingsDetailAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsDetailAccountView.swift; sourceTree = "<group>"; };
|
||||||
51F85BDB2272162F00C787DC /* RefreshIntervalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshIntervalViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51F85BE6227245FC00C787DC /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
|
|
||||||
51F85BEA22724CB600C787DC /* About.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = About.rtf; sourceTree = "<group>"; };
|
51F85BEA22724CB600C787DC /* About.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = About.rtf; sourceTree = "<group>"; };
|
||||||
51F85BEC227251DF00C787DC /* Acknowledgments.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Acknowledgments.rtf; sourceTree = "<group>"; };
|
51F85BEC227251DF00C787DC /* Acknowledgments.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Acknowledgments.rtf; sourceTree = "<group>"; };
|
||||||
51F85BEE2272520B00C787DC /* Thanks.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Thanks.rtf; sourceTree = "<group>"; };
|
51F85BEE2272520B00C787DC /* Thanks.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Thanks.rtf; sourceTree = "<group>"; };
|
||||||
|
@ -1245,7 +1235,6 @@
|
||||||
5194B5F122B69FCC00144881 /* SettingsSubscriptionsExportDocumentPickerView.swift */,
|
5194B5F122B69FCC00144881 /* SettingsSubscriptionsExportDocumentPickerView.swift */,
|
||||||
5194B5ED22B6965300144881 /* SettingsSubscriptionsImportDocumentPickerView.swift */,
|
5194B5ED22B6965300144881 /* SettingsSubscriptionsImportDocumentPickerView.swift */,
|
||||||
515E4F06232506240057B0E7 /* Account */,
|
515E4F06232506240057B0E7 /* Account */,
|
||||||
51F35CFD22AFD0350003CE1B /* UIKit */,
|
|
||||||
);
|
);
|
||||||
path = Settings;
|
path = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1395,23 +1384,6 @@
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
51F35CFD22AFD0350003CE1B /* UIKit */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
5183CCEC22711DCE0010922C /* Settings.storyboard */,
|
|
||||||
51E595AA228DF94C00FCC42B /* SettingsTableViewCell.xib */,
|
|
||||||
5183CCEE227125970010922C /* SettingsViewController.swift */,
|
|
||||||
51E595AC228E1C2100FCC42B /* AddAccountViewController.swift */,
|
|
||||||
515436892291FED9005E1CDF /* FeedbinAccountViewController.swift */,
|
|
||||||
515436872291D75D005E1CDF /* AddLocalAccountViewController.swift */,
|
|
||||||
51F85BE6227245FC00C787DC /* AboutViewController.swift */,
|
|
||||||
51543684228F6753005E1CDF /* DetailAccountViewController.swift */,
|
|
||||||
51F85BDB2272162F00C787DC /* RefreshIntervalViewController.swift */,
|
|
||||||
51EF0F7B2277919E0050506E /* TimelineNumberOfLinesViewController.swift */,
|
|
||||||
);
|
|
||||||
path = UIKit;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
6581C73620CED60100F4AD34 /* SafariExtension */ = {
|
6581C73620CED60100F4AD34 /* SafariExtension */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
//
|
|
||||||
// AboutViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 4/25/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
class AboutViewController: UITableViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var aboutTextView: UITextView!
|
|
||||||
@IBOutlet weak var creditsTextView: UITextView!
|
|
||||||
@IBOutlet weak var acknowledgmentsTextView: UITextView!
|
|
||||||
@IBOutlet weak var thanksTextView: UITextView!
|
|
||||||
@IBOutlet weak var dedicationTextView: UITextView!
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
configureCell(file: "About", textView: aboutTextView)
|
|
||||||
configureCell(file: "Credits", textView: creditsTextView)
|
|
||||||
configureCell(file: "Acknowledgments", textView: acknowledgmentsTextView)
|
|
||||||
configureCell(file: "Thanks", textView: thanksTextView)
|
|
||||||
configureCell(file: "Dedication", textView: dedicationTextView)
|
|
||||||
|
|
||||||
let buildLabel = NonIntrinsicLabel(frame: CGRect(x: 20.0, y: 0.0, width: 0.0, height: 0.0))
|
|
||||||
buildLabel.font = UIFont.systemFont(ofSize: 11.0)
|
|
||||||
buildLabel.textColor = UIColor.gray
|
|
||||||
buildLabel.text = NSLocalizedString("Copyright © 2002-2019 Ranchero Software", comment: "Copyright")
|
|
||||||
buildLabel.numberOfLines = 0
|
|
||||||
buildLabel.sizeToFit()
|
|
||||||
buildLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
tableView.tableFooterView = buildLabel
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
||||||
return UITableView.automaticDimension
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private extension AboutViewController {
|
|
||||||
|
|
||||||
func configureCell(file: String, textView: UITextView) {
|
|
||||||
let url = Bundle.main.url(forResource: file, withExtension: "rtf")!
|
|
||||||
let string = try! NSAttributedString(url: url, options: [NSAttributedString.DocumentReadingOptionKey.documentType: NSAttributedString.DocumentType.rtf], documentAttributes: nil)
|
|
||||||
textView.attributedText = string
|
|
||||||
textView.adjustsFontForContentSizeCategory = true
|
|
||||||
textView.font = .preferredFont(forTextStyle: .body)
|
|
||||||
textView.textColor = UIColor.label
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
//
|
|
||||||
// AddAccountViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 5/16/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Account
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
protocol AddAccountDismissDelegate: UIViewController {
|
|
||||||
func dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {
|
|
||||||
|
|
||||||
@IBOutlet private weak var localAccountNameLabel: UILabel!
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
localAccountNameLabel.text = Account.defaultLocalAccountName
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
switch indexPath.row {
|
|
||||||
case 0:
|
|
||||||
let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "AddLocalAccountNavigationViewController") as! UINavigationController
|
|
||||||
navController.modalPresentationStyle = .currentContext
|
|
||||||
let addViewController = navController.topViewController as! AddLocalAccountViewController
|
|
||||||
addViewController.delegate = self
|
|
||||||
present(navController, animated: true)
|
|
||||||
case 1:
|
|
||||||
let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
|
|
||||||
navController.modalPresentationStyle = .currentContext
|
|
||||||
let addViewController = navController.topViewController as! FeedbinAccountViewController
|
|
||||||
addViewController.delegate = self
|
|
||||||
present(navController, animated: true)
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func dismiss() {
|
|
||||||
navigationController?.popViewController(animated: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
//
|
|
||||||
// AddLocalAccountViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 5/19/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Account
|
|
||||||
|
|
||||||
class AddLocalAccountViewController: UIViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var cancelBarButtonItem: UIBarButtonItem!
|
|
||||||
@IBOutlet private weak var localAccountNameLabel: UILabel!
|
|
||||||
@IBOutlet weak var nameTextField: UITextField!
|
|
||||||
|
|
||||||
weak var delegate: AddAccountDismissDelegate?
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
localAccountNameLabel.text = Account.defaultLocalAccountName
|
|
||||||
nameTextField.delegate = self
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func cancel(_ sender: Any) {
|
|
||||||
dismiss(animated: true, completion: nil)
|
|
||||||
delegate?.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func addAccountTapped(_ sender: Any) {
|
|
||||||
let account = AccountManager.shared.createAccount(type: .onMyMac)
|
|
||||||
account.name = nameTextField.text
|
|
||||||
dismiss(animated: true, completion: nil)
|
|
||||||
delegate?.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension AddLocalAccountViewController: UITextFieldDelegate {
|
|
||||||
|
|
||||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
|
||||||
textField.resignFirstResponder()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
//
|
|
||||||
// DetailAccountViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 5/17/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Account
|
|
||||||
|
|
||||||
class DetailAccountViewController: UITableViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var nameTextField: UITextField!
|
|
||||||
@IBOutlet weak var activeSwitch: UISwitch!
|
|
||||||
|
|
||||||
weak var account: Account?
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
guard let account = account else { return }
|
|
||||||
|
|
||||||
nameTextField.placeholder = account.defaultName
|
|
||||||
nameTextField.text = account.name
|
|
||||||
nameTextField.delegate = self
|
|
||||||
activeSwitch.isOn = account.isActive
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewWillDisappear(_ animated: Bool) {
|
|
||||||
account?.name = nameTextField.text
|
|
||||||
account?.isActive = activeSwitch.isOn
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension DetailAccountViewController {
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
||||||
|
|
||||||
guard let account = account else { return 0 }
|
|
||||||
|
|
||||||
if account == AccountManager.shared.defaultAccount {
|
|
||||||
return 1
|
|
||||||
} else if account.type == .onMyMac {
|
|
||||||
return 2
|
|
||||||
} else {
|
|
||||||
return super.numberOfSections(in: tableView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
|
|
||||||
let cell: UITableViewCell
|
|
||||||
if indexPath.section == 1, let account = account, account.type == .onMyMac {
|
|
||||||
cell = super.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 2))
|
|
||||||
} else {
|
|
||||||
cell = super.tableView(tableView, cellForRowAt: indexPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
let bgView = UIView()
|
|
||||||
bgView.backgroundColor = AppAssets.netNewsWireBlueColor
|
|
||||||
cell.selectedBackgroundView = bgView
|
|
||||||
return cell
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
|
|
||||||
if indexPath.section > 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
if let account = account, account.type == .onMyMac {
|
|
||||||
if indexPath.section == 1 {
|
|
||||||
deleteAccount()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch indexPath.section {
|
|
||||||
case 1:
|
|
||||||
credentials()
|
|
||||||
case 2:
|
|
||||||
deleteAccount()
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private extension DetailAccountViewController {
|
|
||||||
|
|
||||||
func credentials() {
|
|
||||||
guard let account = account else { return }
|
|
||||||
switch account.type {
|
|
||||||
case .feedbin:
|
|
||||||
let navController = UIStoryboard.settings.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
|
|
||||||
let addViewController = navController.topViewController as! FeedbinAccountViewController
|
|
||||||
addViewController.account = account
|
|
||||||
present(navController, animated: true)
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func deleteAccount() {
|
|
||||||
let title = NSLocalizedString("Delete Account", comment: "Delete Account")
|
|
||||||
let message = NSLocalizedString("Are you sure you want to delete this account? This can not be undone.", comment: "Delete Account")
|
|
||||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
|
||||||
|
|
||||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
|
||||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
|
||||||
alertController.addAction(cancelAction)
|
|
||||||
|
|
||||||
let markTitle = NSLocalizedString("Delete", comment: "Delete")
|
|
||||||
let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in
|
|
||||||
guard let account = self?.account else { return }
|
|
||||||
AccountManager.shared.deleteAccount(account)
|
|
||||||
ActivityManager.cleanUp(account)
|
|
||||||
self?.navigationController?.popViewController(animated: true)
|
|
||||||
}
|
|
||||||
alertController.addAction(markAction)
|
|
||||||
|
|
||||||
present(alertController, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension DetailAccountViewController: UITextFieldDelegate {
|
|
||||||
|
|
||||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
|
||||||
textField.resignFirstResponder()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,139 +0,0 @@
|
||||||
//
|
|
||||||
// AddFeedbinAccountViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 5/19/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Account
|
|
||||||
import RSWeb
|
|
||||||
|
|
||||||
class FeedbinAccountViewController: UIViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
|
|
||||||
@IBOutlet weak var cancelBarButtonItem: UIBarButtonItem!
|
|
||||||
@IBOutlet weak var emailTextField: UITextField!
|
|
||||||
@IBOutlet weak var passwordTextField: UITextField!
|
|
||||||
@IBOutlet weak var actionButton: UIButton!
|
|
||||||
|
|
||||||
@IBOutlet weak var errorMessageLabel: UILabel!
|
|
||||||
|
|
||||||
weak var account: Account?
|
|
||||||
weak var delegate: AddAccountDismissDelegate?
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
activityIndicator.isHidden = true
|
|
||||||
emailTextField.delegate = self
|
|
||||||
passwordTextField.delegate = self
|
|
||||||
|
|
||||||
if let account = account, let credentials = try? account.retrieveCredentials() {
|
|
||||||
actionButton.setTitle(NSLocalizedString("Update Credentials", comment: "Update Credentials"), for: .normal)
|
|
||||||
if case .basic(let username, let password) = credentials {
|
|
||||||
emailTextField.text = username
|
|
||||||
passwordTextField.text = password
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
actionButton.setTitle(NSLocalizedString("Add Account", comment: "Update Credentials"), for: .normal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func cancel(_ sender: Any) {
|
|
||||||
dismiss(animated: true, completion: nil)
|
|
||||||
delegate?.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func action(_ sender: Any) {
|
|
||||||
self.errorMessageLabel.text = nil
|
|
||||||
|
|
||||||
guard emailTextField.text != nil && passwordTextField.text != nil else {
|
|
||||||
self.errorMessageLabel.text = NSLocalizedString("Username & password required.", comment: "Credentials Error")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
startAnimatingActivityIndicator()
|
|
||||||
disableNavigation()
|
|
||||||
|
|
||||||
// When you fill in the email address via auto-complete it adds extra whitespace
|
|
||||||
let emailAddress = emailTextField.text?.trimmingCharacters(in: .whitespaces)
|
|
||||||
let credentials = Credentials.basic(username: emailAddress ?? "", password: passwordTextField.text ?? "")
|
|
||||||
Account.validateCredentials(type: .feedbin, credentials: credentials) { result in
|
|
||||||
|
|
||||||
self.stopAnimtatingActivityIndicator()
|
|
||||||
self.enableNavigation()
|
|
||||||
|
|
||||||
switch result {
|
|
||||||
case .success(let authenticated):
|
|
||||||
if (authenticated != nil) {
|
|
||||||
var newAccount = false
|
|
||||||
if self.account == nil {
|
|
||||||
self.account = AccountManager.shared.createAccount(type: .feedbin)
|
|
||||||
newAccount = true
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
|
|
||||||
do {
|
|
||||||
try self.account?.removeCredentials()
|
|
||||||
} catch {}
|
|
||||||
try self.account?.storeCredentials(credentials)
|
|
||||||
|
|
||||||
if newAccount {
|
|
||||||
self.account?.refreshAll() { result in
|
|
||||||
switch result {
|
|
||||||
case .success:
|
|
||||||
break
|
|
||||||
case .failure(let error):
|
|
||||||
self.presentError(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.dismiss(animated: true, completion: nil)
|
|
||||||
self.delegate?.dismiss()
|
|
||||||
} catch {
|
|
||||||
self.errorMessageLabel.text = NSLocalizedString("Keychain error while storing credentials.", comment: "Credentials Error")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.errorMessageLabel.text = NSLocalizedString("Invalid email/password combination.", comment: "Credentials Error")
|
|
||||||
}
|
|
||||||
case .failure:
|
|
||||||
self.errorMessageLabel.text = NSLocalizedString("Network error. Try again later.", comment: "Credentials Error")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func enableNavigation() {
|
|
||||||
self.cancelBarButtonItem.isEnabled = true
|
|
||||||
self.actionButton.isEnabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
private func disableNavigation() {
|
|
||||||
cancelBarButtonItem.isEnabled = false
|
|
||||||
actionButton.isEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private func startAnimatingActivityIndicator() {
|
|
||||||
activityIndicator.isHidden = false
|
|
||||||
activityIndicator.startAnimating()
|
|
||||||
}
|
|
||||||
|
|
||||||
private func stopAnimtatingActivityIndicator() {
|
|
||||||
self.activityIndicator.isHidden = true
|
|
||||||
self.activityIndicator.stopAnimating()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension FeedbinAccountViewController: UITextFieldDelegate {
|
|
||||||
|
|
||||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
|
||||||
textField.resignFirstResponder()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,115 +0,0 @@
|
||||||
//
|
|
||||||
// RefreshIntervalViewController.swift
|
|
||||||
// NetNewsWire
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 4/25/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
class RefreshIntervalViewController: UITableViewController {
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
||||||
return 7
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
|
||||||
|
|
||||||
cell.textLabel?.adjustsFontForContentSizeCategory = true
|
|
||||||
|
|
||||||
let bgView = UIView()
|
|
||||||
bgView.backgroundColor = AppAssets.netNewsWireBlueColor
|
|
||||||
cell.selectedBackgroundView = bgView
|
|
||||||
|
|
||||||
let userRefreshInterval = AppDefaults.refreshInterval
|
|
||||||
|
|
||||||
switch indexPath.row {
|
|
||||||
case 0:
|
|
||||||
cell.textLabel?.text = RefreshInterval.manually.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.manually {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
cell.textLabel?.text = RefreshInterval.every10Minutes.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.every10Minutes {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
cell.textLabel?.text = RefreshInterval.every30Minutes.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.every30Minutes {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
cell.textLabel?.text = RefreshInterval.everyHour.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.everyHour {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
cell.textLabel?.text = RefreshInterval.every2Hours.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.every2Hours {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
cell.textLabel?.text = RefreshInterval.every4Hours.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.every4Hours {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
cell.textLabel?.text = RefreshInterval.every8Hours.description()
|
|
||||||
if userRefreshInterval == RefreshInterval.every8Hours {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cell
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
|
|
||||||
let refreshInterval: RefreshInterval
|
|
||||||
|
|
||||||
switch indexPath.row {
|
|
||||||
case 0:
|
|
||||||
refreshInterval = RefreshInterval.manually
|
|
||||||
case 1:
|
|
||||||
refreshInterval = RefreshInterval.every10Minutes
|
|
||||||
case 2:
|
|
||||||
refreshInterval = RefreshInterval.every30Minutes
|
|
||||||
case 3:
|
|
||||||
refreshInterval = RefreshInterval.everyHour
|
|
||||||
case 4:
|
|
||||||
refreshInterval = RefreshInterval.every2Hours
|
|
||||||
case 5:
|
|
||||||
refreshInterval = RefreshInterval.every4Hours
|
|
||||||
default:
|
|
||||||
refreshInterval = RefreshInterval.every8Hours
|
|
||||||
}
|
|
||||||
|
|
||||||
AppDefaults.refreshInterval = refreshInterval
|
|
||||||
self.navigationController?.popViewController(animated: true)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
|
||||||
<device id="retina6_1" orientation="portrait">
|
|
||||||
<adaptation id="fullscreen"/>
|
|
||||||
</device>
|
|
||||||
<dependencies>
|
|
||||||
<deployment identifier="iOS"/>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
||||||
</dependencies>
|
|
||||||
<objects>
|
|
||||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="JCb-QB-CrO">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="JCb-QB-CrO" id="FzD-t2-JGy">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="376" height="43.5"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
</tableViewCellContentView>
|
|
||||||
<point key="canvasLocation" x="7" y="-9"/>
|
|
||||||
</tableViewCell>
|
|
||||||
</objects>
|
|
||||||
</document>
|
|
|
@ -1,271 +0,0 @@
|
||||||
//
|
|
||||||
// SettingsViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 4/24/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Account
|
|
||||||
|
|
||||||
class SettingsViewController: UITableViewController {
|
|
||||||
|
|
||||||
@IBOutlet weak var refreshIntervalLabel: UILabel!
|
|
||||||
@IBOutlet weak var timelineSortOrderSwitch: UISwitch!
|
|
||||||
@IBOutlet weak var timelineNumberOfLinesLabel: UILabel!
|
|
||||||
|
|
||||||
weak var presentingParentController: UIViewController?
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
// This hack mostly works around a bug in static tables with dynamic type. See: https://spin.atomicobject.com/2018/10/15/dynamic-type-static-uitableview/
|
|
||||||
NotificationCenter.default.removeObserver(tableView!, name: UIContentSizeCategory.didChangeNotification, object: nil)
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
|
|
||||||
|
|
||||||
tableView.register(UINib(nibName: "SettingsTableViewCell", bundle: nil), forCellReuseIdentifier: "SettingsTableViewCell")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
|
||||||
super.viewWillAppear(animated)
|
|
||||||
|
|
||||||
if AppDefaults.timelineSortDirection == .orderedAscending {
|
|
||||||
timelineSortOrderSwitch.isOn = true
|
|
||||||
} else {
|
|
||||||
timelineSortOrderSwitch.isOn = false
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshIntervalLabel.text = AppDefaults.refreshInterval.description()
|
|
||||||
|
|
||||||
let numberOfLinesText = NSLocalizedString(" lines", comment: "Lines")
|
|
||||||
timelineNumberOfLinesLabel.text = "\(AppDefaults.timelineNumberOfLines)" + numberOfLinesText
|
|
||||||
|
|
||||||
let buildLabel = NonIntrinsicLabel(frame: CGRect(x: 20.0, y: 0.0, width: 0.0, height: 0.0))
|
|
||||||
buildLabel.font = UIFont.systemFont(ofSize: 11.0)
|
|
||||||
buildLabel.textColor = UIColor.gray
|
|
||||||
buildLabel.text = "\(Bundle.main.appName) v \(Bundle.main.versionNumber) (Build \(Bundle.main.buildNumber))"
|
|
||||||
buildLabel.sizeToFit()
|
|
||||||
buildLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
||||||
tableView.tableFooterView = buildLabel
|
|
||||||
|
|
||||||
tableView.reloadData()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: UITableView
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
||||||
switch section {
|
|
||||||
case 0:
|
|
||||||
return AccountManager.shared.accounts.count + 1
|
|
||||||
case 1:
|
|
||||||
let defaultNumberOfRows = super.tableView(tableView, numberOfRowsInSection: section)
|
|
||||||
if AccountManager.shared.activeAccounts.isEmpty {
|
|
||||||
// Hide the add NetNewsWire feed row if they don't have any active accounts
|
|
||||||
return defaultNumberOfRows - 1
|
|
||||||
}
|
|
||||||
return defaultNumberOfRows
|
|
||||||
default:
|
|
||||||
return super.tableView(tableView, numberOfRowsInSection: section)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
|
|
||||||
let cell: UITableViewCell
|
|
||||||
switch indexPath.section {
|
|
||||||
case 0:
|
|
||||||
|
|
||||||
cell = tableView.dequeueReusableCell(withIdentifier: "SettingsTableViewCell", for: indexPath)
|
|
||||||
cell.textLabel?.adjustsFontForContentSizeCategory = true
|
|
||||||
|
|
||||||
let sortedAccounts = AccountManager.shared.sortedAccounts
|
|
||||||
if indexPath.row == sortedAccounts.count {
|
|
||||||
cell.textLabel?.text = NSLocalizedString("Add Account", comment: "Accounts")
|
|
||||||
} else {
|
|
||||||
cell.textLabel?.text = sortedAccounts[indexPath.row].nameForDisplay
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
cell = super.tableView(tableView, cellForRowAt: indexPath)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
let bgView = UIView()
|
|
||||||
bgView.backgroundColor = AppAssets.netNewsWireBlueColor
|
|
||||||
cell.selectedBackgroundView = bgView
|
|
||||||
return cell
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
|
|
||||||
switch indexPath.section {
|
|
||||||
case 0:
|
|
||||||
let sortedAccounts = AccountManager.shared.sortedAccounts
|
|
||||||
if indexPath.row == sortedAccounts.count {
|
|
||||||
let controller = UIStoryboard.settings.instantiateController(ofType: AddAccountViewController.self)
|
|
||||||
self.navigationController?.pushViewController(controller, animated: true)
|
|
||||||
} else {
|
|
||||||
let controller = UIStoryboard.settings.instantiateController(ofType: DetailAccountViewController.self)
|
|
||||||
controller.account = sortedAccounts[indexPath.row]
|
|
||||||
self.navigationController?.pushViewController(controller, animated: true)
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
switch indexPath.row {
|
|
||||||
case 0:
|
|
||||||
let timeline = UIStoryboard.settings.instantiateController(ofType: AboutViewController.self)
|
|
||||||
self.navigationController?.pushViewController(timeline, animated: true)
|
|
||||||
case 1:
|
|
||||||
UIApplication.shared.open(URL(string: "https://ranchero.com/netnewswire/")!, options: [:])
|
|
||||||
case 2:
|
|
||||||
UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire")!, options: [:])
|
|
||||||
case 3:
|
|
||||||
UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire/issues")!, options: [:])
|
|
||||||
case 4:
|
|
||||||
UIApplication.shared.open(URL(string: "https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")!, options: [:])
|
|
||||||
case 5:
|
|
||||||
addFeed()
|
|
||||||
default:
|
|
||||||
UIApplication.shared.open(URL(string: "https://ranchero.com/netnewswire/")!, options: [:])
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
if indexPath.row == 1 {
|
|
||||||
let timeline = UIStoryboard.settings.instantiateController(ofType: TimelineNumberOfLinesViewController.self)
|
|
||||||
self.navigationController?.pushViewController(timeline, animated: true)
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
switch indexPath.row {
|
|
||||||
case 0:
|
|
||||||
let timeline = UIStoryboard.settings.instantiateController(ofType: RefreshIntervalViewController.self)
|
|
||||||
self.navigationController?.pushViewController(timeline, animated: true)
|
|
||||||
case 1:
|
|
||||||
importOPML()
|
|
||||||
case 2:
|
|
||||||
exportOPML()
|
|
||||||
default:
|
|
||||||
print("export")
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
|
|
||||||
return .none
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
||||||
if indexPath.section == 0 {
|
|
||||||
return super.tableView(tableView, heightForRowAt: IndexPath(row: 0, section: 0))
|
|
||||||
} else {
|
|
||||||
return super.tableView(tableView, heightForRowAt: indexPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
|
|
||||||
if indexPath.section == 0 {
|
|
||||||
return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: 0))
|
|
||||||
} else {
|
|
||||||
return super.tableView(tableView, indentationLevelForRowAt: indexPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Actions
|
|
||||||
|
|
||||||
@IBAction func done(_ sender: Any) {
|
|
||||||
dismiss(animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func switchTimelineOrder(_ sender: Any) {
|
|
||||||
if timelineSortOrderSwitch.isOn {
|
|
||||||
AppDefaults.timelineSortDirection = .orderedAscending
|
|
||||||
} else {
|
|
||||||
AppDefaults.timelineSortDirection = .orderedDescending
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc func contentSizeCategoryDidChange() {
|
|
||||||
tableView.reloadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: OPML Document Picker
|
|
||||||
|
|
||||||
extension SettingsViewController: UIDocumentPickerDelegate {
|
|
||||||
|
|
||||||
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
|
|
||||||
|
|
||||||
for url in urls {
|
|
||||||
AccountManager.shared.defaultAccount.importOPML(url) { result in}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Private
|
|
||||||
|
|
||||||
private extension SettingsViewController {
|
|
||||||
|
|
||||||
func addFeed() {
|
|
||||||
|
|
||||||
let appNewsURLString = "https://nnw.ranchero.com/feed.json"
|
|
||||||
if AccountManager.shared.anyAccountHasFeedWithURL(appNewsURLString) {
|
|
||||||
presentError(title: "Subscribe", message: "You are already subscribed to the NetNewsWire news feed.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
self.dismiss(animated: true)
|
|
||||||
|
|
||||||
let addNavViewController = UIStoryboard.add.instantiateInitialViewController() as! UINavigationController
|
|
||||||
let addViewController = addNavViewController.topViewController as! AddContainerViewController
|
|
||||||
addNavViewController.modalPresentationStyle = .formSheet
|
|
||||||
addNavViewController.preferredContentSize = AddContainerViewController.preferredContentSizeForFormSheetDisplay
|
|
||||||
addViewController.initialFeed = appNewsURLString
|
|
||||||
addViewController.initialFeedName = "NetNewsWire News"
|
|
||||||
|
|
||||||
presentingParentController?.present(addNavViewController, animated: true)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func importOPML() {
|
|
||||||
|
|
||||||
let docPicker = UIDocumentPickerViewController(documentTypes: ["public.xml", "org.opml.opml"], in: .import)
|
|
||||||
docPicker.delegate = self
|
|
||||||
docPicker.modalPresentationStyle = .formSheet
|
|
||||||
self.present(docPicker, animated: true)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func exportOPML() {
|
|
||||||
|
|
||||||
let filename = "MySubscriptions.opml"
|
|
||||||
let tempFile = FileManager.default.temporaryDirectory.appendingPathComponent(filename)
|
|
||||||
let opmlString = OPMLExporter.OPMLString(with: AccountManager.shared.defaultAccount, title: filename)
|
|
||||||
do {
|
|
||||||
try opmlString.write(to: tempFile, atomically: true, encoding: String.Encoding.utf8)
|
|
||||||
} catch {
|
|
||||||
self.presentError(title: "OPML Export Error", message: error.localizedDescription)
|
|
||||||
}
|
|
||||||
|
|
||||||
let docPicker = UIDocumentPickerViewController(url: tempFile, in: .exportToService)
|
|
||||||
docPicker.modalPresentationStyle = .formSheet
|
|
||||||
self.present(docPicker, animated: true)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
//
|
|
||||||
// TimelineNumberOfLinesViewController.swift
|
|
||||||
// NetNewsWire-iOS
|
|
||||||
//
|
|
||||||
// Created by Maurice Parker on 4/29/19.
|
|
||||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
class TimelineNumberOfLinesViewController: UITableViewController {
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
||||||
return 5
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
|
||||||
|
|
||||||
cell.textLabel?.adjustsFontForContentSizeCategory = true
|
|
||||||
|
|
||||||
let bgView = UIView()
|
|
||||||
bgView.backgroundColor = AppAssets.netNewsWireBlueColor
|
|
||||||
cell.selectedBackgroundView = bgView
|
|
||||||
|
|
||||||
cell.textLabel?.text = "\(2 + indexPath.row)" + NSLocalizedString(" lines", comment: "Lines")
|
|
||||||
|
|
||||||
let numberOfLines = AppDefaults.timelineNumberOfLines
|
|
||||||
if indexPath.row + 2 == numberOfLines {
|
|
||||||
cell.accessoryType = .checkmark
|
|
||||||
} else {
|
|
||||||
cell.accessoryType = .none
|
|
||||||
}
|
|
||||||
|
|
||||||
return cell
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
||||||
AppDefaults.timelineNumberOfLines = indexPath.row + 2
|
|
||||||
self.navigationController?.popViewController(animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue