Skip to content

Commit

Permalink
Add no quarantine option
Browse files Browse the repository at this point in the history
  • Loading branch information
milanvarady committed Jan 6, 2025
1 parent b17dc42 commit 40f4d23
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ extension CaskManager {
if force { arguments.append("--force") }
if appdirOn { arguments.append(appdirArgument) }

let noQuarantine = UserDefaults.standard.bool(forKey: Preferences.noQuarantine.rawValue)
if noQuarantine { arguments.append("--no-quarantine") }

let command = "\(BrewPaths.currentBrewExecutable) install --cask \(arguments.joined(separator: " "))"

// Setup progress
Expand Down
1 change: 1 addition & 0 deletions Applite/Model/Preferences/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
enum Preferences: String {
case colorSchemePreference
case setupComplete
case noQuarantine
case notificationSuccess
case notificationFailure
case brewPathOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extension AppView {
}
.confirmationDialog("Are you sure you want to force install \(cask.info.name)? This will override any current installation!", isPresented: $showingForceInstallConfirmation) {
Button("Yes") {
caskManager.install(cask)
caskManager.install(cask, force: true)
}

Button("Cancel", role: .cancel) { }
Expand Down
13 changes: 12 additions & 1 deletion Applite/Views/Settings/SettingsView+BrewPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import SwiftUI

extension SettingsView {
struct BrewPathView: View {
struct BrewSettingsView: View {
@AppStorage(Preferences.customUserBrewPath.rawValue) var customUserBrewPath: String = "/opt/homebrew/bin/brew"
@AppStorage(Preferences.brewPathOption.rawValue) var brewPathOption = BrewPaths.PathOption.appPath.rawValue
@AppStorage(Preferences.noQuarantine.rawValue) var noQuarantine: Bool = false

@State var isSelectedBrewPathValid = false

Expand Down Expand Up @@ -48,6 +49,16 @@ extension SettingsView {
.bold()

AppdirSelectorView()

Divider()
.padding(.vertical, 8)

Text("Other Flags")
.bold()

Toggle(isOn: $noQuarantine) {
Text("No Quartine")
}
}
.onAppear {
previousBrewOption = BrewPaths.selectedBrewOption.rawValue
Expand Down
5 changes: 3 additions & 2 deletions Applite/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ struct SettingsView: View {
Label("General", systemImage: "gearshape")
}

BrewPathView()
BrewSettingsView()
.tabItem {
Label("Brew Path", systemImage: "mug")
Label("Brew", systemImage: "mug")
}

UpdateSettingsView(updater: updater)
Expand All @@ -48,6 +48,7 @@ struct SettingsView: View {
Label("Uninstall", systemImage: "trash")
}
}
.scenePadding()
.labelStyle(.titleAndIcon)
.presentedWindowToolbarStyle(.expanded)
.contentShape(Rectangle())
Expand Down
12 changes: 12 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
}
},
"%@ is already installed. If you want to add it to %@ click more options (chevron icon) and press Force Install." : {
"extractionState" : "stale",
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -1288,6 +1289,9 @@
}
}
}
},
"Brew" : {

},
"Brew Executable Path" : {
"localizations" : {
Expand Down Expand Up @@ -1324,6 +1328,7 @@
}
},
"Brew Path" : {
"extractionState" : "stale",
"localizations" : {
"fr" : {
"stringUnit" : {
Expand Down Expand Up @@ -1773,6 +1778,7 @@
}
},
"Couldn't download app. No internet connection, or host is unreachable." : {
"extractionState" : "stale",
"localizations" : {
"fr" : {
"stringUnit" : {
Expand Down Expand Up @@ -3524,6 +3530,9 @@
}
}
}
},
"No Quartine" : {

},
"No Selection" : {
"extractionState" : "stale",
Expand Down Expand Up @@ -3834,6 +3843,9 @@
}
}
}
},
"Other Flags" : {

},
"Password Managers" : {
"extractionState" : "manual",
Expand Down

0 comments on commit 40f4d23

Please sign in to comment.