Skip to content

Commit

Permalink
Update SetApp SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Jul 30, 2022
1 parent dad4a05 commit 0583507
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 604 deletions.
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ test:
build:
xcodebuild -project "Pareto Security.xcodeproj" -clonedSourcePackagesDirPath SourcePackages -scheme "Pareto Security" -configuration Debug -destination platform=macOS build

libSetapp:
wget "https://developer-api.setapp.com/v1/applications/496/kevlar?token=${SETAPP_TOKEN}&type=libsetapp_silicon" -O libsetapp.zip
unzip libsetapp.zip
rm libsetapp.zip

archive-debug:
xcodebuild -project "Pareto Security.xcodeproj" -clonedSourcePackagesDirPath SourcePackages -scheme "Pareto Security" -destination platform=macOS archive -archivePath app.xcarchive -configuration Debug -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath app.xcarchive -exportPath Export -exportOptionsPlist exportOptionsDev.plist

archive-debug-setapp: libSetapp
archive-debug-setapp:
xcodebuild -project "Pareto Security.xcodeproj" -clonedSourcePackagesDirPath SourcePackages -scheme "Pareto Security SetApp" -destination platform=macOS archive -archivePath setapp.xcarchive -configuration Debug -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath setapp.xcarchive -exportPath SetAppExport -exportOptionsPlist exportOptionsDev.plist
mv SetAppExport/Pareto\ Security\ SetApp.app SetAppExport/Pareto\ Security.app
Expand All @@ -24,7 +19,7 @@ archive-release:
xcodebuild -exportArchive -archivePath app.xcarchive -exportPath Export -exportOptionsPlist exportOptions.plist


archive-release-setapp: libSetapp
archive-release-setapp:
rm -rf SetAppExport
xcodebuild -project "Pareto Security.xcodeproj" -clonedSourcePackagesDirPath SourcePackages -scheme "Pareto Security SetApp" -destination platform=macOS archive -archivePath setapp.xcarchive -configuration Release -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath setapp.xcarchive -exportPath SetAppExport -exportOptionsPlist exportOptions.plist
Expand Down
55 changes: 25 additions & 30 deletions Pareto Security.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@
4F7739F7271EBC2F008B1584 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 4F7739F6271EBC2F008B1584 /* Sentry */; };
4F79F78D273BF6300082A5EB /* ChecksView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F79F78C273BF6300082A5EB /* ChecksView.swift */; };
4F79F78E273BF6300082A5EB /* ChecksView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F79F78C273BF6300082A5EB /* ChecksView.swift */; };
4F7F3E7D27C4E545003A035D /* AppProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F7F3E7C27C4E545003A035D /* AppProtocol.swift */; };
4F7F3E7E27C4E545003A035D /* AppProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F7F3E7C27C4E545003A035D /* AppProtocol.swift */; };
4F81C10826EB5D270065F548 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F81C10726EB5D270065F548 /* URL.swift */; };
4F84531026D634E5007C3B04 /* NSWorkspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F84530F26D634E5007C3B04 /* NSWorkspace.swift */; };
4F84531226D638C0007C3B04 /* NSBackgroundActivityScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F84531126D638C0007C3B04 /* NSBackgroundActivityScheduler.swift */; };
Expand Down Expand Up @@ -201,6 +199,8 @@
4F9982FD281FC46600C5F54F /* Defaults+Workaround.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F9982FB281FC46600C5F54F /* Defaults+Workaround.swift */; };
4FAAD326277B156200AA5CEF /* NewsletterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FAAD325277B156200AA5CEF /* NewsletterView.swift */; };
4FAAD327277B156200AA5CEF /* NewsletterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FAAD325277B156200AA5CEF /* NewsletterView.swift */; };
4FAF5BBF2895573F004E9615 /* setappPublicKey.pem in Resources */ = {isa = PBXBuildFile; fileRef = 4FAF5BBE2895573F004E9615 /* setappPublicKey.pem */; };
4FAF5BC22895583A004E9615 /* Setapp in Frameworks */ = {isa = PBXBuildFile; productRef = 4FAF5BC12895583A004E9615 /* Setapp */; };
4FB0416126F71CC0003657BE /* ButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB0416026F71CC0003657BE /* ButtonStyle.swift */; };
4FB51A5727A94457003F528E /* SecurityUpdateCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB51A5627A94457003F528E /* SecurityUpdateCheck.swift */; };
4FB51A5827A94457003F528E /* SecurityUpdateCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB51A5627A94457003F528E /* SecurityUpdateCheck.swift */; };
Expand Down Expand Up @@ -260,7 +260,6 @@
/* Begin PBXFileReference section */
4F020DDE2853503400D8D4E9 /* DebugView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugView.swift; sourceTree = "<group>"; };
4F0371BB26CD00B700B35E43 /* Boot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Boot.swift; sourceTree = "<group>"; };
4F04C278273E9CC400AD635F /* setapp-bridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "setapp-bridge.h"; path = "libSetapp/setapp-bridge.h"; sourceTree = SOURCE_ROOT; };
4F0BD11E284891670098316A /* ClipButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClipButton.swift; sourceTree = "<group>"; };
4F103007269EE135008C1E86 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
4F14487326D8EA5E00A5BA34 /* Updater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Updater.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -329,7 +328,6 @@
4F74B7D4275114EA00F1FC11 /* Dashlane.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Dashlane.swift; path = "Software Updates/Dashlane.swift"; sourceTree = "<group>"; };
4F74B7D5275114EA00F1FC11 /* Enpass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Enpass.swift; path = "Software Updates/Enpass.swift"; sourceTree = "<group>"; };
4F79F78C273BF6300082A5EB /* ChecksView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChecksView.swift; sourceTree = "<group>"; };
4F7F3E7C27C4E545003A035D /* AppProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppProtocol.swift; sourceTree = "<group>"; };
4F81C10726EB5D270065F548 /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = "<group>"; };
4F84530F26D634E5007C3B04 /* NSWorkspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSWorkspace.swift; sourceTree = "<group>"; };
4F84531126D638C0007C3B04 /* NSBackgroundActivityScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSBackgroundActivityScheduler.swift; sourceTree = "<group>"; };
Expand All @@ -347,6 +345,7 @@
4F9791C026F5DB4F00E668F4 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
4F9982FB281FC46600C5F54F /* Defaults+Workaround.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Defaults+Workaround.swift"; sourceTree = "<group>"; };
4FAAD325277B156200AA5CEF /* NewsletterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsletterView.swift; sourceTree = "<group>"; };
4FAF5BBE2895573F004E9615 /* setappPublicKey.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = setappPublicKey.pem; sourceTree = "<group>"; };
4FB0416026F71CC0003657BE /* ButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonStyle.swift; sourceTree = "<group>"; };
4FB51A5627A94457003F528E /* SecurityUpdateCheck.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecurityUpdateCheck.swift; sourceTree = "<group>"; };
4FB51A5927A94F27003F528E /* SystemUpdatesCheck.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemUpdatesCheck.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -392,6 +391,7 @@
4F37E73B2718122E00A2B254 /* Defaults in Frameworks */,
4F37E73C2718122E00A2B254 /* SwiftSocket in Frameworks */,
4F37E73D2718122E00A2B254 /* LaunchAtLogin in Frameworks */,
4FAF5BC22895583A004E9615 /* Setapp in Frameworks */,
4F37E73E2718122E00A2B254 /* JWTDecode in Frameworks */,
4F923CF527569E6300070551 /* Cache in Frameworks */,
);
Expand Down Expand Up @@ -659,8 +659,8 @@
4FEBA2F0269CD48F009B2469 /* Pareto */ = {
isa = PBXGroup;
children = (
4FAF5BBE2895573F004E9615 /* setappPublicKey.pem */,
4FFDC59F2821539F0092B7BF /* Models */,
4F7F3E7C27C4E545003A035D /* AppProtocol.swift */,
4F10300A269F0568008C1E86 /* Checks */,
4FB7C67F26AFF22C00FB1C41 /* Extensions */,
4F103009269F054C008C1E86 /* StatusBar */,
Expand All @@ -679,7 +679,6 @@
4F14487326D8EA5E00A5BA34 /* Updater.swift */,
4FF22A6426F0CFA500500213 /* Flags.swift */,
4FDAD88E26EB784A00F64E61 /* License.swift */,
4F04C278273E9CC400AD635F /* setapp-bridge.h */,
4F577B4127A448CE008119F9 /* Notifications.swift */,
);
path = Pareto;
Expand Down Expand Up @@ -730,6 +729,7 @@
4F7739F6271EBC2F008B1584 /* Sentry */,
4F923CF427569E6300070551 /* Cache */,
4F1E6DDA2760081300FD3F01 /* Regex */,
4FAF5BC12895583A004E9615 /* Setapp */,
);
productName = Pareto;
productReference = 4F37E7472718122E00A2B254 /* Pareto Security SetApp.app */;
Expand Down Expand Up @@ -849,6 +849,7 @@
4F7739F2271EB3AD008B1584 /* XCRemoteSwiftPackageReference "sentry-cocoa" */,
4F923CEB2756918E00070551 /* XCRemoteSwiftPackageReference "Cache" */,
4F6EF890275FEE6C00752559 /* XCRemoteSwiftPackageReference "Regex" */,
4FAF5BC02895583A004E9615 /* XCRemoteSwiftPackageReference "Setapp-framework" */,
);
productRefGroup = 4FEBA2EF269CD48F009B2469 /* Products */;
projectDirPath = "";
Expand All @@ -867,6 +868,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4FAF5BBF2895573F004E9615 /* setappPublicKey.pem in Resources */,
4F37E7402718122E00A2B254 /* Preview Assets.xcassets in Resources */,
4F37E7412718122E00A2B254 /* Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -1024,7 +1026,6 @@
4F38D8C9273AC5AE00671756 /* IntroView.swift in Sources */,
4F37E71D2718122E00A2B254 /* Defaults.swift in Sources */,
4F37E71E2718122E00A2B254 /* Autologin.swift in Sources */,
4F7F3E7E27C4E545003A035D /* AppProtocol.swift in Sources */,
4F38D8CF273AC62500671756 /* EndView.swift in Sources */,
4F8ECA382798262F00361728 /* FirewallStealth.swift in Sources */,
4F37E71F2718122E00A2B254 /* MediaShare.swift in Sources */,
Expand Down Expand Up @@ -1153,7 +1154,6 @@
4F38D8C8273AC5AE00671756 /* IntroView.swift in Sources */,
4F47221026B08A0E0071CE2A /* Defaults.swift in Sources */,
4F868DD126A5C51C005B876E /* Autologin.swift in Sources */,
4F7F3E7D27C4E545003A035D /* AppProtocol.swift in Sources */,
4F38D8CE273AC62500671756 /* EndView.swift in Sources */,
4F8ECA372798262F00361728 /* FirewallStealth.swift in Sources */,
4F1AE89026F9FFA60084A381 /* MediaShare.swift in Sources */,
Expand Down Expand Up @@ -1248,6 +1248,7 @@
"DEBUG=1",
);
INFOPLIST_FILE = Pareto/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand All @@ -1256,23 +1257,13 @@
MARKETING_VERSION = 0.0.17;
OTHER_LDFLAGS = (
"-force_load",
"\"$(PROJECT_DIR)/libSetapp/libSetapp.a\"",
"-framework",
Security,
"-framework",
IOKit,
"-framework",
QuartzCore,
"-framework",
Cocoa,
"-fprofile-instr-generate",
"\"$(BUILT_PRODUCTS_DIR)/libSetapp.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "niteo.co.Pareto-setapp";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SETAPP_ENABLED DEBUG";
SWIFT_COMPILATION_MODE = singlefile;
SWIFT_OBJC_BRIDGING_HEADER = "libSetapp/setapp-bridge.h";
SWIFT_VERSION = 5.0;
};
name = Debug;
Expand All @@ -1295,6 +1286,7 @@
ENABLE_PREVIEWS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "SETAPP_ENABLED=1";
INFOPLIST_FILE = Pareto/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand All @@ -1303,23 +1295,13 @@
MARKETING_VERSION = 0.0.17;
OTHER_LDFLAGS = (
"-force_load",
"\"$(PROJECT_DIR)/libSetapp/libSetapp.a\"",
"-framework",
Security,
"-framework",
IOKit,
"-framework",
QuartzCore,
"-framework",
Cocoa,
"-fprofile-instr-generate",
"\"$(BUILT_PRODUCTS_DIR)/libSetapp.a\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "niteo.co.Pareto-setapp";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = SETAPP_ENABLED;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OBJC_BRIDGING_HEADER = "libSetapp/setapp-bridge.h";
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down Expand Up @@ -1812,6 +1794,14 @@
minimumVersion = 6.0.0;
};
};
4FAF5BC02895583A004E9615 /* XCRemoteSwiftPackageReference "Setapp-framework" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/MacPaw/Setapp-framework.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.0;
};
};
4FF515BF26F7B362008D135E /* XCRemoteSwiftPackageReference "Alamofire" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Alamofire/Alamofire";
Expand Down Expand Up @@ -1923,6 +1913,11 @@
package = 4F923CEB2756918E00070551 /* XCRemoteSwiftPackageReference "Cache" */;
productName = Cache;
};
4FAF5BC12895583A004E9615 /* Setapp */ = {
isa = XCSwiftPackageProductDependency;
package = 4FAF5BC02895583A004E9615 /* XCRemoteSwiftPackageReference "Setapp-framework" */;
productName = Setapp;
};
4FF515C026F7B362008D135E /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 4FF515BF26F7B362008D135E /* XCRemoteSwiftPackageReference "Alamofire" */;
Expand Down
14 changes: 0 additions & 14 deletions Pareto/AppProtocol.swift

This file was deleted.

12 changes: 11 additions & 1 deletion Pareto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4877</string>
<string>4885</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand All @@ -43,6 +43,16 @@
<true/>
<key>NSSystemAdministrationUsageDescription</key>
<string>The requested operation in Pareto Security requires elevation to be executed</string>
<key>NSUpdateSecurityPolicy</key>
<dict>
<key>AllowProcesses</key>
<dict>
<key>MEHY5QF425</key>
<array>
<string>com.setapp.DesktopClient.SetappAgent</string>
</array>
</dict>
</dict>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
Expand Down
9 changes: 8 additions & 1 deletion Pareto/StatusBar/StatusBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import Defaults
import os.log
import SwiftUI

#if SETAPP_ENABLED
import Setapp
#endif

class StatusBarController: NSObject, NSMenuDelegate {
var statusItem: NSStatusItem!
var statusItemMenu: NSMenu!
Expand Down Expand Up @@ -186,12 +190,15 @@ class StatusBarController: NSObject, NSMenuDelegate {

func menuDidClose(_: NSMenu) {
updateMenu(partial: true)
#if SETAPP_ENABLED
SetappManager.shared.reportUsageEvent(.userInteraction)
#endif
}

func menuWillOpen(_: NSMenu) {
updateMenu()
#if SETAPP_ENABLED
SCReportUsageEvent("user-interaction", nil)
SetappManager.shared.reportUsageEvent(.userInteraction)
#endif
}

Expand Down
14 changes: 14 additions & 0 deletions Pareto/setappPublicKey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAuFNhwEaVQ8zUkXWXKMog
fj9g67KgYK7u1QprgVlSAiQPXTvrRlaOxZTebuBvW10g47CbEMgeLh3Y12PoRrvE
YzJaD+4jVeWh36bIxR5R77B/FIBX3dA26sARSdkc/CAAazKJM8Gp4ThiKM1XQ0iW
V2TUzxgos2vYCHsOPTGUX3/m7j5giS3AkkTM8UaVbYzlEFViCYzIpRztgTcD0p9i
R7x3lAFv6JNoE+hG63ctrRuzIx6Su5iSG0j/nKgdEnUmeq03FUqx+o85oF+M1QG+
sUFNDXpGD8/yVrRugLzt3LaYxQrzIwQ/rvmOcJOwCHixpNmMsCQJkOHCKCj+iLW5
3rF+jfbnhncoQtsy5cDT7+lvrbDyY3s1A+EjH6iltKeqiSqdvTULX8IzvWjVbGmj
Se6ZdzaZ3X2bLM20NOe029oiSetr5M7ig/1qS3Vjhwp/sa7d5zNCA6l67X/2qu6l
wg9tRI32G5n9FgRDM5X2ny3TSKIWs3wT2hVxdBbTiwubH/2CLtxlAYbFlZ7x2ahQ
iq2hcSlYROCtjssoN/Lj2jkHWo3AJk7hR836NuMHFw9U6o8CpgDZvfP3y4+70YPy
GNqbPm+Gv3SCg0cNVA4IZkegMHSS6dJr/VacYkkQD5QGm8v8pmyLwKL23uJu1pxf
ZdwkukkNOqij4C3i7x2kuGkCAwEAAQ==
-----END PUBLIC KEY-----
29 changes: 0 additions & 29 deletions libSetapp/Resources/Base.lproj/Setapp.strings

This file was deleted.

30 changes: 0 additions & 30 deletions libSetapp/Resources/de.lproj/Setapp.strings

This file was deleted.

Loading

0 comments on commit 0583507

Please sign in to comment.