mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-29 08:04:32 +00:00
Restored files from old Mac, force pushing
This commit is contained in:
parent
5dd95228b8
commit
5040381840
126 changed files with 10431 additions and 67 deletions
67
DynamicIsland/components/Settings/SoftwareUpdater.swift
Normal file
67
DynamicIsland/components/Settings/SoftwareUpdater.swift
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
//
|
||||
// SoftwareUpdater.swift
|
||||
// boringNotch
|
||||
//
|
||||
// Created by Richard Kunkli on 09/08/2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Sparkle
|
||||
|
||||
final class CheckForUpdatesViewModel: ObservableObject {
|
||||
@Published var canCheckForUpdates = false
|
||||
|
||||
init(updater: SPUUpdater) {
|
||||
updater.publisher(for: \.canCheckForUpdates)
|
||||
.assign(to: &$canCheckForUpdates)
|
||||
}
|
||||
}
|
||||
|
||||
struct CheckForUpdatesView: View {
|
||||
@ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
|
||||
private let updater: SPUUpdater
|
||||
|
||||
init(updater: SPUUpdater) {
|
||||
self.updater = updater
|
||||
|
||||
// Create our view model for our CheckForUpdatesView
|
||||
self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Button("Check for Updates…", action: updater.checkForUpdates)
|
||||
.disabled(!checkForUpdatesViewModel.canCheckForUpdates)
|
||||
}
|
||||
}
|
||||
|
||||
struct UpdaterSettingsView: View {
|
||||
private let updater: SPUUpdater
|
||||
|
||||
@State private var automaticallyChecksForUpdates: Bool
|
||||
@State private var automaticallyDownloadsUpdates: Bool
|
||||
|
||||
init(updater: SPUUpdater) {
|
||||
self.updater = updater
|
||||
self.automaticallyChecksForUpdates = updater.automaticallyChecksForUpdates
|
||||
self.automaticallyDownloadsUpdates = updater.automaticallyDownloadsUpdates
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
Toggle("Automatically check for updates", isOn: $automaticallyChecksForUpdates)
|
||||
.onChange(of: automaticallyChecksForUpdates) { _, newValue in
|
||||
updater.automaticallyChecksForUpdates = newValue
|
||||
}
|
||||
|
||||
Toggle("Automatically download updates", isOn: $automaticallyDownloadsUpdates)
|
||||
.disabled(!automaticallyChecksForUpdates)
|
||||
.onChange(of: automaticallyDownloadsUpdates) { _, newValue in
|
||||
updater.automaticallyDownloadsUpdates = newValue
|
||||
}
|
||||
} header: {
|
||||
HStack {
|
||||
Text("Software updates")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue