Make the Styles folder configurable so that it can be in different places on macOS and iOS.

This commit is contained in:
Maurice Parker
2021-08-24 20:20:20 -05:00
parent 2e7bb5b752
commit ba279d2a6e
3 changed files with 19 additions and 15 deletions

View File

@@ -63,10 +63,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
appDelegate = self
SecretsManager.provider = Secrets()
let documentAccountURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let documentAccountsFolder = documentAccountURL.appendingPathComponent("Accounts").absoluteString
let documentFolder = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let documentAccountsFolder = documentFolder.appendingPathComponent("Accounts").absoluteString
let documentAccountsFolderPath = String(documentAccountsFolder.suffix(from: documentAccountsFolder.index(documentAccountsFolder.startIndex, offsetBy: 7)))
AccountManager.shared = AccountManager(accountsFolder: documentAccountsFolderPath)
let documentStylesFolder = documentFolder.appendingPathComponent("Styles").absoluteString
let documentStylesFolderPath = String(documentStylesFolder.suffix(from: documentAccountsFolder.index(documentStylesFolder.startIndex, offsetBy: 7)))
ArticleStylesManager.shared = ArticleStylesManager(folderPath: documentStylesFolderPath)
FeedProviderManager.shared.delegate = ExtensionPointManager.shared
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)