fix: double sparkle update check

This commit is contained in:
edde746
2026-03-09 00:29:58 +01:00
parent 65bb7bd44e
commit 965d9540fa
2 changed files with 7 additions and 4 deletions
+5 -4
View File
@@ -45,12 +45,10 @@ class UpdateService {
/// Call once at startup if [useNativeUpdater] is true.
static Future<void> initNativeUpdater() async {
if (_nativeUpdaterInitialized) return;
_nativeUpdaterInitialized = true;
try {
await autoUpdater.setFeedURL(_feedUrl);
// 6 hours in seconds
await autoUpdater.setScheduledCheckInterval(_checkCooldown.inSeconds);
_nativeUpdaterInitialized = true;
} catch (e) {
_logger.e('Failed to initialize native auto updater: $e');
}
@@ -59,7 +57,10 @@ class UpdateService {
/// Trigger a background update check via Sparkle/WinSparkle.
/// Only shows UI if an update is found.
static Future<void> checkForUpdatesNative({bool inBackground = true}) async {
if (!_nativeUpdaterInitialized) await initNativeUpdater();
if (!_nativeUpdaterInitialized) {
await initNativeUpdater();
if (!_nativeUpdaterInitialized) return;
}
try {
await autoUpdater.checkForUpdates(inBackground: inBackground);
} catch (e) {
+2
View File
@@ -30,6 +30,8 @@
<string>NSApplication</string>
<key>FLTEnableMergedPlatformUIThread</key>
<false/>
<key>SUEnableAutomaticChecks</key>
<false/>
<key>SUFeedURL</key>
<string>https://github.com/edde746/plezy/releases/latest/download/appcast.xml</string>
<key>SUPublicEDKey</key>