From 9d2a2e940794428b8184c178f05f9a3a3aa14854 Mon Sep 17 00:00:00 2001 From: LinusS1 Date: Thu, 25 Nov 2021 15:55:40 -0800 Subject: [PATCH] Add Launch on Login --- SLAM.xcodeproj/project.pbxproj | 53 +++++++++++++++++++ .../xcshareddata/swiftpm/Package.resolved | 16 ++++++ SLAM/Credits.rtf | 34 ++++++++++++ SLAM/IntroView.swift | 3 +- SLAM/SongList.swift | 2 + 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 SLAM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 SLAM/Credits.rtf diff --git a/SLAM.xcodeproj/project.pbxproj b/SLAM.xcodeproj/project.pbxproj index c94466b..a11dbfc 100644 --- a/SLAM.xcodeproj/project.pbxproj +++ b/SLAM.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ 1551EB4E274F4BC400A0BFA2 /* Persistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1551EB4D274F4BC400A0BFA2 /* Persistance.swift */; }; 1551EB54274F4E2500A0BFA2 /* Song+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1551EB53274F4E2500A0BFA2 /* Song+CoreDataProperties.swift */; }; 1551EB56274F734200A0BFA2 /* SongList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1551EB55274F734200A0BFA2 /* SongList.swift */; }; + 1551EB592750583300A0BFA2 /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 1551EB582750583300A0BFA2 /* LaunchAtLogin */; }; + 1551EB742750A9D600A0BFA2 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1551EB732750A9D500A0BFA2 /* Credits.rtf */; }; 15F9A0FC274F164400ECAD62 /* IntroViewInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15F9A0FB274F164400ECAD62 /* IntroViewInstruction.swift */; }; /* End PBXBuildFile section */ @@ -32,6 +34,7 @@ 1551EB4D274F4BC400A0BFA2 /* Persistance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistance.swift; sourceTree = ""; }; 1551EB53274F4E2500A0BFA2 /* Song+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Song+CoreDataProperties.swift"; sourceTree = ""; }; 1551EB55274F734200A0BFA2 /* SongList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongList.swift; sourceTree = ""; }; + 1551EB732750A9D500A0BFA2 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 15F9A0FB274F164400ECAD62 /* IntroViewInstruction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntroViewInstruction.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -40,6 +43,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1551EB592750583300A0BFA2 /* LaunchAtLogin in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -65,6 +69,7 @@ 1533FB712748A61200C6527A /* SLAM */ = { isa = PBXGroup; children = ( + 1551EB732750A9D500A0BFA2 /* Credits.rtf */, 1533FB832749F8A800C6527A /* Info.plist */, 1533FB722748A61200C6527A /* SLAMApp.swift */, 1551EB55274F734200A0BFA2 /* SongList.swift */, @@ -99,12 +104,16 @@ 1533FB6B2748A61200C6527A /* Sources */, 1533FB6C2748A61200C6527A /* Frameworks */, 1533FB6D2748A61200C6527A /* Resources */, + 1551EB5A2750585000A0BFA2 /* Copy "Launch at Login Helper" */, ); buildRules = ( ); dependencies = ( ); name = SLAM; + packageProductDependencies = ( + 1551EB582750583300A0BFA2 /* LaunchAtLogin */, + ); productName = SLAM; productReference = 1533FB6F2748A61200C6527A /* SLAM.app */; productType = "com.apple.product-type.application"; @@ -133,6 +142,9 @@ Base, ); mainGroup = 1533FB662748A61200C6527A; + packageReferences = ( + 1551EB572750583200A0BFA2 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */, + ); productRefGroup = 1533FB702748A61200C6527A /* Products */; projectDirPath = ""; projectRoot = ""; @@ -148,12 +160,34 @@ buildActionMask = 2147483647; files = ( 1533FB7A2748A61600C6527A /* Preview Assets.xcassets in Resources */, + 1551EB742750A9D600A0BFA2 /* Credits.rtf in Resources */, 1533FB772748A61600C6527A /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 1551EB5A2750585000A0BFA2 /* 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 = "# 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 */ 1533FB6B2748A61200C6527A /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -371,6 +405,25 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + 1551EB572750583200A0BFA2 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 4.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 1551EB582750583300A0BFA2 /* LaunchAtLogin */ = { + isa = XCSwiftPackageProductDependency; + package = 1551EB572750583200A0BFA2 /* XCRemoteSwiftPackageReference "LaunchAtLogin" */; + productName = LaunchAtLogin; + }; +/* End XCSwiftPackageProductDependency section */ + /* Begin XCVersionGroup section */ 1551EB26274F493900A0BFA2 /* SLAM.xcdatamodeld */ = { isa = XCVersionGroup; diff --git a/SLAM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SLAM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..59be512 --- /dev/null +++ b/SLAM.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "LaunchAtLogin", + "repositoryURL": "https://github.com/sindresorhus/LaunchAtLogin", + "state": { + "branch": null, + "revision": "e8171b3e38a2816f579f58f3dac1522aa39efe41", + "version": "4.2.0" + } + } + ] + }, + "version": 1 +} diff --git a/SLAM/Credits.rtf b/SLAM/Credits.rtf new file mode 100644 index 0000000..f440be3 --- /dev/null +++ b/SLAM/Credits.rtf @@ -0,0 +1,34 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2636 +\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 SFPro-Regular;} +{\colortbl;\red255\green255\blue255;\red33\green254\blue6;\red0\green0\blue254;} +{\*\expandedcolortbl;;\csgenericrgb\c12941\c99608\c2353;\csgenericrgb\c0\c0\c99608;} +{\info +{\author Linus Skucas}}\margl1440\margr1440\margb1800\margt1800\viewkind1 +\deftab720 +\pard\pardeftab720\pardirnatural\qc\partightenfactor0 + +\f0\fs24 \cf0 Developer:\ +\cf2 Linus Skucas\ +\pard\pardeftab720\pardirnatural\qc\partightenfactor0 +{\field{\*\fldinst{HYPERLINK "https://linus.sh"}}{\fldrslt \cf3 \ul \ulc3 linus.sh}}\cf0 \ +\ +App Icon:\ +??\ +\pard\pardeftab720\pardirnatural\partightenfactor0 +\cf0 \ +Credits:\ +\pard\pardeftab720\pardirnatural\partightenfactor0 +{\field{\*\fldinst{HYPERLINK "https://github.com/sindresorhus/LaunchAtLogin"}}{\fldrslt \cf3 \ul \ulc3 LaunchAtLogin}}\ +\ +\pard\pardeftab720\pardirnatural\partightenfactor0 + +\fs14 \cf0 MIT License\ +\ +Copyright (c) Sindre Sorhus (sindresorhus.com)\ +\ +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\ +\ +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\ +\ +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\ +} \ No newline at end of file diff --git a/SLAM/IntroView.swift b/SLAM/IntroView.swift index 2f4505c..f45110e 100644 --- a/SLAM/IntroView.swift +++ b/SLAM/IntroView.swift @@ -7,7 +7,7 @@ import SwiftUI import AVFoundation - +import LaunchAtLogin struct IntroView: View { @State private var step: IntroStep = .welcome @@ -27,6 +27,7 @@ struct IntroView: View { AVCaptureDevice.requestAccess(for: .audio) { granted in guard granted else { fatalError("Did not agree") } step = .instructions + LaunchAtLogin.isEnabled = true } } .padding() diff --git a/SLAM/SongList.swift b/SLAM/SongList.swift index 4c17fd9..cb5ccf5 100644 --- a/SLAM/SongList.swift +++ b/SLAM/SongList.swift @@ -6,6 +6,7 @@ // import SwiftUI +import LaunchAtLogin struct SongList: View { @Environment(\.managedObjectContext) var viewContext @@ -94,6 +95,7 @@ struct SongList: View { } } } + LaunchAtLogin.Toggle() } } }