mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rebrand Reader API to FreshRSS
This commit is contained in:
@@ -33,7 +33,7 @@ public enum AccountType: Int {
|
||||
case feedbin = 17
|
||||
case feedWrangler = 18
|
||||
case newsBlur = 19
|
||||
case readerAPI = 20
|
||||
case freshRSS = 20
|
||||
// TODO: more
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
self.delegate = LocalAccountDelegate()
|
||||
case .feedbin:
|
||||
self.delegate = FeedbinAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
case .readerAPI:
|
||||
case .freshRSS:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
default:
|
||||
fatalError("Only Local and Feedbin accounts are supported")
|
||||
@@ -250,8 +250,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
defaultName = "FeedWrangler"
|
||||
case .newsBlur:
|
||||
defaultName = "NewsBlur"
|
||||
case .readerAPI:
|
||||
defaultName = "Reader API"
|
||||
case .freshRSS:
|
||||
defaultName = "FreshRSS"
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(downloadProgressDidChange(_:)), name: .DownloadProgressDidChange, object: nil)
|
||||
@@ -331,7 +331,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
LocalAccountDelegate.validateCredentials(transport: transport, credentials: credentials, completion: completion)
|
||||
case .feedbin:
|
||||
FeedbinAccountDelegate.validateCredentials(transport: transport, credentials: credentials, completion: completion)
|
||||
case .readerAPI:
|
||||
case .freshRSS:
|
||||
ReaderAPIAccountDelegate.validateCredentials(transport: transport, credentials: credentials, endpoint: endpoint, completion: completion)
|
||||
default:
|
||||
break
|
||||
|
||||
@@ -34,8 +34,8 @@ struct AppAssets {
|
||||
return RSImage(named: "accountFeedbin")
|
||||
}()
|
||||
|
||||
static var accountReader: RSImage! = {
|
||||
return RSImage(named: "accountReader")
|
||||
static var accountFreshRSS: RSImage! = {
|
||||
return RSImage(named: "accountFreshRSS")
|
||||
}()
|
||||
|
||||
static var faviconTemplateImage: RSImage = {
|
||||
|
||||
@@ -64,8 +64,8 @@ extension AccountsAddViewController: NSTableViewDelegate {
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("Feedbin", comment: "Feedbin")
|
||||
cell.accountImageView?.image = AppAssets.accountFeedbin
|
||||
case 2:
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("Reader API", comment: "Reader API")
|
||||
cell.accountImageView?.image = AppAssets.accountReader
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("FreshRSS", comment: "FreshRSS")
|
||||
cell.accountImageView?.image = AppAssets.accountFreshRSS
|
||||
default:
|
||||
break
|
||||
}
|
||||
@@ -92,6 +92,7 @@ extension AccountsAddViewController: NSTableViewDelegate {
|
||||
accountsAddWindowController = accountsFeedbinWindowController
|
||||
case 2:
|
||||
let accountsReaderAPIWindowController = AccountsReaderAPIWindowController()
|
||||
accountsReaderAPIWindowController.accountType = .freshRSS
|
||||
accountsReaderAPIWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsAddWindowController = accountsReaderAPIWindowController
|
||||
default:
|
||||
|
||||
@@ -107,8 +107,8 @@ extension AccountsPreferencesViewController: NSTableViewDelegate {
|
||||
cell.imageView?.image = AppAssets.accountLocal
|
||||
case .feedbin:
|
||||
cell.imageView?.image = NSImage(named: "accountFeedbin")
|
||||
case .readerAPI:
|
||||
cell.imageView?.image = AppAssets.accountReader
|
||||
case .freshRSS:
|
||||
cell.imageView?.image = AppAssets.accountFreshRSS
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<outlet property="errorMessageLabel" destination="byK-Sd-r7F" id="8zt-9d-dWQ"/>
|
||||
<outlet property="passwordTextField" destination="JSa-LY-zNQ" id="E9W-0F-69m"/>
|
||||
<outlet property="progressIndicator" destination="B0W-bh-Evv" id="Tiq-gx-s3F"/>
|
||||
<outlet property="titleImageView" destination="Ssh-Dh-xbg" id="8Iy-jf-EYR"/>
|
||||
<outlet property="titleLabel" destination="lti-yM-8LV" id="AP0-ds-6tS"/>
|
||||
<outlet property="usernameTextField" destination="78p-Cf-f55" id="RWd-0q-oAL"/>
|
||||
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
@@ -37,7 +39,7 @@
|
||||
<constraint firstAttribute="height" constant="36" id="Ern-Kk-8LX"/>
|
||||
<constraint firstAttribute="width" constant="36" id="PLS-68-NMc"/>
|
||||
</constraints>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="accountReader" id="y38-YL-woC"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="y38-YL-woC"/>
|
||||
</imageView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lti-yM-8LV">
|
||||
<rect key="frame" x="53" y="0.0" width="156" height="38"/>
|
||||
@@ -205,7 +207,4 @@ Gw
|
||||
<point key="canvasLocation" x="116.5" y="136.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="accountReader" width="73" height="73"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -12,6 +12,9 @@ import RSWeb
|
||||
|
||||
class AccountsReaderAPIWindowController: NSWindowController {
|
||||
|
||||
@IBOutlet weak var titleImageView: NSImageView!
|
||||
@IBOutlet weak var titleLabel: NSTextField!
|
||||
|
||||
@IBOutlet weak var progressIndicator: NSProgressIndicator!
|
||||
@IBOutlet weak var usernameTextField: NSTextField!
|
||||
@IBOutlet weak var apiURLTextField: NSTextField!
|
||||
@@ -20,6 +23,7 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
@IBOutlet weak var actionButton: NSButton!
|
||||
|
||||
var account: Account?
|
||||
var accountType: AccountType?
|
||||
|
||||
private weak var hostWindow: NSWindow?
|
||||
|
||||
@@ -28,6 +32,16 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
}
|
||||
|
||||
override func windowDidLoad() {
|
||||
if let accountType = accountType {
|
||||
switch accountType {
|
||||
case .freshRSS:
|
||||
titleImageView.image = AppAssets.accountFreshRSS
|
||||
titleLabel.stringValue = NSLocalizedString("FreshRSS", comment: "FreshRSS")
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if let account = account, let credentials = try? account.retrieveBasicCredentials() {
|
||||
if case .basic(let username, let password) = credentials {
|
||||
usernameTextField.stringValue = username
|
||||
@@ -71,7 +85,7 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
}
|
||||
|
||||
let credentials = Credentials.readerAPIBasicLogin(username: usernameTextField.stringValue, password: passwordTextField.stringValue)
|
||||
Account.validateCredentials(type: .readerAPI, credentials: credentials, endpoint: apiURL) { [weak self] result in
|
||||
Account.validateCredentials(type: accountType!, credentials: credentials, endpoint: apiURL) { [weak self] result in
|
||||
|
||||
guard let self = self else { return }
|
||||
|
||||
@@ -89,7 +103,7 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
|
||||
var newAccount = false
|
||||
if self.account == nil {
|
||||
self.account = AccountManager.shared.createAccount(type: .readerAPI)
|
||||
self.account = AccountManager.shared.createAccount(type: self.accountType!)
|
||||
newAccount = true
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "accountReader.pdf"
|
||||
"filename" : "accountFreshRSS.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
Binary file not shown.
@@ -142,8 +142,8 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
|
||||
osType = "FWrg"
|
||||
case .newsBlur:
|
||||
osType = "NBlr"
|
||||
case .readerAPI:
|
||||
osType = "Grdr"
|
||||
case .freshRSS:
|
||||
osType = "Frsh"
|
||||
}
|
||||
return osType.fourCharCode()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user