[Scummvm-git-logs] scummvm master -> a00172aa08870e29363909759d3eb6fbb63bc59b

sev- noreply at scummvm.org
Fri Oct 4 19:58:38 UTC 2024


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7c7a813fd8 MACOS: Migrate to Sparkle 2 API for updates
a00172aa08 MACOS: Only detect Sparkle >= 2.0 in configure


Commit: 7c7a813fd8ea1cae17cf9ba595be422e24fd9015
    https://github.com/scummvm/scummvm/commit/7c7a813fd8ea1cae17cf9ba595be422e24fd9015
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2024-10-04T21:58:34+02:00

Commit Message:
MACOS: Migrate to Sparkle 2 API for updates

Changed paths:
    backends/updates/macosx/macosx-updates.mm


diff --git a/backends/updates/macosx/macosx-updates.mm b/backends/updates/macosx/macosx-updates.mm
index c8fb23f40ee..a9b747c6a76 100644
--- a/backends/updates/macosx/macosx-updates.mm
+++ b/backends/updates/macosx/macosx-updates.mm
@@ -34,7 +34,7 @@
 
 #include <AvailabilityMacros.h>
 
-SUUpdater *sparkleUpdater;
+SPUStandardUpdaterController *sparkleUpdaterController;
 
 /**
  * Sparkle is a software update framework for macOS which uses appcasts for
@@ -54,7 +54,7 @@ MacOSXUpdateManager::MacOSXUpdateManager() {
 	if (!version || [version isEqualToString:@""]) {
 		warning("Running not in bundle, skipping Sparkle initialization");
 
-		sparkleUpdater = nullptr;
+		sparkleUpdaterController = nullptr;
 		return;
 	}
 
@@ -62,12 +62,7 @@ MacOSXUpdateManager::MacOSXUpdateManager() {
 	NSMenu *applicationMenu = [menuItem submenu];
 
 	// Init Sparkle
-	sparkleUpdater = [SUUpdater sharedUpdater];
-
-	NSString* feedbackURL = [mainBundle objectForInfoDictionaryKey:@"SUFeedURL"];
-
-	// Set appcast URL
-	[sparkleUpdater setFeedURL:[NSURL URLWithString:feedbackURL]];
+	sparkleUpdaterController = [[SPUStandardUpdaterController alloc] initWithUpdaterDelegate:nil userDriverDelegate:nil];
 
 	// Add "Check for Updates..." menu item
 	CFStringRef title = CFStringCreateWithCString(NULL, _("Check for Updates...").encode().c_str(), kCFStringEncodingUTF8);
@@ -75,7 +70,7 @@ MacOSXUpdateManager::MacOSXUpdateManager() {
 	CFRelease(title);
 
 	// Set the target of the new menu item
-	[updateMenuItem setTarget:sparkleUpdater];
+	[updateMenuItem setTarget:sparkleUpdaterController];
 
 	if (!ConfMan.hasKey("updates_check")
 			|| ConfMan.getInt("updates_check") == Common::UpdateManager::kUpdateIntervalNotSupported) {
@@ -87,38 +82,38 @@ MacOSXUpdateManager::MacOSXUpdateManager() {
 }
 
 MacOSXUpdateManager::~MacOSXUpdateManager() {
-	[sparkleUpdater release];
+	[sparkleUpdaterController release];
 }
 
 void MacOSXUpdateManager::checkForUpdates() {
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return;
 
-	[sparkleUpdater checkForUpdates:nil];
+	[sparkleUpdaterController checkForUpdates:nil];
 }
 
 void MacOSXUpdateManager::setAutomaticallyChecksForUpdates(UpdateManager::UpdateState state) {
 	if (state == kUpdateStateNotSupported)
 		return;
 
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return;
 
-	[sparkleUpdater setAutomaticallyChecksForUpdates:(state == kUpdateStateEnabled ? YES : NO)];
+	[[sparkleUpdaterController updater] setAutomaticallyChecksForUpdates:(state == kUpdateStateEnabled ? YES : NO)];
 }
 
 Common::UpdateManager::UpdateState MacOSXUpdateManager::getAutomaticallyChecksForUpdates() {
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return kUpdateStateDisabled;
 
-	if ([sparkleUpdater automaticallyChecksForUpdates])
+	if ([[sparkleUpdaterController updater] automaticallyChecksForUpdates])
 		return kUpdateStateEnabled;
 	else
 		return kUpdateStateDisabled;
 }
 
 void MacOSXUpdateManager::setUpdateCheckInterval(int interval) {
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return;
 
 	if (interval == kUpdateIntervalNotSupported)
@@ -126,18 +121,18 @@ void MacOSXUpdateManager::setUpdateCheckInterval(int interval) {
 
 	interval = normalizeInterval(interval);
 
-	[sparkleUpdater setUpdateCheckInterval:(NSTimeInterval)interval];
+	[[sparkleUpdaterController updater] setUpdateCheckInterval:(NSTimeInterval)interval];
 }
 
 int MacOSXUpdateManager::getUpdateCheckInterval() {
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return kUpdateIntervalOneDay;
 
 	// This is kind of a hack but necessary, as the value stored by Sparkle
 	// might have been changed outside of ScummVM (in which case we return the
 	// default interval of one day)
 
-	UpdateInterval updateInterval = (UpdateInterval)[sparkleUpdater updateCheckInterval];
+	UpdateInterval updateInterval = (UpdateInterval)[[sparkleUpdaterController updater] updateCheckInterval];
 	switch (updateInterval) {
 	case kUpdateIntervalOneDay:
 	case kUpdateIntervalOneWeek:
@@ -151,10 +146,10 @@ int MacOSXUpdateManager::getUpdateCheckInterval() {
 }
 
 bool MacOSXUpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
-	if (sparkleUpdater == nullptr)
+	if (sparkleUpdaterController == nullptr)
 		return false;
 
-	NSDate *date = [sparkleUpdater lastUpdateCheckDate];
+	NSDate *date = [[sparkleUpdaterController updater] lastUpdateCheckDate];
 #ifdef MAC_OS_X_VERSION_10_10
 	NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
 	NSDateComponents *components = [gregorian components:(NSCalendarUnitDay | NSCalendarUnitWeekday) fromDate:date];


Commit: a00172aa08870e29363909759d3eb6fbb63bc59b
    https://github.com/scummvm/scummvm/commit/a00172aa08870e29363909759d3eb6fbb63bc59b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2024-10-04T21:58:34+02:00

Commit Message:
MACOS: Only detect Sparkle >= 2.0 in configure

Changed paths:
    configure


diff --git a/configure b/configure
index f8284cda550..055d80e1cb1 100755
--- a/configure
+++ b/configure
@@ -5544,7 +5544,7 @@ echo "$_a52"
 #
 case $_host_os in
 	darwin*)
-		echocheck "Sparkle"
+		echocheck "Sparkle >= 2.0"
 		if test "$_updates" = no; then
 			_sparkle=no
 		else
@@ -5558,7 +5558,7 @@ case $_host_os in
 				cat > $TMPC << EOF
 #include <Cocoa/Cocoa.h>
 #include <Sparkle/Sparkle.h>
-int main(void) { SUUpdater *updater = [SUUpdater sharedUpdater]; return 0; }
+int main(void) { SPUStandardUpdaterController *updater = [[SPUStandardUpdaterController alloc] initWithUpdaterDelegate:nil userDriverDelegate:nil]; return 0; }
 EOF
 				cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -framework Sparkle -ObjC++ -lobjc && _sparkle=yes
 			fi




More information about the Scummvm-git-logs mailing list