Adds app default option

Adds app defaults option for controlling link opening preferences.

Adds browser logic and images.

Browser Manager Updates

- Handles deletion of current browser
- Fixes detection of installed browsers by moving URL Types to LSApplicationQuery
- Updates icons to glyphs
- Context menus update

tidy up

- removes browser specific options and offers in-app or default browser options (can be enabled via a bool)
- adds 1Password as an option
- removes custom wording on context menus

Fixes

- makes sure browser options are available on iPad
- uses VibrantCell
- Changes Settings title to "Open Links In"
This commit is contained in:
Stuart Breckenridge
2021-08-22 09:42:06 +08:00
parent 656782ff9e
commit 08a1120e00
33 changed files with 803 additions and 80 deletions

View File

@@ -54,6 +54,7 @@ final class AppDefaults {
static let addWebFeedAccountID = "addWebFeedAccountID"
static let addWebFeedFolderName = "addWebFeedFolderName"
static let addFolderAccountID = "addFolderAccountID"
static let browserPreference = "browserPreference"
}
let isDeveloperBuild: Bool = {
@@ -119,6 +120,18 @@ final class AppDefaults {
}
}
var browserPreference: String {
get {
guard let preference = UserDefaults.standard.string(forKey: Key.browserPreference) else {
return "browser.inapp"
}
return preference
}
set {
UserDefaults.standard.setValue(newValue, forKey: Key.browserPreference)
}
}
var lastImageCacheFlushDate: Date? {
get {
return AppDefaults.date(for: Key.lastImageCacheFlushDate)
@@ -191,6 +204,20 @@ final class AppDefaults {
}
}
/// The default behaviour is to open links in the in-app browser, as such, `Browsers.inApp.browserID` is the default.
// var openLinksPreferredBrowser: String {
// get {
// if AppDefaults.store.string(forKey: Key.openLinksPreferredBrowser) == nil {
// return Browsers.inApp.browserID
// } else {
// return AppDefaults.store.string(forKey: Key.openLinksPreferredBrowser)!
// }
// }
//
// set { AppDefaults.store.setValue(newValue, forKey: Key.openLinksPreferredBrowser) }
// }
var timelineNumberOfLines: Int {
get {
return AppDefaults.int(for: Key.timelineNumberOfLines)