Skip to content

Commit e973efe

Browse files
add Sparkle
1 parent 447214d commit e973efe

File tree

6 files changed

+233
-13
lines changed

6 files changed

+233
-13
lines changed

Cheetah.xcodeproj/project.pbxproj

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
37AE7AC629A6E9C400C45FF6 /* stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AE7AC529A6E9C400C45FF6 /* stream.cpp */; };
3636
37AE7AC929A6F7F200C45FF6 /* stream.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AC729A6EC2F00C45FF6 /* stream.h */; settings = {ATTRIBUTES = (Public, ); }; };
3737
37AE7ACA29A70CE900C45FF6 /* whisper.h in Headers */ = {isa = PBXBuildFile; fileRef = 37AE7AB129A5AAD400C45FF6 /* whisper.h */; };
38+
37B2997D29F9756F00971690 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 37B2997C29F9756F00971690 /* Sparkle */; };
39+
37B2997F29F9757700971690 /* Sparkle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B2997E29F9757700971690 /* Sparkle.swift */; };
3840
37B3A50629CE15AC0029821F /* OpenAIEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */; };
3941
37B3A50729CE15AC0029821F /* OpenAISwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */; };
4042
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B3A51629CE16330029821F /* ImageGeneration.swift */; };
@@ -166,6 +168,7 @@
166168
37AE7ABF29A6E96A00C45FF6 /* common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.cpp; path = ../../whisper.cpp/examples/common.cpp; sourceTree = "<group>"; };
167169
37AE7AC529A6E9C400C45FF6 /* stream.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream.cpp; sourceTree = "<group>"; };
168170
37AE7AC729A6EC2F00C45FF6 /* stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream.h; sourceTree = "<group>"; };
171+
37B2997E29F9757700971690 /* Sparkle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sparkle.swift; sourceTree = "<group>"; };
169172
37B3A4FD29CE15AC0029821F /* OpenAIEndpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAIEndpoint.swift; sourceTree = "<group>"; };
170173
37B3A4FE29CE15AC0029821F /* OpenAISwift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAISwift.swift; sourceTree = "<group>"; };
171174
37B3A51629CE16330029821F /* ImageGeneration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageGeneration.swift; sourceTree = "<group>"; };
@@ -198,6 +201,7 @@
198201
isa = PBXFrameworksBuildPhase;
199202
buildActionMask = 2147483647;
200203
files = (
204+
37B2997D29F9756F00971690 /* Sparkle in Frameworks */,
201205
37B4C27729BD7D9F00E83465 /* CheetahIPC.framework in Frameworks */,
202206
37AE7A9529A5A9C200C45FF6 /* LibWhisper.framework in Frameworks */,
203207
);
@@ -273,6 +277,7 @@
273277
376437B929A854F500297AC6 /* ConversationAnalyzer.swift */,
274278
37951C0D29BCD71000C61AC5 /* ModelDownloader.swift */,
275279
37B4C27929BD9F8700E83465 /* BrowserExtension.swift */,
280+
37B2997E29F9757700971690 /* Sparkle.swift */,
276281
37AE7A7629A5A8B400C45FF6 /* Assets.xcassets */,
277282
37AE7A7B29A5A8B400C45FF6 /* Cheetah.entitlements */,
278283
37AE7A7829A5A8B400C45FF6 /* Preview Content */,
@@ -429,6 +434,7 @@
429434
);
430435
name = Cheetah;
431436
packageProductDependencies = (
437+
37B2997C29F9756F00971690 /* Sparkle */,
432438
);
433439
productName = Cheetah;
434440
productReference = 37AE7A6F29A5A8B300C45FF6 /* Cheetah.app */;
@@ -506,6 +512,7 @@
506512
);
507513
mainGroup = 37AE7A6629A5A8B300C45FF6;
508514
packageReferences = (
515+
37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */,
509516
);
510517
productRefGroup = 37AE7A7029A5A8B300C45FF6 /* Products */;
511518
projectDirPath = "";
@@ -568,6 +575,7 @@
568575
37951C0E29BCD71000C61AC5 /* ModelDownloader.swift in Sources */,
569576
37AE7A7529A5A8B300C45FF6 /* ContentView.swift in Sources */,
570577
37B3A51C29CE16330029821F /* ImageGeneration.swift in Sources */,
578+
37B2997F29F9757700971690 /* Sparkle.swift in Sources */,
571579
37B3A51E29CE16330029821F /* Command.swift in Sources */,
572580
376437BA29A854F500297AC6 /* ConversationAnalyzer.swift in Sources */,
573581
37B4C27D29C1202C00E83465 /* NSTextFieldWrapper.swift in Sources */,
@@ -635,7 +643,7 @@
635643
buildSettings = {
636644
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
637645
CODE_SIGN_STYLE = Automatic;
638-
DEVELOPMENT_TEAM = 5JL49Y835V;
646+
DEVELOPMENT_TEAM = "";
639647
ENABLE_HARDENED_RUNTIME = NO;
640648
LD_RUNPATH_SEARCH_PATHS = (
641649
"$(inherited)",
@@ -651,7 +659,7 @@
651659
buildSettings = {
652660
CODE_SIGN_ENTITLEMENTS = ExtensionHelper/ExtensionHelper.entitlements;
653661
CODE_SIGN_STYLE = Automatic;
654-
DEVELOPMENT_TEAM = 5JL49Y835V;
662+
DEVELOPMENT_TEAM = "";
655663
ENABLE_HARDENED_RUNTIME = NO;
656664
LD_RUNPATH_SEARCH_PATHS = (
657665
"$(inherited)",
@@ -786,9 +794,9 @@
786794
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
787795
CODE_SIGN_STYLE = Automatic;
788796
COMBINE_HIDPI_IMAGES = YES;
789-
CURRENT_PROJECT_VERSION = 3;
797+
CURRENT_PROJECT_VERSION = 4;
790798
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
791-
DEVELOPMENT_TEAM = 5JL49Y835V;
799+
DEVELOPMENT_TEAM = "";
792800
ENABLE_HARDENED_RUNTIME = NO;
793801
ENABLE_PREVIEWS = YES;
794802
GENERATE_INFOPLIST_FILE = YES;
@@ -799,7 +807,7 @@
799807
"$(inherited)",
800808
"@executable_path/../Frameworks",
801809
);
802-
MARKETING_VERSION = 1.2;
810+
MARKETING_VERSION = 1.3;
803811
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
804812
PRODUCT_NAME = "$(TARGET_NAME)";
805813
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -816,9 +824,9 @@
816824
CODE_SIGN_ENTITLEMENTS = Cheetah/Cheetah.entitlements;
817825
CODE_SIGN_STYLE = Automatic;
818826
COMBINE_HIDPI_IMAGES = YES;
819-
CURRENT_PROJECT_VERSION = 3;
827+
CURRENT_PROJECT_VERSION = 4;
820828
DEVELOPMENT_ASSET_PATHS = "\"Cheetah/Preview Content\"";
821-
DEVELOPMENT_TEAM = 5JL49Y835V;
829+
DEVELOPMENT_TEAM = "";
822830
ENABLE_HARDENED_RUNTIME = NO;
823831
ENABLE_PREVIEWS = YES;
824832
GENERATE_INFOPLIST_FILE = YES;
@@ -829,7 +837,7 @@
829837
"$(inherited)",
830838
"@executable_path/../Frameworks",
831839
);
832-
MARKETING_VERSION = 1.2;
840+
MARKETING_VERSION = 1.3;
833841
PRODUCT_BUNDLE_IDENTIFIER = org.phrack.Cheetah;
834842
PRODUCT_NAME = "$(TARGET_NAME)";
835843
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -845,7 +853,7 @@
845853
COMBINE_HIDPI_IMAGES = YES;
846854
CURRENT_PROJECT_VERSION = 1;
847855
DEFINES_MODULE = YES;
848-
DEVELOPMENT_TEAM = 5JL49Y835V;
856+
DEVELOPMENT_TEAM = "";
849857
DYLIB_COMPATIBILITY_VERSION = 1;
850858
DYLIB_CURRENT_VERSION = 1;
851859
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -886,7 +894,7 @@
886894
COMBINE_HIDPI_IMAGES = YES;
887895
CURRENT_PROJECT_VERSION = 1;
888896
DEFINES_MODULE = YES;
889-
DEVELOPMENT_TEAM = 5JL49Y835V;
897+
DEVELOPMENT_TEAM = "";
890898
DYLIB_COMPATIBILITY_VERSION = 1;
891899
DYLIB_CURRENT_VERSION = 1;
892900
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -926,7 +934,7 @@
926934
COMBINE_HIDPI_IMAGES = YES;
927935
CURRENT_PROJECT_VERSION = 1;
928936
DEFINES_MODULE = YES;
929-
DEVELOPMENT_TEAM = 5JL49Y835V;
937+
DEVELOPMENT_TEAM = "";
930938
DYLIB_COMPATIBILITY_VERSION = 1;
931939
DYLIB_CURRENT_VERSION = 1;
932940
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -958,7 +966,7 @@
958966
COMBINE_HIDPI_IMAGES = YES;
959967
CURRENT_PROJECT_VERSION = 1;
960968
DEFINES_MODULE = YES;
961-
DEVELOPMENT_TEAM = 5JL49Y835V;
969+
DEVELOPMENT_TEAM = "";
962970
DYLIB_COMPATIBILITY_VERSION = 1;
963971
DYLIB_CURRENT_VERSION = 1;
964972
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1030,6 +1038,25 @@
10301038
defaultConfigurationName = Release;
10311039
};
10321040
/* End XCConfigurationList section */
1041+
1042+
/* Begin XCRemoteSwiftPackageReference section */
1043+
37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
1044+
isa = XCRemoteSwiftPackageReference;
1045+
repositoryURL = "https://github.com/sparkle-project/Sparkle";
1046+
requirement = {
1047+
kind = upToNextMajorVersion;
1048+
minimumVersion = 2.0.0;
1049+
};
1050+
};
1051+
/* End XCRemoteSwiftPackageReference section */
1052+
1053+
/* Begin XCSwiftPackageProductDependency section */
1054+
37B2997C29F9756F00971690 /* Sparkle */ = {
1055+
isa = XCSwiftPackageProductDependency;
1056+
package = 37B2997B29F9756F00971690 /* XCRemoteSwiftPackageReference "Sparkle" */;
1057+
productName = Sparkle;
1058+
};
1059+
/* End XCSwiftPackageProductDependency section */
10331060
};
10341061
rootObject = 37AE7A6729A5A8B300C45FF6 /* Project object */;
10351062
}

Cheetah.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cheetah/CheetahApp.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import SwiftUI
22
import Combine
33
import LibWhisper
44
import CheetahIPC
5+
import Sparkle
56

67
enum AnswerRequest {
78
case none
@@ -45,6 +46,8 @@ struct CheetahApp: App {
4546

4647
var extensionState = BrowserExtensionState()
4748

49+
let updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
50+
4851
func start() async {
4952
viewModel.devices = try! CaptureDevice.devices
5053

@@ -118,6 +121,9 @@ struct CheetahApp: App {
118121
.windowResizability(.contentSize)
119122
.windowStyle(.hiddenTitleBar)
120123
.commands {
124+
CommandGroup(after: .appInfo) {
125+
CheckForUpdatesView(updater: updaterController.updater)
126+
}
121127
CommandGroup(replacing: .appSettings) {
122128
Button(action: {
123129
viewModel.authToken = nil

Cheetah/Info.plist

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict/>
4+
<dict>
5+
<key>SUFeedURL</key>
6+
<string>https://cheetah-sw-update.leetcodemafia.com/appcast.xml</string>
7+
<key>SUPublicEDKey</key>
8+
<string>30J/+sJRxhziFhK63Xe6OY5kjwF5tG7klmntA0XIGNM=</string>
9+
<key>SUEnableSystemProfiling</key>
10+
<true/>
11+
</dict>
512
</plist>

Cheetah/Sparkle.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import SwiftUI
2+
import Sparkle
3+
4+
// This view model class publishes when new updates can be checked by the user
5+
final class CheckForUpdatesViewModel: ObservableObject {
6+
@Published var canCheckForUpdates = false
7+
8+
init(updater: SPUUpdater) {
9+
updater.publisher(for: \.canCheckForUpdates)
10+
.assign(to: &$canCheckForUpdates)
11+
}
12+
}
13+
14+
// This is the view for the Check for Updates menu item
15+
// Note this intermediate view is necessary for the disabled state on the menu item to work properly before Monterey.
16+
// See https://stackoverflow.com/questions/68553092/menu-not-updating-swiftui-bug for more info
17+
struct CheckForUpdatesView: View {
18+
@ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
19+
private let updater: SPUUpdater
20+
21+
init(updater: SPUUpdater) {
22+
self.updater = updater
23+
24+
// Create our view model for our CheckForUpdatesView
25+
self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
26+
}
27+
28+
var body: some View {
29+
Button("Check for Updates…", action: updater.checkForUpdates)
30+
.disabled(!checkForUpdatesViewModel.canCheckForUpdates)
31+
}
32+
}

0 commit comments

Comments
 (0)