Skip to content

Commit

Permalink
Rewrite SPUResumableUpdate protocol and SPUInformationalUpdate cl…
Browse files Browse the repository at this point in the history
…ass to Swift
  • Loading branch information
jozefizso committed Oct 13, 2023
1 parent e827e46 commit 8d362a8
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 7 deletions.
40 changes: 36 additions & 4 deletions Sparkle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */; settings = {ATTRIBUTES = (); }; };
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; };
643A7B5E2AD9B713004A267C /* SPUInformationalUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 643A7B5D2AD9B713004A267C /* SPUInformationalUpdate.swift */; };
643A7B612AD9BA6D004A267C /* SPUResumableUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 643A7B602AD9BA6D004A267C /* SPUResumableUpdate.swift */; };
654F352529B1548700B10EEB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
654F352729B154AE00B10EEB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 654F352629B154AE00B10EEB /* ImageIO.framework */; };
654F352829B154B500B10EEB /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55C14F31136EFC2400649790 /* SystemConfiguration.framework */; };
Expand Down Expand Up @@ -371,8 +373,6 @@
72AEB1D929A1CB510033883E /* SPUNoUpdateFoundInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72AEB1D729A1CB510033883E /* SPUNoUpdateFoundInfo.m */; };
72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DEC71E23472200457642 /* SPUDownloadedUpdate.h */; };
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3DEC81E23472200457642 /* SPUDownloadedUpdate.m */; };
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DECB1E23479000457642 /* SPUInformationalUpdate.h */; };
72B3DECF1E23479000457642 /* SPUInformationalUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3DECC1E23479000457642 /* SPUInformationalUpdate.m */; };
72B767CA1C9B707000A07552 /* SUAppcastDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767C81C9B707000A07552 /* SUAppcastDriver.h */; };
72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767C91C9B707000A07552 /* SUAppcastDriver.m */; };
72B767CE1C9B924900A07552 /* SPUInstallerDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B767CC1C9B924900A07552 /* SPUInstallerDriver.h */; };
Expand Down Expand Up @@ -1018,6 +1018,9 @@
61EF67580E25C5B400F754E0 /* SUHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUHost.h; sourceTree = "<group>"; };
61F3AC1215C22D4A00260CA2 /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Sparkle.strings; sourceTree = "<group>"; };
61F614540E24A12D009F47E7 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Sparkle.strings; sourceTree = "<group>"; };
643A7B5D2AD9B713004A267C /* SPUInformationalUpdate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPUInformationalUpdate.swift; sourceTree = "<group>"; };
643A7B5F2AD9B915004A267C /* Sparkle-BridgingHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Sparkle-BridgingHeader.h"; sourceTree = "<group>"; };
643A7B602AD9BA6D004A267C /* SPUResumableUpdate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPUResumableUpdate.swift; sourceTree = "<group>"; };
654F352629B154AE00B10EEB /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_phasedRollout.xml; sourceTree = "<group>"; };
72045CE426FEE708004F96E5 /* strip-framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "strip-framework.sh"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1820,6 +1823,7 @@
isa = PBXGroup;
children = (
720767D11E2EB86200F9A850 /* AppKitPrevention.h */,
643A7B5F2AD9B915004A267C /* Sparkle-BridgingHeader.h */,
61299B3909CB055000B7442F /* Appcast Support */,
55C14BD5136EEFD000649790 /* Autoupdate */,
72F9EBE41D519425004AC8B6 /* Deprecated */,
Expand Down Expand Up @@ -2112,10 +2116,12 @@
7229E1BB1C98EFF200CB50D0 /* SPUDownloadDriver.h */,
7229E1BC1C98EFF200CB50D0 /* SPUDownloadDriver.m */,
7267E5FB1D3DD1B700D1BF90 /* SPUResumableUpdate.h */,
643A7B602AD9BA6D004A267C /* SPUResumableUpdate.swift */,
72B3DEC71E23472200457642 /* SPUDownloadedUpdate.h */,
72B3DEC81E23472200457642 /* SPUDownloadedUpdate.m */,
72B3DECB1E23479000457642 /* SPUInformationalUpdate.h */,
72B3DECC1E23479000457642 /* SPUInformationalUpdate.m */,
643A7B5D2AD9B713004A267C /* SPUInformationalUpdate.swift */,
72B767CC1C9B924900A07552 /* SPUInstallerDriver.h */,
72B767CD1C9B924900A07552 /* SPUInstallerDriver.m */,
728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */,
Expand Down Expand Up @@ -2570,7 +2576,6 @@
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */,
723ABF1B259D055E00BDB4FA /* SUReleaseNotesView.h in Headers */,
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */,
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */,
6196CFF909C72148000DC222 /* SUStatusController.h in Headers */,
Expand Down Expand Up @@ -3040,6 +3045,9 @@
895C5DC024D78E210058A82D = {
CreatedOnToolsVersion = 12.0;
};
8DC2EF4F0486A6940098B216 = {
LastSwiftMigration = 1500;
};
EA1E280E22B64522004AA304 = {
CreatedOnToolsVersion = 10.2.1;
};
Expand Down Expand Up @@ -3606,7 +3614,6 @@
72EF30BF2675CF38008CE987 /* SPUAppcastItemState.m in Sources */,
721BC20F1D1CDE55002BC71E /* SPULocalCacheDirectory.m in Sources */,
7267E5B21D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */,
72B3DECF1E23479000457642 /* SPUInformationalUpdate.m in Sources */,
728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */,
72B767D31C9C7B9300A07552 /* SPUProbingUpdateDriver.m in Sources */,
7229E1BA1C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m in Sources */,
Expand Down Expand Up @@ -3635,8 +3642,10 @@
72DBA37F1D62C23E002594A8 /* SUCodeSigningVerifier.m in Sources */,
61299A6009CA6EB100B7442F /* SUConstants.m in Sources */,
7267E5E61D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
643A7B612AD9BA6D004A267C /* SPUResumableUpdate.swift in Sources */,
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */,
724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */,
643A7B5E2AD9B713004A267C /* SPUInformationalUpdate.swift in Sources */,
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */,
724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */,
55C14F07136EF6DB00649790 /* SULog.m in Sources */,
Expand Down Expand Up @@ -4119,20 +4128,27 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Coverage;
};
149B785C1B7D398100D7D62C /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Coverage;
};
149B785D1B7D398100D7D62C /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Coverage;
};
Expand All @@ -4159,13 +4175,22 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
1DEB91AF08733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down Expand Up @@ -4201,27 +4226,31 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7205C46C1E13244800E370AE /* ConfigUnitTestDebug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Debug;
};
612279DC0DB5470300AB99EA /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7205C46D1E13245600E370AE /* ConfigUnitTestRelease.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Release;
};
61B5F90609C4CEE300B25A18 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Debug;
};
61B5F90709C4CEE300B25A18 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
};
name = Release;
};
Expand Down Expand Up @@ -4421,6 +4450,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
};
name = Debug;
Expand All @@ -4429,6 +4459,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
};
name = Coverage;
Expand All @@ -4437,6 +4468,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ANALYZER_NONNULL = YES;
};
name = Release;
Expand Down
5 changes: 3 additions & 2 deletions Sparkle/SPUCoreBasedUpdateDriver.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2016 Sparkle Project. All rights reserved.
//

#import "Sparkle/Sparkle-Swift.h"
#import "SPUCoreBasedUpdateDriver.h"
#import "SUHost.h"
#import "SPUUpdaterDelegate.h"
Expand All @@ -15,9 +16,9 @@
#import "SULog.h"
#import "SULog+NSError.h"
#import "SUErrors.h"
#import "SPUResumableUpdate.h"
// #import "SPUResumableUpdate.h"
#import "SPUDownloadedUpdate.h"
#import "SPUInformationalUpdate.h"
// #import "SPUInformationalUpdate.h"
#import "SUAppcastItem.h"
#import "SULocalizations.h"
#import "SPUInstallationType.h"
Expand Down
3 changes: 2 additions & 1 deletion Sparkle/SPUDownloadedUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
//

#import <Foundation/Foundation.h>
#import "SPUResumableUpdate.h"
#import "Sparkle/Sparkle-Swift.h"
// #import "SPUResumableUpdate.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
20 changes: 20 additions & 0 deletions Sparkle/SPUInformationalUpdate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// SPUInformationalUpdate.swift
// Sparkle
//
// Created by Jozef Izso on 13.10.2023.
// Copyright © 2023 Cisco Systems, Inc. All rights reserved.
//

import Foundation

public class SPUInformationalUpdate: NSObject, SPUResumableUpdate {
public let updateItem: SUAppcastItem
public let secondaryUpdateItem: SUAppcastItem?

@objc
public init(appcastItem updateItem: SUAppcastItem, secondaryAppcastItem secondaryUpdateItem: SUAppcastItem?) {
self.updateItem = updateItem
self.secondaryUpdateItem = secondaryUpdateItem
}
}
15 changes: 15 additions & 0 deletions Sparkle/SPUResumableUpdate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// SPUResumableUpdate.swift
// Sparkle
//
// Created by Jozef Izso on 13.10.2023.
// Copyright © 2023 Sparkle Project. All rights reserved.
//

import Foundation

@objc
public protocol SPUResumableUpdate {
var updateItem: SUAppcastItem { get }
var secondaryUpdateItem: SUAppcastItem? { get }
}
15 changes: 15 additions & 0 deletions Sparkle/Sparkle-BridgingHeader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Sparkle-BridgingHeader.h
// Sparkle
//
// Created by Jozef Izso on 13.10.2023.
// Copyright © 2023 Sparkle Project. All rights reserved.
//

#ifndef Sparkle_BridgingHeader_h
#define Sparkle_BridgingHeader_h

#import "Sparkle/SPUResumableUpdate.h"


#endif /* Sparkle_BridgingHeader_h */

0 comments on commit 8d362a8

Please sign in to comment.