2021-12-08 04:39:49 +05:30
|
|
|
import Defaults
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct UpdatesSettings: View {
|
|
|
|
@EnvironmentObject<UpdaterModel> private var updater
|
|
|
|
|
|
|
|
@State private var automaticallyChecksForUpdates = false
|
|
|
|
@Default(.enableBetaChannel) private var enableBetaChannel
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Section(header: SettingsHeader(text: "Updates")) {
|
|
|
|
Toggle("Check automatically", isOn: $automaticallyChecksForUpdates)
|
|
|
|
Toggle("Enable beta channel", isOn: $enableBetaChannel)
|
|
|
|
}
|
|
|
|
.onAppear {
|
|
|
|
automaticallyChecksForUpdates = updater.automaticallyChecksForUpdates
|
|
|
|
}
|
|
|
|
.onChange(of: automaticallyChecksForUpdates) { _ in
|
|
|
|
updater.setAutomaticallyChecksForUpdates(automaticallyChecksForUpdates)
|
|
|
|
}
|
|
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
|
|
|
|
|
|
Spacer()
|
2022-01-03 00:28:15 +05:30
|
|
|
|
2022-01-06 20:32:53 +05:30
|
|
|
Text("Yattee \(YatteeApp.version) (build \(YatteeApp.build))")
|
|
|
|
.foregroundColor(.secondary)
|
|
|
|
|
2022-01-03 00:28:15 +05:30
|
|
|
CheckForUpdatesView()
|
2021-12-08 04:39:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct UpdatesSettings_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
UpdatesSettings()
|
|
|
|
.injectFixtureEnvironmentObjects()
|
|
|
|
}
|
|
|
|
}
|