Implemented group by feed for iOS

This commit is contained in:
Phil Viso
2019-09-08 17:41:00 -05:00
parent 045bc61684
commit 01c48e788b
3 changed files with 41 additions and 3 deletions

View File

@@ -12,10 +12,11 @@ struct AppDefaults {
struct Key {
static let firstRunDate = "firstRunDate"
static let timelineGroupByFeed = "timelineGroupByFeed"
static let timelineNumberOfLines = "timelineNumberOfLines"
static let timelineSortDirection = "timelineSortDirection"
static let refreshInterval = "refreshInterval"
static let lastRefresh = "lastRefresh"
static let timelineNumberOfLines = "timelineNumberOfLines"
}
static let isFirstRun: Bool = {
@@ -35,6 +36,15 @@ struct AppDefaults {
UserDefaults.standard.set(newValue.rawValue, forKey: Key.refreshInterval)
}
}
static var timelineGroupByFeed: Bool {
get {
return bool(for: Key.timelineGroupByFeed)
}
set {
setBool(for: Key.timelineGroupByFeed, newValue)
}
}
static var timelineSortDirection: ComparisonResult {
get {
@@ -64,7 +74,10 @@ struct AppDefaults {
}
static func registerDefaults() {
let defaults: [String : Any] = [Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue, Key.refreshInterval: RefreshInterval.everyHour.rawValue, Key.timelineNumberOfLines: 3]
let defaults: [String : Any] = [Key.refreshInterval: RefreshInterval.everyHour.rawValue,
Key.timelineGroupByFeed: false,
Key.timelineNumberOfLines: 3,
Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue]
UserDefaults.standard.register(defaults: defaults)
}