diff --git a/Xcodes.xcodeproj/project.pbxproj b/Xcodes.xcodeproj/project.pbxproj
index 61841e3..9f6cdd2 100644
--- a/Xcodes.xcodeproj/project.pbxproj
+++ b/Xcodes.xcodeproj/project.pbxproj
@@ -1415,8 +1415,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sparkle-project/Sparkle/";
requirement = {
- kind = exactVersion;
- version = "1.24.0-spm";
+ kind = upToNextMajorVersion;
+ minimumVersion = 2.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */
diff --git a/Xcodes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Xcodes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index c92db7b..58f4e08 100644
--- a/Xcodes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Xcodes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -60,8 +60,8 @@
"repositoryURL": "https://github.com/sparkle-project/Sparkle/",
"state": {
"branch": null,
- "revision": "891afd44c7075e699924ed9b81d8dc94a5111dfd",
- "version": "1.24.0-spm"
+ "revision": "286edd1fa22505a9e54d170e9fd07d775ea233f2",
+ "version": "2.1.0"
}
},
{
diff --git a/Xcodes/Frontend/Preferences/PreferencesView.swift b/Xcodes/Frontend/Preferences/PreferencesView.swift
index 8b773e8..5f6dc42 100644
--- a/Xcodes/Frontend/Preferences/PreferencesView.swift
+++ b/Xcodes/Frontend/Preferences/PreferencesView.swift
@@ -5,6 +5,7 @@ struct PreferencesView: View {
case general, updates, advanced, experiment
}
@EnvironmentObject var appState: AppState
+ @EnvironmentObject var updater: ObservableUpdater
var body: some View {
TabView {
@@ -15,6 +16,7 @@ struct PreferencesView: View {
}
.tag(Tabs.general)
UpdatesPreferencePane()
+ .environmentObject(updater)
.tabItem {
Label("Updates", systemImage: "arrow.triangle.2.circlepath.circle")
}
diff --git a/Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift b/Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift
index e94274b..5e3db80 100644
--- a/Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift
+++ b/Xcodes/Frontend/Preferences/UpdatesPreferencePane.swift
@@ -3,7 +3,7 @@ import Sparkle
import SwiftUI
struct UpdatesPreferencePane: View {
- @StateObject var updater = ObservableUpdater()
+ @EnvironmentObject var updater: ObservableUpdater
@AppStorage("autoInstallation") var autoInstallationType: AutoInstallationType = .none
@@ -41,7 +41,7 @@ struct UpdatesPreferencePane: View {
)
Button("CheckNow") {
- SUUpdater.shared()?.checkForUpdates(nil)
+ updater.checkForUpdates()
}
Text(String(format: localizeString("LastChecked"), lastUpdatedString))
@@ -69,9 +69,11 @@ struct UpdatesPreferencePane: View {
}
class ObservableUpdater: ObservableObject {
+ private let updater: SPUUpdater
+
@Published var automaticallyChecksForUpdates = false {
didSet {
- SUUpdater.shared()?.automaticallyChecksForUpdates = automaticallyChecksForUpdates
+ updater.automaticallyChecksForUpdates = automaticallyChecksForUpdates
}
}
private var automaticallyChecksForUpdatesObservation: NSKeyValueObservation?
@@ -82,15 +84,17 @@ class ObservableUpdater: ObservableObject {
UserDefaults.standard.setValue(includePrereleaseVersions, forKey: "includePrereleaseVersions")
if includePrereleaseVersions {
- SUUpdater.shared()?.feedURL = .prereleaseAppcast
+ updater.setFeedURL(.prereleaseAppcast)
} else {
- SUUpdater.shared()?.feedURL = .appcast
+ updater.setFeedURL(.appcast)
}
}
}
init() {
- automaticallyChecksForUpdatesObservation = SUUpdater.shared()?.observe(
+ updater = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil).updater
+
+ automaticallyChecksForUpdatesObservation = updater.observe(
\.automaticallyChecksForUpdates,
options: [.initial, .new, .old],
changeHandler: { [unowned self] updater, change in
@@ -98,7 +102,7 @@ class ObservableUpdater: ObservableObject {
self.automaticallyChecksForUpdates = updater.automaticallyChecksForUpdates
}
)
- lastUpdateCheckDateObservation = SUUpdater.shared()?.observe(
+ lastUpdateCheckDateObservation = updater.observe(
\.lastUpdateCheckDate,
options: [.initial, .new, .old],
changeHandler: { [unowned self] updater, change in
@@ -107,6 +111,10 @@ class ObservableUpdater: ObservableObject {
)
includePrereleaseVersions = UserDefaults.standard.bool(forKey: "includePrereleaseVersions")
}
+
+ func checkForUpdates() {
+ updater.checkForUpdates()
+ }
}
extension URL {
diff --git a/Xcodes/Resources/Licenses.rtf b/Xcodes/Resources/Licenses.rtf
index 4800d6a..68f9b51 100644
--- a/Xcodes/Resources/Licenses.rtf
+++ b/Xcodes/Resources/Licenses.rtf
@@ -402,7 +402,7 @@ bspatch.c and bsdiff.c, from bsdiff 4.3 :\
sais.c and sais.c, from sais-lite (2010/08/07) :\
Copyright (c) 2008-2010 Yuta Mori.\
\
-SUDSAVerifier.m:\
+SUSignatureVerifier.m:\
Copyright (c) 2011 Mark Hamlin.\
\
All rights reserved.\
diff --git a/Xcodes/XcodesApp.swift b/Xcodes/XcodesApp.swift
index cfdb3af..76fb1a3 100644
--- a/Xcodes/XcodesApp.swift
+++ b/Xcodes/XcodesApp.swift
@@ -8,11 +8,13 @@ struct XcodesApp: App {
@SwiftUI.Environment(\.scenePhase) private var scenePhase: ScenePhase
@SwiftUI.Environment(\.openURL) var openURL: OpenURLAction
@StateObject private var appState = AppState()
-
+ @StateObject private var updater = ObservableUpdater()
+
var body: some Scene {
WindowGroup("Xcodes") {
MainWindow()
.environmentObject(appState)
+ .environmentObject(updater)
// This is intentionally used on a View, and not on a WindowGroup,
// so that it's triggered when an individual window's phase changes instead of all window phases.
// When used on a View it's also invoked on launch, which doesn't occur with a WindowGroup.
@@ -32,7 +34,7 @@ struct XcodesApp: App {
}
CommandGroup(after: .appInfo) {
Button("Menu.CheckForUpdates") {
- appDelegate.checkForUpdates()
+ updater.checkForUpdates()
}
}
@@ -69,6 +71,7 @@ struct XcodesApp: App {
Settings {
PreferencesView()
.environmentObject(appState)
+ .environmentObject(updater)
}
#endif
}
@@ -112,13 +115,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
acknowledgementsWindow.makeKeyAndOrderFront(nil)
}
- func checkForUpdates() {
- SUUpdater.shared()?.checkForUpdates(self)
- }
-
func applicationDidFinishLaunching(_ notification: Notification) {
- // Initialize manually
- SUUpdater.shared()
+
}
}