Compare commits
7 Commits
c675a98309
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887d4b3727 | ||
|
|
5cfd971f57 | ||
|
|
675f4ee89b | ||
|
|
4c9665a41b | ||
|
|
253f550212 | ||
|
|
dc99548d07 | ||
|
|
6b3b26e4bc |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -97,4 +97,4 @@ fastlane/test_output
|
|||||||
# https://github.com/johnno1962/injectionforxcode
|
# https://github.com/johnno1962/injectionforxcode
|
||||||
|
|
||||||
iOSInjectionProject/
|
iOSInjectionProject/
|
||||||
|
.DS_Store
|
||||||
|
|||||||
69
.swift-format
Normal file
69
.swift-format
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"fileScopedDeclarationPrivacy" : {
|
||||||
|
"accessLevel" : "private"
|
||||||
|
},
|
||||||
|
"indentation" : {
|
||||||
|
"tabs" : 1
|
||||||
|
},
|
||||||
|
"indentConditionalCompilationBlocks" : true,
|
||||||
|
"indentSwitchCaseLabels" : false,
|
||||||
|
"lineBreakAroundMultilineExpressionChainComponents" : false,
|
||||||
|
"lineBreakBeforeControlFlowKeywords" : false,
|
||||||
|
"lineBreakBeforeEachArgument" : false,
|
||||||
|
"lineBreakBeforeEachGenericRequirement" : false,
|
||||||
|
"lineLength" : 80,
|
||||||
|
"maximumBlankLines" : 1,
|
||||||
|
"multiElementCollectionTrailingCommas" : true,
|
||||||
|
"noAssignmentInExpressions" : {
|
||||||
|
"allowedFunctions" : [
|
||||||
|
"XCTAssertNoThrow"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"prioritizeKeepingFunctionOutputTogether" : false,
|
||||||
|
"respectsExistingLineBreaks" : true,
|
||||||
|
"rules" : {
|
||||||
|
"AllPublicDeclarationsHaveDocumentation" : false,
|
||||||
|
"AlwaysUseLiteralForEmptyCollectionInit" : false,
|
||||||
|
"AlwaysUseLowerCamelCase" : true,
|
||||||
|
"AmbiguousTrailingClosureOverload" : true,
|
||||||
|
"BeginDocumentationCommentWithOneLineSummary" : false,
|
||||||
|
"DoNotUseSemicolons" : true,
|
||||||
|
"DontRepeatTypeInStaticProperties" : true,
|
||||||
|
"FileScopedDeclarationPrivacy" : true,
|
||||||
|
"FullyIndirectEnum" : true,
|
||||||
|
"GroupNumericLiterals" : true,
|
||||||
|
"IdentifiersMustBeASCII" : true,
|
||||||
|
"NeverForceUnwrap" : false,
|
||||||
|
"NeverUseForceTry" : false,
|
||||||
|
"NeverUseImplicitlyUnwrappedOptionals" : false,
|
||||||
|
"NoAccessLevelOnExtensionDeclaration" : true,
|
||||||
|
"NoAssignmentInExpressions" : true,
|
||||||
|
"NoBlockComments" : true,
|
||||||
|
"NoCasesWithOnlyFallthrough" : true,
|
||||||
|
"NoEmptyTrailingClosureParentheses" : true,
|
||||||
|
"NoLabelsInCasePatterns" : true,
|
||||||
|
"NoLeadingUnderscores" : false,
|
||||||
|
"NoParensAroundConditions" : true,
|
||||||
|
"NoPlaygroundLiterals" : true,
|
||||||
|
"NoVoidReturnOnFunctionSignature" : true,
|
||||||
|
"OmitExplicitReturns" : false,
|
||||||
|
"OneCasePerLine" : true,
|
||||||
|
"OneVariableDeclarationPerLine" : true,
|
||||||
|
"OnlyOneTrailingClosureArgument" : true,
|
||||||
|
"OrderedImports" : true,
|
||||||
|
"ReplaceForEachWithForLoop" : true,
|
||||||
|
"ReturnVoidInsteadOfEmptyTuple" : true,
|
||||||
|
"TypeNamesShouldBeCapitalized" : true,
|
||||||
|
"UseEarlyExits" : false,
|
||||||
|
"UseLetInEveryBoundCaseVariable" : true,
|
||||||
|
"UseShorthandTypeNames" : true,
|
||||||
|
"UseSingleLinePropertyGetter" : true,
|
||||||
|
"UseSynthesizedInitializer" : true,
|
||||||
|
"UseTripleSlashForDocumentationComments" : true,
|
||||||
|
"UseWhereClausesInForLoops" : false,
|
||||||
|
"ValidateDocumentationComments" : false
|
||||||
|
},
|
||||||
|
"spacesAroundRangeFormationOperators" : false,
|
||||||
|
"tabWidth" : 4,
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
@@ -12,6 +12,8 @@
|
|||||||
9E6C730C2C3D796D0056ADDC /* DownloadButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */; };
|
9E6C730C2C3D796D0056ADDC /* DownloadButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */; };
|
||||||
9E6C730E2C3DB16F0056ADDC /* UninstallButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */; };
|
9E6C730E2C3DB16F0056ADDC /* UninstallButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */; };
|
||||||
9E6C73112C3DB5940056ADDC /* CaskDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E6C73102C3DB5940056ADDC /* CaskDetailView.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 */; };
|
9E8CE5362C3C545600A39146 /* BrewerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8CE5352C3C545600A39146 /* BrewerApp.swift */; };
|
||||||
9E8CE5382C3C545600A39146 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8CE5372C3C545600A39146 /* ContentView.swift */; };
|
9E8CE5382C3C545600A39146 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8CE5372C3C545600A39146 /* ContentView.swift */; };
|
||||||
9E8CE53A2C3C545700A39146 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9E8CE5392C3C545700A39146 /* Assets.xcassets */; };
|
9E8CE53A2C3C545700A39146 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9E8CE5392C3C545700A39146 /* Assets.xcassets */; };
|
||||||
@@ -45,6 +47,7 @@
|
|||||||
9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadButton.swift; sourceTree = "<group>"; };
|
9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadButton.swift; sourceTree = "<group>"; };
|
||||||
9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UninstallButton.swift; sourceTree = "<group>"; };
|
9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UninstallButton.swift; sourceTree = "<group>"; };
|
||||||
9E6C73102C3DB5940056ADDC /* CaskDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaskDetailView.swift; sourceTree = "<group>"; };
|
9E6C73102C3DB5940056ADDC /* CaskDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaskDetailView.swift; sourceTree = "<group>"; };
|
||||||
|
9E6C73172C3E853E0056ADDC /* UpdateButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateButton.swift; sourceTree = "<group>"; };
|
||||||
9E8CE5322C3C545600A39146 /* Brewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Brewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
9E8CE5322C3C545600A39146 /* Brewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Brewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
9E8CE5352C3C545600A39146 /* BrewerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrewerApp.swift; sourceTree = "<group>"; };
|
9E8CE5352C3C545600A39146 /* BrewerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrewerApp.swift; sourceTree = "<group>"; };
|
||||||
9E8CE5372C3C545600A39146 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
9E8CE5372C3C545600A39146 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||||
@@ -64,6 +67,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
9E7ADB5A2C3EE41F00F2B8CA /* LaunchAtLogin in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -88,6 +92,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */,
|
9E6C730B2C3D796D0056ADDC /* DownloadButton.swift */,
|
||||||
|
9E6C73172C3E853E0056ADDC /* UpdateButton.swift */,
|
||||||
9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */,
|
9E6C730D2C3DB16F0056ADDC /* UninstallButton.swift */,
|
||||||
);
|
);
|
||||||
path = Components;
|
path = Components;
|
||||||
@@ -187,6 +192,9 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = Brewer;
|
name = Brewer;
|
||||||
|
packageProductDependencies = (
|
||||||
|
9E7ADB592C3EE41F00F2B8CA /* LaunchAtLogin */,
|
||||||
|
);
|
||||||
productName = Brewer;
|
productName = Brewer;
|
||||||
productReference = 9E8CE5322C3C545600A39146 /* Brewer.app */;
|
productReference = 9E8CE5322C3C545600A39146 /* Brewer.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
@@ -259,6 +267,9 @@
|
|||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = 9E8CE5292C3C545600A39146;
|
mainGroup = 9E8CE5292C3C545600A39146;
|
||||||
|
packageReferences = (
|
||||||
|
9E98BE4E2C3EE353006ED274 /* XCRemoteSwiftPackageReference "LaunchAtLogin-Modern" */,
|
||||||
|
);
|
||||||
productRefGroup = 9E8CE5332C3C545600A39146 /* Products */;
|
productRefGroup = 9E8CE5332C3C545600A39146 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
@@ -304,6 +315,7 @@
|
|||||||
9E6C73072C3D5E570056ADDC /* SearchView.swift in Sources */,
|
9E6C73072C3D5E570056ADDC /* SearchView.swift in Sources */,
|
||||||
9E6C730C2C3D796D0056ADDC /* DownloadButton.swift in Sources */,
|
9E6C730C2C3D796D0056ADDC /* DownloadButton.swift in Sources */,
|
||||||
9E8CE5382C3C545600A39146 /* ContentView.swift in Sources */,
|
9E8CE5382C3C545600A39146 /* ContentView.swift in Sources */,
|
||||||
|
9E6C73182C3E853E0056ADDC /* UpdateButton.swift in Sources */,
|
||||||
9E6C730E2C3DB16F0056ADDC /* UninstallButton.swift in Sources */,
|
9E6C730E2C3DB16F0056ADDC /* UninstallButton.swift in Sources */,
|
||||||
9E8CE5622C3C5A6A00A39146 /* Homebrew.swift in Sources */,
|
9E8CE5622C3C5A6A00A39146 /* Homebrew.swift in Sources */,
|
||||||
9E6C73092C3D5E950056ADDC /* InstalledView.swift in Sources */,
|
9E6C73092C3D5E950056ADDC /* InstalledView.swift in Sources */,
|
||||||
@@ -469,21 +481,24 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = Brewer/Brewer.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Brewer/Brewer.entitlements;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = "0.1.3-beta";
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 96S93Z7LTG;
|
DEVELOPMENT_TEAM = 96S93Z7LTG;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = Brewer;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
|
||||||
INFOPLIST_KEY_LSUIElement = YES;
|
INFOPLIST_KEY_LSUIElement = YES;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = "0.1.3-beta";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
|
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@@ -497,21 +512,24 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = Brewer/Brewer.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Brewer/Brewer.entitlements;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = "0.1.3-beta";
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Brewer/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 96S93Z7LTG;
|
DEVELOPMENT_TEAM = 96S93Z7LTG;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = Brewer;
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
|
||||||
INFOPLIST_KEY_LSUIElement = YES;
|
INFOPLIST_KEY_LSUIElement = YES;
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = "0.1.3-beta";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
|
PRODUCT_BUNDLE_IDENTIFIER = dev.cems.Brewer;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
@@ -631,6 +649,25 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* 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 */;
|
rootObject = 9E8CE52A2C3C545600A39146 /* Project object */;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
// Created by Cédric MAS on 08/07/2024.
|
// Created by Cédric MAS on 08/07/2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import LaunchAtLogin
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@main
|
@main
|
||||||
@@ -12,8 +13,12 @@ struct BrewerApp: App {
|
|||||||
@AppStorage("isUpToDate") var isUpToDate: Bool = true
|
@AppStorage("isUpToDate") var isUpToDate: Bool = true
|
||||||
init() {
|
init() {
|
||||||
do {
|
do {
|
||||||
let res = try shell("/opt/homebrew/bin/brew outdated --greedy-latest -g | wc -l")
|
let res = try shell(
|
||||||
if let number = Int(res.trimmingCharacters(in: .whitespacesAndNewlines)), number > 0 {
|
"/opt/homebrew/bin/brew outdated --greedy-latest -g | wc -l")
|
||||||
|
if let number = Int(
|
||||||
|
res.trimmingCharacters(in: .whitespacesAndNewlines)), number > 0
|
||||||
|
{
|
||||||
|
print(number)
|
||||||
isUpToDate = false
|
isUpToDate = false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -22,11 +27,25 @@ struct BrewerApp: App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
MenuBarExtra {
|
MenuBarExtra {
|
||||||
ContentView().padding()
|
VStack(spacing: 0) {
|
||||||
|
ContentView()
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.padding()
|
||||||
} label: {
|
} label: {
|
||||||
if isUpToDate {
|
if isUpToDate {
|
||||||
Label("Brewer", systemImage: "sparkle.magnifyingglass")
|
Label("Brewer", systemImage: "sparkle.magnifyingglass")
|
||||||
@@ -37,6 +56,9 @@ struct BrewerApp: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.menuBarExtraStyle(.window)
|
.menuBarExtraStyle(.window)
|
||||||
|
WindowGroup {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ struct CaskDetailView: View {
|
|||||||
}
|
}
|
||||||
if cask.installed != nil {
|
if cask.installed != nil {
|
||||||
ToolbarItem(placement: .primaryAction) {
|
ToolbarItem(placement: .primaryAction) {
|
||||||
UninstallButton(name: cask.fullToken, brewListing: brewListing)
|
UninstallButton(
|
||||||
|
name: cask.fullToken, brewListing: brewListing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
61
Brewer/Components/UpdateButton.swift
Normal file
61
Brewer/Components/UpdateButton.swift
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
//
|
||||||
|
// UpdateButton.swift
|
||||||
|
// Brewer
|
||||||
|
//
|
||||||
|
// Created by Cédric MAS on 10/07/2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct UpdateButton: View {
|
||||||
|
let name: String
|
||||||
|
@State private var brew = Homebrew()
|
||||||
|
@State private var newInfo = Homebrew()
|
||||||
|
|
||||||
|
private var updated: String? {
|
||||||
|
if let cask = newInfo.data?.casks.first(where: { $0.fullToken == name }
|
||||||
|
), !cask.outdated {
|
||||||
|
return cask.version
|
||||||
|
}
|
||||||
|
if let formulae = newInfo.data?.formulae.first(where: {
|
||||||
|
$0.fullName == name
|
||||||
|
}), !formulae.outdated {
|
||||||
|
return formulae.versions.stable
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
if let newVersion = updated {
|
||||||
|
Text("Updated: \(newVersion)")
|
||||||
|
} else if brew.isLoading {
|
||||||
|
ProgressView()
|
||||||
|
.controlSize(.small)
|
||||||
|
} else if brew.errorMessage != nil {
|
||||||
|
Image(systemName: "x")
|
||||||
|
.symbolRenderingMode(.palette)
|
||||||
|
.symbolVariant(.circle)
|
||||||
|
.symbolVariant(.fill)
|
||||||
|
.foregroundStyle(.white, .red)
|
||||||
|
} else {
|
||||||
|
Button {
|
||||||
|
Task {
|
||||||
|
await brew.update(name)
|
||||||
|
newInfo.getInfo(on: name)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label(
|
||||||
|
"Update",
|
||||||
|
systemImage:
|
||||||
|
"arrow.counterclockwise"
|
||||||
|
)
|
||||||
|
.symbolRenderingMode(.palette)
|
||||||
|
.symbolVariant(.circle)
|
||||||
|
.symbolVariant(.fill)
|
||||||
|
.foregroundStyle(
|
||||||
|
.white, .orange)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,11 +16,13 @@ struct ContentView: View {
|
|||||||
@State private var segmentedSelection: SegementedSelection = .search
|
@State private var segmentedSelection: SegementedSelection = .search
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
VStack {
|
||||||
Picker("", selection: $segmentedSelection) {
|
Picker("", selection: $segmentedSelection) {
|
||||||
ForEach(SegementedSelection.allCases, id: \.self) { sel in
|
ForEach(SegementedSelection.allCases, id: \.self) { sel in
|
||||||
Text(sel.rawValue).tag(sel)
|
Text(sel.rawValue).tag(sel)
|
||||||
}
|
}
|
||||||
}.pickerStyle(.segmented)
|
}.pickerStyle(.segmented)
|
||||||
|
.padding(.leading, -8)
|
||||||
switch segmentedSelection {
|
switch segmentedSelection {
|
||||||
case .search:
|
case .search:
|
||||||
SearchView()
|
SearchView()
|
||||||
@@ -29,6 +31,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
|
|||||||
@@ -19,25 +19,22 @@ struct InstalledView: View {
|
|||||||
Section {
|
Section {
|
||||||
ForEach(data.casks, id: \.fullToken) { cask in
|
ForEach(data.casks, id: \.fullToken) { cask in
|
||||||
NavigationLink {
|
NavigationLink {
|
||||||
CaskDetailView(cask: cask, brewListing: brew)
|
CaskDetailView(
|
||||||
|
cask: cask, brewListing: brew)
|
||||||
} label: {
|
} label: {
|
||||||
HStack {
|
HStack {
|
||||||
Text(cask.name.first ?? cask.fullToken)
|
Text(cask.name.first ?? cask.fullToken)
|
||||||
Spacer()
|
Spacer()
|
||||||
if cask.outdated {
|
if cask.outdated {
|
||||||
Button {
|
UpdateButton(name: cask.fullToken)
|
||||||
|
|
||||||
} label: {
|
|
||||||
Label("Update", systemImage: "arrow.counterclockwise.circle.fill")
|
|
||||||
.symbolRenderingMode(.palette)
|
|
||||||
.foregroundStyle(.white, .orange)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Text(cask.version)
|
Text(cask.version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
UninstallButton(name: cask.fullToken, brewListing: brew)
|
UninstallButton(
|
||||||
|
name: cask.fullToken,
|
||||||
|
brewListing: brew)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,19 +54,15 @@ struct InstalledView: View {
|
|||||||
Text(formulae.fullName)
|
Text(formulae.fullName)
|
||||||
Spacer()
|
Spacer()
|
||||||
if formulae.outdated {
|
if formulae.outdated {
|
||||||
Button {
|
UpdateButton(name: formulae.fullName)
|
||||||
|
|
||||||
} label: {
|
|
||||||
Label("Update", systemImage: "arrow.counterclockwise.circle.fill")
|
|
||||||
.symbolRenderingMode(.palette)
|
|
||||||
.foregroundStyle(.white, .orange)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Text(formulae.versions.stable)
|
Text(formulae.versions.stable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
UninstallButton(name: formulae.fullName, brewListing: brew)
|
UninstallButton(
|
||||||
|
name: formulae.fullName,
|
||||||
|
brewListing: brew)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
} header: {
|
||||||
@@ -82,13 +75,18 @@ struct InstalledView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
let areOutdated = data.casks.map(\.outdated).count + data.formulae.map(\.outdated).count
|
let areOutdated =
|
||||||
let _ = UserDefaults.standard.set(!(areOutdated > 0), forKey: "isUpToDate")
|
data.casks.filter(\.outdated).count
|
||||||
|
+ data.formulae.filter(\.outdated).count
|
||||||
|
let _ = UserDefaults.standard.set(
|
||||||
|
!(areOutdated > 0), forKey: "isUpToDate")
|
||||||
if areOutdated > 0 {
|
if areOutdated > 0 {
|
||||||
Button {
|
Button {
|
||||||
|
|
||||||
} label: {
|
} label: {
|
||||||
Label("Update all", systemImage: "arrow.counterclockwise.circle.fill")
|
Label(
|
||||||
|
"Update all",
|
||||||
|
systemImage: "arrow.counterclockwise.circle.fill")
|
||||||
}
|
}
|
||||||
.buttonStyle(.borderedProminent)
|
.buttonStyle(.borderedProminent)
|
||||||
.tint(.orange)
|
.tint(.orange)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct Cask: Codable {
|
|||||||
let url: String
|
let url: String
|
||||||
let version: String
|
let version: String
|
||||||
let installed: String?
|
let installed: String?
|
||||||
let outdated: Bool
|
var outdated: Bool
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case token, tap, name, desc, homepage, url, version, installed, outdated
|
case token, tap, name, desc, homepage, url, version, installed, outdated
|
||||||
@@ -111,9 +111,11 @@ class Homebrew {
|
|||||||
self.data = nil
|
self.data = nil
|
||||||
Task { [weak self] in
|
Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
let res = try shell("/opt/homebrew/bin/brew info --json=v2 \(query)")
|
let res = try shell(
|
||||||
|
"/opt/homebrew/bin/brew info --json=v2 \(query)")
|
||||||
if let data = res.data(using: .utf8) {
|
if let data = res.data(using: .utf8) {
|
||||||
let output = try JSONDecoder().decode(InfoResponse.self, from: data)
|
let output = try JSONDecoder().decode(
|
||||||
|
InfoResponse.self, from: data)
|
||||||
self?.data = output
|
self?.data = output
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -129,9 +131,11 @@ class Homebrew {
|
|||||||
self.errorMessage = nil
|
self.errorMessage = nil
|
||||||
Task { [weak self] in
|
Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
let res = try shell("/opt/homebrew/bin/brew info --json=v2 --installed")
|
let res = try shell(
|
||||||
|
"/opt/homebrew/bin/brew info --json=v2 --installed")
|
||||||
if let data = res.data(using: .utf8) {
|
if let data = res.data(using: .utf8) {
|
||||||
let output = try JSONDecoder().decode(InfoResponse.self, from: data)
|
let output = try JSONDecoder().decode(
|
||||||
|
InfoResponse.self, from: data)
|
||||||
self?.data = output
|
self?.data = output
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -148,7 +152,9 @@ class Homebrew {
|
|||||||
self.data = nil
|
self.data = nil
|
||||||
let task = Task { [weak self] in
|
let task = Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
let res = try shell("/opt/homebrew/bin/brew list -1 \(name) >/dev/null 2>&1; echo $?")
|
let res = try shell(
|
||||||
|
"/opt/homebrew/bin/brew list -1 \(name) >/dev/null 2>&1; echo $?"
|
||||||
|
)
|
||||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
self?.isLoading = false
|
self?.isLoading = false
|
||||||
return res == "0"
|
return res == "0"
|
||||||
@@ -172,7 +178,9 @@ class Homebrew {
|
|||||||
self.data = nil
|
self.data = nil
|
||||||
let task = Task { [weak self] in
|
let task = Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
try shell("/opt/homebrew/bin/brew install \(isCask ? "--cask" : "") \(fullToken)")
|
try shell(
|
||||||
|
"/opt/homebrew/bin/brew install \(isCask ? "--cask" : "") \(fullToken)"
|
||||||
|
)
|
||||||
} catch {
|
} catch {
|
||||||
self?.errorMessage = error.localizedDescription
|
self?.errorMessage = error.localizedDescription
|
||||||
}
|
}
|
||||||
@@ -183,7 +191,7 @@ class Homebrew {
|
|||||||
return switch await task.result {
|
return switch await task.result {
|
||||||
case .success(let success):
|
case .success(let success):
|
||||||
success
|
success
|
||||||
case .failure(let fail):
|
case .failure:
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,9 +201,9 @@ class Homebrew {
|
|||||||
self.data = nil
|
self.data = nil
|
||||||
let task = Task { [weak self] in
|
let task = Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
let res =
|
try shell(
|
||||||
try shell("/opt/homebrew/bin/brew uninstall \(fullToken); echo $?")
|
"/opt/homebrew/bin/brew uninstall \(fullToken)"
|
||||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
)
|
||||||
} catch {
|
} catch {
|
||||||
self?.errorMessage = error.localizedDescription
|
self?.errorMessage = error.localizedDescription
|
||||||
}
|
}
|
||||||
@@ -206,9 +214,35 @@ class Homebrew {
|
|||||||
return switch await task.result {
|
return switch await task.result {
|
||||||
case .success(let success):
|
case .success(let success):
|
||||||
success
|
success
|
||||||
case .failure(let failure):
|
case .failure:
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func update(_ name: String) async -> Bool {
|
||||||
|
self.isLoading = true
|
||||||
|
self.errorMessage = nil
|
||||||
|
self.data = nil
|
||||||
|
let task = Task { [weak self] in
|
||||||
|
do {
|
||||||
|
let res = try shell(
|
||||||
|
"/opt/homebrew/bin/brew upgrade \(name); echo $?"
|
||||||
|
)
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
self?.isLoading = false
|
||||||
|
return res == "0"
|
||||||
|
} catch {
|
||||||
|
self?.errorMessage = error.localizedDescription
|
||||||
|
}
|
||||||
|
self?.isLoading = false
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch await task.result {
|
||||||
|
case .success(let success):
|
||||||
|
success
|
||||||
|
case .failure:
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ struct SearchView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
TextField("Search", text: $query)
|
TextField("Search", text: $query)
|
||||||
.padding()
|
|
||||||
.padding(.bottom, 0)
|
|
||||||
.onSubmit {
|
.onSubmit {
|
||||||
brew.getInfo(on: query)
|
brew.getInfo(on: query)
|
||||||
}
|
}
|
||||||
@@ -30,11 +28,14 @@ struct SearchView: View {
|
|||||||
Text(cask.fullToken)
|
Text(cask.fullToken)
|
||||||
Spacer()
|
Spacer()
|
||||||
if cask.installed != nil {
|
if cask.installed != nil {
|
||||||
Image(systemName: "checkmark.circle.fill")
|
Image(
|
||||||
|
systemName: "checkmark.circle.fill"
|
||||||
|
)
|
||||||
.symbolRenderingMode(.palette)
|
.symbolRenderingMode(.palette)
|
||||||
.foregroundStyle(.white, .green)
|
.foregroundStyle(.white, .green)
|
||||||
} else {
|
} else {
|
||||||
DownloadButton(name: cask.fullToken, isCask: true)
|
DownloadButton(
|
||||||
|
name: cask.fullToken, isCask: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import Brewer
|
@testable import Brewer
|
||||||
|
|
||||||
final class BrewerTests: XCTestCase {
|
final class BrewerTests: XCTestCase {
|
||||||
|
|||||||
Reference in New Issue
Block a user