summaryrefslogtreecommitdiff
path: root/Sora/Data/Settings.swift
blob: 8ce6c1a0def28da1eb31da0d854b4e664ff2a748 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import SwiftUI

class Settings: ObservableObject {
    @AppStorage("softLimit") var softLimit: Int = 100
    #if DEBUG
        @AppStorage("detailViewType") var detailViewType: PostFileType = .compressed
    #else
        @AppStorage("detailViewType") var detailViewType: PostFileType = .original
    #endif
    @AppStorage("thumbnailType") var thumbnailType: PostFileType = .preview
    @AppStorage("searchSuggestions") var searchSuggestions: Bool = false
    @AppStorage("columns") var columns: Int = 2
    let minSoftLimit: Int = 100
    let maxSoftLimit: Int = 10000

    func softLimitAsCGFloat() -> CGFloat {
        max(CGFloat(softLimit), CGFloat(minSoftLimit))
    }
}