summaryrefslogtreecommitdiff
path: root/Sora/Views/Settings/Section/SettingsSearchView.swift
blob: 062efadb70e21e090ab341cd817124be82a4fb8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import SwiftUI

struct SettingsSearchView: View {
  @EnvironmentObject var settings: SettingsManager

  #if os(macOS)
    var manager = BooruManager(.yandere)
  #else
    @EnvironmentObject var manager: BooruManager
  #endif

  var body: some View {
    Picker("Suggestion Mode", selection: $settings.searchSuggestionsMode) {
      ForEach(SettingsSearchSuggestionsMode.allCases, id: \.self) { type in
        Text(type.rawValue.capitalized).tag(type)
      }
    }

    Button(
      "Clear Cached Tags (\(manager.cacheSize ?? "Unknown size"))"
    ) {
      manager.clearCachedTags()
    }
    .trailingFrame()

    Button("Clear History") {
      settings.searchHistory.removeAll()
    }
    .trailingFrame()
  }
}