Added LaunchAtLogin functionality

This commit is contained in:
cdricms
2024-07-10 17:52:18 +02:00
parent 5cfd971f57
commit 887d4b3727
4 changed files with 63 additions and 19 deletions

View File

@@ -13,6 +13,7 @@
9E6C730E2C3DB16F0056ADDC /* UninstallButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */; };
9E6C73112C3DB5940056ADDC /* CaskDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C73102C3DB5940056ADDC /* CaskDetailView.swift */; };
9E6C73182C3E853E0056ADDC /* UpdateButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C73172C3E853E0056ADDC /* UpdateButton.swift */; };
9E7ADB5A2C3EE41F00F2B8CA /* LaunchAtLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 9E7ADB592C3EE41F00F2B8CA /* LaunchAtLogin */; };
9E8CE5362C3C545600A39146 /* BrewerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8CE5352C3C545600A39146 /* BrewerApp.swift */; };
9E8CE5382C3C545600A39146 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8CE5372C3C545600A39146 /* ContentView.swift */; };
9E8CE53A2C3C545700A39146 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9E8CE5392C3C545700A39146 /* Assets.xcassets */; };
@@ -66,6 +67,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9E7ADB5A2C3EE41F00F2B8CA /* LaunchAtLogin in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -190,6 +192,9 @@
dependencies = (
);
name = Brewer;
packageProductDependencies = (
9E7ADB592C3EE41F00F2B8CA /* LaunchAtLogin */,
);
productName = Brewer;
productReference = 9E8CE5322C3C545600A39146 /* Brewer.app */;
productType = "com.apple.product-type.application";
@@ -262,6 +267,9 @@
Base,
);
mainGroup = 9E8CE5292C3C545600A39146;
packageReferences = (
9E98BE4E2C3EE353006ED274 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */,
);
productRefGroup = 9E8CE5332C3C545600A39146 /* Products */;
projectDirPath = "";
projectRoot = "";
@@ -476,7 +484,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = "0.1.2-beta";
CURRENT_PROJECT_VERSION = "0.1.3-beta";
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
DEVELOPMENT_TEAM = 96S93Z7LTG;
ENABLE_HARDENED_RUNTIME = YES;
@@ -490,7 +498,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = "0.1.2-beta";
MARKETING_VERSION = "0.1.3-beta";
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -507,7 +515,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = "0.1.2-beta";
CURRENT_PROJECT_VERSION = "0.1.3-beta";
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
DEVELOPMENT_TEAM = 96S93Z7LTG;
ENABLE_HARDENED_RUNTIME = YES;
@@ -521,7 +529,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = "0.1.2-beta";
MARKETING_VERSION = "0.1.3-beta";
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -641,6 +649,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
9E98BE4E2C3EE353006ED274 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/LaunchAtLogin-Modern";
requirement = {
branch = main;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
9E7ADB592C3EE41F00F2B8CA /* LaunchAtLogin */ = {
isa = XCSwiftPackageProductDependency;
package = 9E98BE4E2C3EE353006ED274 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */;
productName = LaunchAtLogin;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 9E8CE52A2C3C545600A39146 /* Project object */;
}

View File

@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:/Volumes/Data/Projects/Brewer/Brewer.xcodeproj">
location = "self:">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,15 @@
{
"originHash" : "aae61040c30e63b9cf0f5455365680cfeabef0aac829c0941d4d6f6180010fc9",
"pins" : [
{
"identity" : "launchatlogin-modern",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sindresorhus/LaunchAtLogin-Modern",
"state" : {
"branch" : "main",
"revision" : "a04ec1c363be3627734f6dad757d82f5d4fa8fcc"
}
}
],
"version" : 3
}

View File

@@ -5,6 +5,7 @@
// Created by Cédric MAS on 08/07/2024.
//
import LaunchAtLogin
import SwiftUI
@main
@@ -29,21 +30,22 @@ struct BrewerApp: App {
MenuBarExtra {
VStack(spacing: 0) {
ContentView()
.padding()
.padding(.bottom, 0)
Button {
NSApplication.shared.terminate(self)
} label: {
Label("Quit", systemImage: "x")
.symbolRenderingMode(.palette)
.symbolVariant(.circle)
.symbolVariant(.fill)
.foregroundStyle(.white, .red)
Form {
HStack {
LaunchAtLogin.Toggle()
Button {
NSApplication.shared.terminate(self)
} label: {
Label("Quit", systemImage: "x")
.symbolRenderingMode(.palette)
.symbolVariant(.circle)
.symbolVariant(.fill)
.foregroundStyle(.white, .red)
}
.frame(maxWidth: .infinity, alignment: .trailing)
}
}
.frame(maxWidth: .infinity, alignment: .trailing)
.padding()
.padding(.top, 0)
}
}.padding()
} label: {
if isUpToDate {
Label("Brewer", systemImage: "sparkle.magnifyingglass")