From 2cf39ccb91323adce976a5698b8ea232ca3048d6 Mon Sep 17 00:00:00 2001 From: Anthony Ingle Date: Fri, 6 May 2022 14:15:47 -0400 Subject: [PATCH] added launch at login capability --- Calculator.xcodeproj/project.pbxproj | 43 ++++++++++++++++++- .../xcshareddata/swiftpm/Package.resolved | 9 ++++ Calculator/Views/SettingsView.swift | 8 +++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Calculator.xcodeproj/project.pbxproj b/Calculator.xcodeproj/project.pbxproj index 05359aa..d010905 100644 --- a/Calculator.xcodeproj/project.pbxproj +++ b/Calculator.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 92AA9002281EEBEA008C9EC8 /* HistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92AA9001281EEBEA008C9EC8 /* HistoryView.swift */; }; 92AA9004281F802C008C9EC8 /* History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92AA9003281F802C008C9EC8 /* History.swift */; }; 92B01F4D280942500069F3D7 /* Expression in Frameworks */ = {isa = PBXBuildFile; productRef = 92B01F4C280942500069F3D7 /* Expression */; }; + 92EEDD392825998A005F0CD8 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 92EEDD382825998A005F0CD8 /* LaunchAtLogin */; }; 92F4476C28089FEE00EC45D5 /* CalculatorApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F4476B28089FEE00EC45D5 /* CalculatorApp.swift */; }; 92F4476E28089FEE00EC45D5 /* PopoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F4476D28089FEE00EC45D5 /* PopoverView.swift */; }; 92F4477028089FF100EC45D5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92F4476F28089FF100EC45D5 /* Assets.xcassets */; }; @@ -52,6 +53,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 92EEDD392825998A005F0CD8 /* LaunchAtLogin in Frameworks */, 92B01F4D280942500069F3D7 /* Expression in Frameworks */, 9298D4AB2825055200EC852D /* KeyboardShortcuts in Frameworks */, ); @@ -142,6 +144,7 @@ 92F4476428089FEE00EC45D5 /* Sources */, 92F4476528089FEE00EC45D5 /* Frameworks */, 92F4476628089FEE00EC45D5 /* Resources */, + 92EEDD3A28259B40005F0CD8 /* Copy “Launch at Login Helper” */, ); buildRules = ( ); @@ -151,6 +154,7 @@ packageProductDependencies = ( 92B01F4C280942500069F3D7 /* Expression */, 9298D4AA2825055200EC852D /* KeyboardShortcuts */, + 92EEDD382825998A005F0CD8 /* LaunchAtLogin */, ); productName = Calculator; productReference = 92F4476828089FEE00EC45D5 /* Calculator.app */; @@ -183,6 +187,7 @@ packageReferences = ( 92B01F4B280942500069F3D7 /* XCRemoteSwiftPackageReference "Expression" */, 9298D4A92825055200EC852D /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */, + 92EEDD372825998A005F0CD8 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */, ); productRefGroup = 92F4476928089FEE00EC45D5 /* Products */; projectDirPath = ""; @@ -205,6 +210,27 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 92EEDD3A28259B40005F0CD8 /* Copy “Launch at Login Helper” */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Copy “Launch at Login Helper”"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 92F4476428089FEE00EC45D5 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -357,7 +383,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"Calculator/Preview Content\""; DEVELOPMENT_TEAM = 4UQS8N4WUS; - ENABLE_HARDENED_RUNTIME = NO; + ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Calculator/Info.plist; @@ -387,7 +413,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"Calculator/Preview Content\""; DEVELOPMENT_TEAM = 4UQS8N4WUS; - ENABLE_HARDENED_RUNTIME = NO; + ENABLE_HARDENED_RUNTIME = YES; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Calculator/Info.plist; @@ -445,6 +471,14 @@ minimumVersion = 0.9.3; }; }; + 92EEDD372825998A005F0CD8 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin"; + requirement = { + branch = main; + kind = branch; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -458,6 +492,11 @@ package = 92B01F4B280942500069F3D7 /* XCRemoteSwiftPackageReference "Expression" */; productName = Expression; }; + 92EEDD382825998A005F0CD8 /* LaunchAtLogin */ = { + isa = XCSwiftPackageProductDependency; + package = 92EEDD372825998A005F0CD8 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */; + productName = LaunchAtLogin; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 92F4476028089FEE00EC45D5 /* Project object */; diff --git a/Calculator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Calculator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index fbc8984..66ac59b 100644 --- a/Calculator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Calculator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -17,6 +17,15 @@ "branch" : "main", "revision" : "5e453238c13a42a3448f1effc53c4a7a4cd22c15" } + }, + { + "identity" : "launchatlogin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/sindresorhus/LaunchAtLogin", + "state" : { + "branch" : "main", + "revision" : "e8171b3e38a2816f579f58f3dac1522aa39efe41" + } } ], "version" : 2 diff --git a/Calculator/Views/SettingsView.swift b/Calculator/Views/SettingsView.swift index 6bc388b..bb179f0 100644 --- a/Calculator/Views/SettingsView.swift +++ b/Calculator/Views/SettingsView.swift @@ -8,6 +8,7 @@ import SwiftUI import AudioToolbox import KeyboardShortcuts +import LaunchAtLogin struct SettingsView: View { @EnvironmentObject private var historyStore: HistoryStore @@ -15,9 +16,14 @@ struct SettingsView: View { var body: some View { VStack(alignment: .leading, spacing: 10) { + + // MARK: - Display and Change Global Shortcut KeyboardShortcuts.Recorder(for: .togglePopover) - // MARK: - Toggle Buttons + // MARK: - Toggle Launch at Login + LaunchAtLogin.Toggle() + + // MARK: - Toggle Button View Toggle(isOn: $showingButtons, label: { Text("Show Buttons").padding(.leading, 4) })