From 890b44c715543563793d1d1071e9895b1bdd1314 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Fri, 30 Jun 2023 21:01:46 -0400 Subject: [PATCH] Add Launch at login option --- pullBar.xcodeproj/project.pbxproj | 48 +++++++++++++++++-- .../xcshareddata/swiftpm/Package.resolved | 9 ++++ pullBar/Views/PreferencesView.swift | 11 ++++- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/pullBar.xcodeproj/project.pbxproj b/pullBar.xcodeproj/project.pbxproj index 9517bdb..b32fdad 100644 --- a/pullBar.xcodeproj/project.pbxproj +++ b/pullBar.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 7629FBD02A4F713300081779 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 7629FBCF2A4F713300081779 /* LaunchAtLogin */; }; 768A4C5528AF253C004E557E /* BottomItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 768A4C5428AF253C004E557E /* BottomItemView.swift */; }; 769F4E1B2765A2B900594911 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 769F4E1A2765A2B900594911 /* AboutView.swift */; }; 769F4E7B277B97B300594911 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 769F4E7A277B97B300594911 /* Notifications.swift */; }; @@ -56,6 +57,7 @@ files = ( 8CECBBF82742ABDA00A2802D /* Defaults in Frameworks */, 8CECBBFB2742ABE600A2802D /* Alamofire in Frameworks */, + 7629FBD02A4F713300081779 /* LaunchAtLogin in Frameworks */, 76D5F9E428D28958009EBD80 /* KeychainAccess in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -137,6 +139,7 @@ 8CECBBDB2742AAF800A2802D /* Sources */, 8CECBBDC2742AAF800A2802D /* Frameworks */, 8CECBBDD2742AAF800A2802D /* Resources */, + 7629FBD12A4F7AB700081779 /* Copy “Launch at Login Helper” */, ); buildRules = ( ); @@ -147,6 +150,7 @@ 8CECBBF72742ABDA00A2802D /* Defaults */, 8CECBBFA2742ABE600A2802D /* Alamofire */, 76D5F9E328D28958009EBD80 /* KeychainAccess */, + 7629FBCF2A4F713300081779 /* LaunchAtLogin */, ); productName = pullBar; productReference = 8CECBBDF2742AAF800A2802D /* pullBar.app */; @@ -180,6 +184,7 @@ 8CECBBF62742ABDA00A2802D /* XCRemoteSwiftPackageReference "Defaults" */, 8CECBBF92742ABE600A2802D /* XCRemoteSwiftPackageReference "Alamofire" */, 76D5F9E228D28958009EBD80 /* XCRemoteSwiftPackageReference "KeychainAccess" */, + 7629FBCE2A4F713300081779 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */, ); productRefGroup = 8CECBBE02742AAF800A2802D /* Products */; projectDirPath = ""; @@ -202,6 +207,28 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 7629FBD12A4F7AB700081779 /* Copy “Launch at Login Helper” */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Copy “Launch at Login Helper”"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${BUILT_PRODUCTS_DIR}/LaunchAtLogin_LaunchAtLogin.bundle/Contents/Resources/copy-helper-swiftpm.sh\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 8CECBBDB2742AAF800A2802D /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -362,7 +389,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = UV3HUS49VJ; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; @@ -374,7 +401,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.6; + MARKETING_VERSION = 1.7; PRODUCT_BUNDLE_IDENTIFIER = debug.com.pavelmakhov.pullBar; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -391,7 +418,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 10; DEVELOPMENT_TEAM = UV3HUS49VJ; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; @@ -403,7 +430,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.6; + MARKETING_VERSION = 1.7; PRODUCT_BUNDLE_IDENTIFIER = com.pavelmakhov.pullBar; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -435,6 +462,14 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ + 7629FBCE2A4F713300081779 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin"; + requirement = { + branch = main; + kind = branch; + }; + }; 76D5F9E228D28958009EBD80 /* XCRemoteSwiftPackageReference "KeychainAccess" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/kishikawakatsumi/KeychainAccess"; @@ -462,6 +497,11 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 7629FBCF2A4F713300081779 /* LaunchAtLogin */ = { + isa = XCSwiftPackageProductDependency; + package = 7629FBCE2A4F713300081779 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */; + productName = LaunchAtLogin; + }; 76D5F9E328D28958009EBD80 /* KeychainAccess */ = { isa = XCSwiftPackageProductDependency; package = 76D5F9E228D28958009EBD80 /* XCRemoteSwiftPackageReference "KeychainAccess" */; diff --git a/pullBar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/pullBar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index d8fa27d..a16e774 100644 --- a/pullBar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/pullBar.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -26,6 +26,15 @@ "revision" : "84e546727d66f1adc5439debad16270d0fdd04e7", "version" : "4.2.2" } + }, + { + "identity" : "launchatlogin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/sindresorhus/LaunchAtLogin", + "state" : { + "branch" : "main", + "revision" : "7ad6331f9c38953eb1ce8737758e18f7607e984a" + } } ], "version" : 2 diff --git a/pullBar/Views/PreferencesView.swift b/pullBar/Views/PreferencesView.swift index 6bf91f9..73bf961 100644 --- a/pullBar/Views/PreferencesView.swift +++ b/pullBar/Views/PreferencesView.swift @@ -8,6 +8,7 @@ import SwiftUI import Defaults import KeychainAccess +import LaunchAtLogin struct PreferencesView: View { @@ -27,7 +28,8 @@ struct PreferencesView: View { @State private var showGhAlert = false @StateObject private var githubTokenValidator = GithubTokenValidator() - + @ObservedObject private var launchAtLogin = LaunchAtLogin.observable + var body: some View { Form { Section { @@ -134,6 +136,13 @@ struct PreferencesView: View { .pickerStyle(MenuPickerStyle()) .frame(width: 100) } + + HStack(alignment: .center) { + Text("Launch at login:").frame(width: 120, alignment: .trailing) + Toggle("", isOn: $launchAtLogin.isEnabled) + + } + } } .padding()