Compare commits
1 Commits
beta-relea
...
beta-relea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daae01b05c |
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
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
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 */; };
|
|
||||||
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 */; };
|
||||||
@@ -46,7 +45,6 @@
|
|||||||
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>"; };
|
||||||
@@ -90,7 +88,6 @@
|
|||||||
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;
|
||||||
@@ -307,7 +304,6 @@
|
|||||||
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 */,
|
||||||
@@ -473,24 +469,21 @@
|
|||||||
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 = "0.1.2-beta";
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
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 = "0.1.2-beta";
|
MARKETING_VERSION = 1.0;
|
||||||
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;
|
||||||
@@ -504,24 +497,21 @@
|
|||||||
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 = "0.1.2-beta";
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
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 = "0.1.2-beta";
|
MARKETING_VERSION = 1.0;
|
||||||
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;
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "self:/Volumes/Data/Projects/Brewer/Brewer.xcodeproj">
|
location = "self:">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ struct BrewerApp: App {
|
|||||||
if let number = Int(
|
if let number = Int(
|
||||||
res.trimmingCharacters(in: .whitespacesAndNewlines)), number > 0
|
res.trimmingCharacters(in: .whitespacesAndNewlines)), number > 0
|
||||||
{
|
{
|
||||||
print(number)
|
|
||||||
isUpToDate = false
|
isUpToDate = false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -26,24 +25,11 @@ struct BrewerApp: App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
|
WindowGroup {
|
||||||
|
EmptyView()
|
||||||
|
}
|
||||||
MenuBarExtra {
|
MenuBarExtra {
|
||||||
VStack(spacing: 0) {
|
ContentView().padding()
|
||||||
ContentView()
|
|
||||||
.padding()
|
|
||||||
.padding(.bottom, 0)
|
|
||||||
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()
|
|
||||||
.padding(.top, 0)
|
|
||||||
}
|
|
||||||
} label: {
|
} label: {
|
||||||
if isUpToDate {
|
if isUpToDate {
|
||||||
Label("Brewer", systemImage: "sparkle.magnifyingglass")
|
Label("Brewer", systemImage: "sparkle.magnifyingglass")
|
||||||
@@ -54,9 +40,6 @@ struct BrewerApp: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.menuBarExtraStyle(.window)
|
.menuBarExtraStyle(.window)
|
||||||
WindowGroup {
|
|
||||||
EmptyView()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
//
|
|
||||||
// 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,19 +16,16 @@ 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)
|
|
||||||
.padding(.leading, -8)
|
|
||||||
switch segmentedSelection {
|
|
||||||
case .search:
|
|
||||||
SearchView()
|
|
||||||
case .installed:
|
|
||||||
InstalledView()
|
|
||||||
}
|
}
|
||||||
|
}.pickerStyle(.segmented)
|
||||||
|
switch segmentedSelection {
|
||||||
|
case .search:
|
||||||
|
SearchView()
|
||||||
|
case .installed:
|
||||||
|
InstalledView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,18 @@ struct InstalledView: View {
|
|||||||
Text(cask.name.first ?? cask.fullToken)
|
Text(cask.name.first ?? cask.fullToken)
|
||||||
Spacer()
|
Spacer()
|
||||||
if cask.outdated {
|
if cask.outdated {
|
||||||
UpdateButton(name: cask.fullToken)
|
Button {
|
||||||
|
|
||||||
|
} label: {
|
||||||
|
Label(
|
||||||
|
"Update",
|
||||||
|
systemImage:
|
||||||
|
"arrow.counterclockwise.circle.fill"
|
||||||
|
)
|
||||||
|
.symbolRenderingMode(.palette)
|
||||||
|
.foregroundStyle(
|
||||||
|
.white, .orange)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Text(cask.version)
|
Text(cask.version)
|
||||||
}
|
}
|
||||||
@@ -54,7 +65,17 @@ struct InstalledView: View {
|
|||||||
Text(formulae.fullName)
|
Text(formulae.fullName)
|
||||||
Spacer()
|
Spacer()
|
||||||
if formulae.outdated {
|
if formulae.outdated {
|
||||||
UpdateButton(name: formulae.fullName)
|
Button {
|
||||||
|
|
||||||
|
} label: {
|
||||||
|
Label(
|
||||||
|
"Update",
|
||||||
|
systemImage:
|
||||||
|
"arrow.counterclockwise.circle.fill"
|
||||||
|
)
|
||||||
|
.symbolRenderingMode(.palette)
|
||||||
|
.foregroundStyle(.white, .orange)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Text(formulae.versions.stable)
|
Text(formulae.versions.stable)
|
||||||
}
|
}
|
||||||
@@ -76,8 +97,8 @@ struct InstalledView: View {
|
|||||||
}
|
}
|
||||||
.listStyle(.inset(alternatesRowBackgrounds: true))
|
.listStyle(.inset(alternatesRowBackgrounds: true))
|
||||||
let areOutdated =
|
let areOutdated =
|
||||||
data.casks.filter(\.outdated).count
|
data.casks.map(\.outdated).count
|
||||||
+ data.formulae.filter(\.outdated).count
|
+ data.formulae.map(\.outdated).count
|
||||||
let _ = UserDefaults.standard.set(
|
let _ = UserDefaults.standard.set(
|
||||||
!(areOutdated > 0), forKey: "isUpToDate")
|
!(areOutdated > 0), forKey: "isUpToDate")
|
||||||
if areOutdated > 0 {
|
if areOutdated > 0 {
|
||||||
|
|||||||
@@ -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?
|
||||||
var outdated: Bool
|
let 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
|
||||||
@@ -191,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:
|
case .failure(let fail):
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,9 +201,11 @@ class Homebrew {
|
|||||||
self.data = nil
|
self.data = nil
|
||||||
let task = Task { [weak self] in
|
let task = Task { [weak self] in
|
||||||
do {
|
do {
|
||||||
try shell(
|
let res =
|
||||||
"/opt/homebrew/bin/brew uninstall \(fullToken)"
|
try shell(
|
||||||
)
|
"/opt/homebrew/bin/brew uninstall \(fullToken); echo $?"
|
||||||
|
)
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
} catch {
|
} catch {
|
||||||
self?.errorMessage = error.localizedDescription
|
self?.errorMessage = error.localizedDescription
|
||||||
}
|
}
|
||||||
@@ -214,35 +216,9 @@ class Homebrew {
|
|||||||
return switch await task.result {
|
return switch await task.result {
|
||||||
case .success(let success):
|
case .success(let success):
|
||||||
success
|
success
|
||||||
case .failure:
|
case .failure(let 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,6 +13,8 @@ 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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user