summaryrefslogtreecommitdiff
path: root/Sora/Views/Settings/Section/SettingsSectionSettingsView.swift
blob: ad7fe836c1c33e76680849216c89910f5744e9e1 (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
import SwiftUI

struct SettingsSectionSettingsView: View {
  @Environment(SettingsManager.self)
  private var settings

  var body: some View {
    @Bindable var settings = settings

    Toggle(isOn: $settings.enableSync) {
      Text("Sync with iCloud")

      Text("Keep bookmarks, collections, search history, and sources in sync across your devices.")
        .font(.caption)
    }
    .onChange(of: settings.enableSync) { _, isEnabled in
      if isEnabled {
        settings.triggerSyncIfNeededForAll()
      }
    }

    Button("Reset Settings") {
      settings.resetToDefaults()
    }
    .trailingFrame()
  }
}