mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-31 19:24:55 +01:00
Inject the Accounts folder name so that it can be in different locations between the iOS and Mac Apps.
This commit is contained in:
parent
ca191c9a4e
commit
5985b00480
@ -14,10 +14,11 @@ import Articles
|
||||
|
||||
public final class AccountManager: UnreadCountProvider {
|
||||
|
||||
public static let shared = AccountManager()
|
||||
public static var shared: AccountManager!
|
||||
|
||||
public let defaultAccount: Account
|
||||
|
||||
private let accountsFolder = RSDataSubfolder(nil, "Accounts")!
|
||||
private let accountsFolder: String
|
||||
private var accountsDictionary = [String: Account]()
|
||||
|
||||
private let defaultAccountFolderName = "OnMyMac"
|
||||
@ -71,7 +72,9 @@ public final class AccountManager: UnreadCountProvider {
|
||||
return CombinedRefreshProgress(downloadProgressArray: downloadProgressArray)
|
||||
}
|
||||
|
||||
public init() {
|
||||
public init(accountsFolder: String) {
|
||||
self.accountsFolder = accountsFolder
|
||||
|
||||
// The local "On My Mac" account must always exist, even if it's empty.
|
||||
let localAccountFolder = (accountsFolder as NSString).appendingPathComponent("OnMyMac")
|
||||
do {
|
||||
|
@ -69,6 +69,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
||||
NSWindow.allowsAutomaticWindowTabbing = false
|
||||
super.init()
|
||||
|
||||
AccountManager.shared = AccountManager(accountsFolder: RSDataSubfolder(nil, "Accounts")!)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(inspectableObjectsDidChange(_:)), name: .InspectableObjectsDidChange, object: nil)
|
||||
|
||||
|
@ -52,6 +52,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
|
||||
super.init()
|
||||
appDelegate = self
|
||||
|
||||
AccountManager.shared = AccountManager(accountsFolder: RSDataSubfolder(nil, "Accounts")!)
|
||||
|
||||
registerBackgroundTasks()
|
||||
|
||||
@ -59,9 +61,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountRefreshDidFinish(_:)), name: .AccountRefreshDidFinish, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
|
||||
|
||||
// Reinitialize the shared state as early as possible
|
||||
_ = AccountManager.shared
|
||||
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user