From a2601dc7161cbcd14b398b20ab18c7da153d06c2 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 2 Sep 2022 15:33:05 -0700 Subject: [PATCH] Expose -[SPUStandardUserDriver activeUpdateAlert] as private API --- Sparkle.xcodeproj/project.pbxproj | 4 ++++ Sparkle/SPUStandardUserDriver+Private.h | 31 +++++++++++++++++++++++++ Sparkle/SPUStandardUserDriver.m | 1 + 3 files changed, 36 insertions(+) create mode 100644 Sparkle/SPUStandardUserDriver+Private.h diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 94eae5575a..ba6e07664e 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -377,6 +377,7 @@ 72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */; }; 72BEBFEF1D7287570019146B /* SUSpotlightImporterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */; }; 72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */; }; + 72D60CD928C2BAE900189AB8 /* SPUStandardUserDriver+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */; }; 72D954831CBAD34F006F28BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954821CBAD34F006F28BD /* main.m */; }; 72D954A21CBB415C006F28BD /* SPUCommandLineDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954A11CBB415C006F28BD /* SPUCommandLineDriver.m */; }; @@ -1356,6 +1357,7 @@ 72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSign_apfs.dmg; sourceTree = ""; }; 72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUSpotlightImporterTest.swift; sourceTree = ""; }; 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_header.zip; sourceTree = ""; }; + 72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUStandardUserDriver+Private.h"; sourceTree = ""; }; 72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressAppController.h; path = Sparkle/InstallerProgress/InstallerProgressAppController.h; sourceTree = SOURCE_ROOT; }; 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressAppController.m; path = Sparkle/InstallerProgress/InstallerProgressAppController.m; sourceTree = SOURCE_ROOT; }; 72D954821CBAD34F006F28BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sparkle/InstallerProgress/main.m; sourceTree = SOURCE_ROOT; }; @@ -2205,6 +2207,7 @@ 7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */, 7246E0A21C83B685003B4E75 /* SPUStandardUpdaterController.m */, 725CB9581C7121830064365A /* SPUStandardUserDriver.h */, + 72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */, 725CB9591C7121830064365A /* SPUStandardUserDriver.m */, 726E4A361C89116000C57C6A /* SPUStandardUserDriverDelegate.h */, 722C9538286EA54A0033908A /* SPUGentleUserDriverReminders.h */, @@ -2482,6 +2485,7 @@ 7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */, 725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */, 726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */, + 72D60CD928C2BAE900189AB8 /* SPUStandardUserDriver+Private.h in Headers */, 722C9539286EA68C0033908A /* SPUGentleUserDriverReminders.h in Headers */, 729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */, 72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */, diff --git a/Sparkle/SPUStandardUserDriver+Private.h b/Sparkle/SPUStandardUserDriver+Private.h new file mode 100644 index 0000000000..877cadf2b3 --- /dev/null +++ b/Sparkle/SPUStandardUserDriver+Private.h @@ -0,0 +1,31 @@ +// +// SPUStandardUserDriver+Private.h +// Sparkle +// +// Copyright © 2022 Sparkle Project. All rights reserved. +// + +#ifndef SPUStandardUserDriver_Private_h +#define SPUStandardUserDriver_Private_h + +#import +#import + +@class NSWindowController; + +NS_ASSUME_NONNULL_BEGIN + +SU_EXPORT @interface SPUStandardUserDriver (Private) + +/** + Private API for accessing the active update alert's window controller. + This is the window controller that shows the update's release notes and install choices. + This can be accessed in -[SPUStandardUserDriverDelegate standardUserDriverWillHandleShowingUpdate:forUpdate:state:] + */ +@property (nonatomic, readonly, nullable) NSWindowController *activeUpdateAlert; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* SPUStandardUserDriver_Private_h */ diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index e0c0ba507a..e424093a1b 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -48,6 +48,7 @@ @interface SPUStandardUserDriver () @property (nonatomic, copy) void (^cancellation)(void); @property (nonatomic) SUStatusController *checkingController; +// Note: we expose a private interface for activeUpdateAlert in SPUStandardUserDriver+Private.h as NSWindowController @property (nonatomic) SUUpdateAlert *activeUpdateAlert; @property (nonatomic) SUStatusController *statusController; @property (nonatomic) SUUpdatePermissionPrompt *permissionPrompt;