mirror of
https://github.com/yattee/yattee.git
synced 2025-12-20 11:40:15 +00:00
Add Sparkle update framework for macOS
This commit is contained in:
32
macOS/Updates/UpdatesSettings.swift
Normal file
32
macOS/Updates/UpdatesSettings.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
struct UpdatesSettings_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
UpdatesSettings()
|
||||
.injectFixtureEnvironmentObjects()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user