mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-30 18:54:53 +01:00
Add Inoreader, BazQux, and The Old Reader assets
This commit is contained in:
parent
0a01a9f501
commit
bc2a475936
@ -42,7 +42,9 @@ public enum AccountType: Int, Codable {
|
||||
case feedWrangler = 18
|
||||
case newsBlur = 19
|
||||
case freshRSS = 20
|
||||
// TODO: more
|
||||
case inoreader = 21
|
||||
case bazQux = 22
|
||||
case theOldReader = 23
|
||||
}
|
||||
|
||||
public enum FetchType {
|
||||
@ -258,14 +260,20 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
self.delegate = CloudKitAccountDelegate(dataFolder: dataFolder)
|
||||
case .feedbin:
|
||||
self.delegate = FeedbinAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
case .freshRSS:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
case .feedly:
|
||||
self.delegate = FeedlyAccountDelegate(dataFolder: dataFolder, transport: transport, api: FeedlyAccountDelegate.environment)
|
||||
case .feedWrangler:
|
||||
self.delegate = FeedWranglerAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
case .newsBlur:
|
||||
self.delegate = NewsBlurAccountDelegate(dataFolder: dataFolder, transport: transport)
|
||||
case .freshRSS:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport, variant: .generic)
|
||||
case .inoreader:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport, variant: .inoreader)
|
||||
case .bazQux:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport, variant: .bazQux)
|
||||
case .theOldReader:
|
||||
self.delegate = ReaderAPIAccountDelegate(dataFolder: dataFolder, transport: transport, variant: .theOldReader)
|
||||
}
|
||||
|
||||
self.delegate.accountMetadata = metadata
|
||||
@ -282,17 +290,23 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
case .onMyMac:
|
||||
defaultName = Account.defaultLocalAccountName
|
||||
case .cloudKit:
|
||||
defaultName = "iCloud"
|
||||
defaultName = NSLocalizedString("iCloud", comment: "iCloud")
|
||||
case .feedly:
|
||||
defaultName = "Feedly"
|
||||
defaultName = NSLocalizedString("Feedly", comment: "Feedly")
|
||||
case .feedbin:
|
||||
defaultName = "Feedbin"
|
||||
defaultName = NSLocalizedString("Feedbin", comment: "Feedbin")
|
||||
case .feedWrangler:
|
||||
defaultName = "FeedWrangler"
|
||||
defaultName = NSLocalizedString("FeedWrangler", comment: "FeedWrangler")
|
||||
case .newsBlur:
|
||||
defaultName = "NewsBlur"
|
||||
defaultName = NSLocalizedString("NewsBlur", comment: "NewsBlur")
|
||||
case .freshRSS:
|
||||
defaultName = "FreshRSS"
|
||||
defaultName = NSLocalizedString("FreshRSS", comment: "FreshRSS")
|
||||
case .inoreader:
|
||||
defaultName = NSLocalizedString("Inoreader", comment: "Inoreader")
|
||||
case .bazQux:
|
||||
defaultName = NSLocalizedString("BazQux", comment: "BazQux")
|
||||
case .theOldReader:
|
||||
defaultName = NSLocalizedString("The Old Reader", comment: "The Old Reader")
|
||||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(downloadProgressDidChange(_:)), name: .DownloadProgressDidChange, object: nil)
|
||||
|
@ -21,6 +21,12 @@ public enum ReaderAPIAccountDelegateError: String, Error {
|
||||
|
||||
final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||
|
||||
private var variant: ReaderAPIVariant {
|
||||
didSet {
|
||||
caller.variant = variant
|
||||
}
|
||||
}
|
||||
|
||||
private let database: SyncDatabase
|
||||
|
||||
private let caller: ReaderAPICaller
|
||||
@ -50,8 +56,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||
|
||||
var refreshProgress = DownloadProgress(numberOfTasks: 0)
|
||||
|
||||
init(dataFolder: String, transport: Transport?) {
|
||||
|
||||
init(dataFolder: String, transport: Transport?, variant: ReaderAPIVariant) {
|
||||
let databaseFilePath = (dataFolder as NSString).appendingPathComponent("Sync.sqlite3")
|
||||
database = SyncDatabase(databaseFilePath: databaseFilePath)
|
||||
|
||||
@ -78,6 +83,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
||||
|
||||
}
|
||||
|
||||
self.variant = variant
|
||||
}
|
||||
|
||||
func receiveRemoteNotification(for account: Account, userInfo: [AnyHashable : Any], completion: @escaping () -> Void) {
|
||||
|
@ -49,6 +49,7 @@ final class ReaderAPICaller: NSObject {
|
||||
|
||||
private var transport: Transport!
|
||||
|
||||
var variant: ReaderAPIVariant = .generic
|
||||
var credentials: Credentials?
|
||||
private var accessToken: String?
|
||||
|
||||
|
15
Account/Sources/Account/ReaderAPI/ReaderAPIVariant.swift
Normal file
15
Account/Sources/Account/ReaderAPI/ReaderAPIVariant.swift
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// ReaderAPIVariant.swift
|
||||
//
|
||||
//
|
||||
// Created by Maurice Parker on 10/23/20.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum ReaderAPIVariant {
|
||||
case generic
|
||||
case inoreader
|
||||
case bazQux
|
||||
case theOldReader
|
||||
}
|
@ -12,12 +12,12 @@ import Account
|
||||
|
||||
struct AppAssets {
|
||||
|
||||
static var accountCloudKit: RSImage! = {
|
||||
return RSImage(named: "accountCloudKit")
|
||||
static var accountBazQux: RSImage! = {
|
||||
return RSImage(named: "accountBazQux")
|
||||
}()
|
||||
|
||||
static var accountLocal: RSImage! = {
|
||||
return RSImage(named: "accountLocal")
|
||||
static var accountCloudKit: RSImage! = {
|
||||
return RSImage(named: "accountCloudKit")
|
||||
}()
|
||||
|
||||
static var accountFeedbin: RSImage! = {
|
||||
@ -36,10 +36,22 @@ struct AppAssets {
|
||||
return RSImage(named: "accountFreshRSS")
|
||||
}()
|
||||
|
||||
static var accountInoreader: RSImage! = {
|
||||
return RSImage(named: "accountInoreader")
|
||||
}()
|
||||
|
||||
static var accountLocal: RSImage! = {
|
||||
return RSImage(named: "accountLocal")
|
||||
}()
|
||||
|
||||
static var accountNewsBlur: RSImage! = {
|
||||
return RSImage(named: "accountNewsBlur")
|
||||
}()
|
||||
|
||||
static var accountTheOldReader: RSImage! = {
|
||||
return RSImage(named: "accountTheOldReader")
|
||||
}()
|
||||
|
||||
@available(macOS 11.0, *)
|
||||
static var addNewSidebarItemImage: RSImage = {
|
||||
return NSImage(systemSymbolName: "plus", accessibilityDescription: nil)!
|
||||
@ -293,6 +305,8 @@ struct AppAssets {
|
||||
return AppAssets.accountLocal
|
||||
case .cloudKit:
|
||||
return AppAssets.accountCloudKit
|
||||
case .bazQux:
|
||||
return AppAssets.accountBazQux
|
||||
case .feedbin:
|
||||
return AppAssets.accountFeedbin
|
||||
case .feedly:
|
||||
@ -301,8 +315,12 @@ struct AppAssets {
|
||||
return AppAssets.accountFeedWrangler
|
||||
case .freshRSS:
|
||||
return AppAssets.accountFreshRSS
|
||||
case .inoreader:
|
||||
return AppAssets.accountInoreader
|
||||
case .newsBlur:
|
||||
return AppAssets.accountNewsBlur
|
||||
case .theOldReader:
|
||||
return AppAssets.accountTheOldReader
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@ class AccountsAddViewController: NSViewController {
|
||||
private var accountsAddWindowController: NSWindowController?
|
||||
|
||||
#if DEBUG
|
||||
private var addableAccountTypes: [AccountType] = [.onMyMac, .feedbin, .feedly, .feedWrangler, .freshRSS, .cloudKit, .newsBlur]
|
||||
private var addableAccountTypes: [AccountType] = [.onMyMac, .cloudKit, .feedbin, .feedly, .inoreader, .newsBlur, .feedWrangler, .bazQux, .theOldReader, .freshRSS]
|
||||
#else
|
||||
private var addableAccountTypes: [AccountType] = [.onMyMac, .feedbin, .feedly, .cloudKit, .newsBlur]
|
||||
private var addableAccountTypes: [AccountType] = [.onMyMac, .cloudKit, .feedbin, .feedly, .inoreader, .newsBlur, .feedWrangler, .bazQux, .theOldReader, .freshRSS]
|
||||
#endif
|
||||
|
||||
init() {
|
||||
@ -87,6 +87,15 @@ extension AccountsAddViewController: NSTableViewDelegate {
|
||||
case .newsBlur:
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("NewsBlur", comment: "NewsBlur")
|
||||
cell.accountImageView?.image = AppAssets.accountNewsBlur
|
||||
case .inoreader:
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("Inoreader", comment: "Inoreader")
|
||||
cell.accountImageView?.image = AppAssets.accountInoreader
|
||||
case .bazQux:
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("Bazqux", comment: "Bazqux")
|
||||
cell.accountImageView?.image = AppAssets.accountBazQux
|
||||
case .theOldReader:
|
||||
cell.accountNameLabel?.stringValue = NSLocalizedString("The Old Reader", comment: "The Old Reader")
|
||||
cell.accountImageView?.image = AppAssets.accountTheOldReader
|
||||
}
|
||||
return cell
|
||||
}
|
||||
@ -137,15 +146,32 @@ extension AccountsAddViewController: AccountsAddTableCellViewDelegate {
|
||||
let addAccount = OAuthAccountAuthorizationOperation(accountType: .feedly)
|
||||
addAccount.delegate = self
|
||||
addAccount.presentationAnchor = self.view.window!
|
||||
|
||||
runAwaitingFeedlyLoginAlertModal(forLifetimeOf: addAccount)
|
||||
|
||||
MainThreadOperationQueue.shared.add(addAccount)
|
||||
|
||||
case .newsBlur:
|
||||
let accountsNewsBlurWindowController = AccountsNewsBlurWindowController()
|
||||
accountsNewsBlurWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsAddWindowController = accountsNewsBlurWindowController
|
||||
|
||||
case .inoreader:
|
||||
let accountsReaderAPIWindowController = AccountsReaderAPIWindowController()
|
||||
accountsReaderAPIWindowController.accountType = .inoreader
|
||||
accountsReaderAPIWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsAddWindowController = accountsReaderAPIWindowController
|
||||
|
||||
case .bazQux:
|
||||
let accountsReaderAPIWindowController = AccountsReaderAPIWindowController()
|
||||
accountsReaderAPIWindowController.accountType = .bazQux
|
||||
accountsReaderAPIWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsAddWindowController = accountsReaderAPIWindowController
|
||||
|
||||
case .theOldReader:
|
||||
let accountsReaderAPIWindowController = AccountsReaderAPIWindowController()
|
||||
accountsReaderAPIWindowController.accountType = .theOldReader
|
||||
accountsReaderAPIWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsAddWindowController = accountsReaderAPIWindowController
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,15 @@ class AccountsReaderAPIWindowController: NSWindowController {
|
||||
case .freshRSS:
|
||||
titleImageView.image = AppAssets.accountFreshRSS
|
||||
titleLabel.stringValue = NSLocalizedString("FreshRSS", comment: "FreshRSS")
|
||||
case .inoreader:
|
||||
titleImageView.image = AppAssets.accountInoreader
|
||||
titleLabel.stringValue = NSLocalizedString("InoReader", comment: "InoReader")
|
||||
case .bazQux:
|
||||
titleImageView.image = AppAssets.accountBazQux
|
||||
titleLabel.stringValue = NSLocalizedString("BazQux", comment: "BazQux")
|
||||
case .theOldReader:
|
||||
titleImageView.image = AppAssets.accountTheOldReader
|
||||
titleLabel.stringValue = NSLocalizedString("The Old Reader", comment: "The Old Reader")
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
16
Mac/Resources/Assets.xcassets/accountBazQux.imageset/Contents.json
vendored
Normal file
16
Mac/Resources/Assets.xcassets/accountBazQux.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "bazqux-logo.png",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true,
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
BIN
Mac/Resources/Assets.xcassets/accountBazQux.imageset/bazqux-logo.png
vendored
Normal file
BIN
Mac/Resources/Assets.xcassets/accountBazQux.imageset/bazqux-logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
16
Mac/Resources/Assets.xcassets/accountInoreader.imageset/Contents.json
vendored
Normal file
16
Mac/Resources/Assets.xcassets/accountInoreader.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "inoreader_logo.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true,
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
BIN
Mac/Resources/Assets.xcassets/accountInoreader.imageset/inoreader_logo.pdf
vendored
Normal file
BIN
Mac/Resources/Assets.xcassets/accountInoreader.imageset/inoreader_logo.pdf
vendored
Normal file
Binary file not shown.
16
Mac/Resources/Assets.xcassets/accountTheOldReader.imageset/Contents.json
vendored
Normal file
16
Mac/Resources/Assets.xcassets/accountTheOldReader.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "oldreader-icon.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true,
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
BIN
Mac/Resources/Assets.xcassets/accountTheOldReader.imageset/oldreader-icon.pdf
vendored
Normal file
BIN
Mac/Resources/Assets.xcassets/accountTheOldReader.imageset/oldreader-icon.pdf
vendored
Normal file
Binary file not shown.
@ -170,6 +170,12 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
|
||||
osType = "NBlr"
|
||||
case .freshRSS:
|
||||
osType = "Frsh"
|
||||
case .inoreader:
|
||||
osType = "Inrd"
|
||||
case .bazQux:
|
||||
osType = "Bzqx"
|
||||
case .theOldReader:
|
||||
osType = "Tord"
|
||||
}
|
||||
return osType.fourCharCode
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user