This commit is contained in:
David Bureš 2024-07-24 13:36:13 +02:00
parent b4b17a6bca
commit 69ec97d834
29 changed files with 3297 additions and 509 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
disableMainThreadChecker = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C27CA6A0E544ABBB9E442DC"
BuildableName = "CorkHelp.help"
BlueprintName = "CorkHelp"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
disableMainThreadChecker = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C27CA6A0E544ABBB9E442DC"
BuildableName = "CorkHelp.help"
BlueprintName = "CorkHelp"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C27CA6A0E544ABBB9E442DC"
BuildableName = "CorkHelp.help"
BlueprintName = "CorkHelp"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Cork-Tuist.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7C27CA6A0E544ABBB9E442DC"
BuildableName = "CorkHelp.help"
BlueprintName = "CorkHelp"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CF01EECEF8A24CA2B821B3FD"
BuildableName = "Cork.app"
BlueprintName = "Cork"
ReferencedContainer = "container:Cork-Tuist.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,14 +0,0 @@
//
// Top Package.swift
// Cork
//
// Created by David Bureš on 19.08.2023.
//
import Foundation
struct TopPackage: Equatable, Hashable
{
let packageName: String
let timesDownloaded: Int
}

View File

@ -1,59 +0,0 @@
//
// Taps Section.swift
// Cork
//
// Created by David Bureš on 03.06.2023.
//
import SwiftUI
struct TapsSection: View {
@EnvironmentObject var appState: AppState
@EnvironmentObject var availableTaps: AvailableTaps
@EnvironmentObject var selectedTapInfo: SelectedTapInfo
@Binding var searchText: String
var body: some View {
Section("sidebar.section.added-taps")
{
if availableTaps.addedTaps.count != 0
{
ForEach(searchText.isEmpty || searchText.contains("#") ? availableTaps.addedTaps : availableTaps.addedTaps.filter { $0.name.contains(searchText) })
{ tap in
NavigationLink(tag: tap.id, selection: $appState.navigationSelection)
{
TapDetailView(tap: tap, selectedTapInfo: selectedTapInfo)
} label: {
Text(tap.name)
}
.contextMenu
{
Button
{
Task(priority: .userInitiated)
{
print("Would remove \(tap.name)")
try await removeTap(name: tap.name, availableTaps: availableTaps, appState: appState)
}
} label: {
Text("sidebar.section.added-taps.contextmenu.remove-\(tap.name)")
}
.alert(isPresented: $appState.isShowingRemoveTapFailedAlert, content: {
Alert(title: Text("sidebar.section.added-taps.remove.title-\(tap.name)"), message: Text("sidebar.section.added-taps.remove.message"), dismissButton: .default(Text("action.close"), action: {
appState.isShowingRemoveTapFailedAlert = false
}))
})
}
}
}
else
{
ProgressView()
}
}
}
}

View File

@ -1,29 +0,0 @@
//
// Analytics Status Box.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct AnalyticsStatusBox: View
{
@AppStorage("allowBrewAnalytics") var allowBrewAnalytics: Bool = true
var body: some View
{
GroupBox
{
VStack(alignment: .leading)
{
GroupBoxHeadlineGroup(
image: "chart.bar",
title: allowBrewAnalytics ? "start-page.analytics.enabled" : "start-page.analytics.disabled",
mainText: allowBrewAnalytics ? "start-page.analytics.enabled.description" : "start-page.analytics.disabled.description"
)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
}
}
}
}

View File

@ -1,41 +0,0 @@
//
// Cached Downloads Folder Info Box.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct CachedDownloadsFolderInfoBox: View
{
@EnvironmentObject var appState: AppState
var body: some View
{
GroupBox
{
VStack
{
HStack
{
GroupBoxHeadlineGroup(
image: "square.and.arrow.down.on.square",
title: "start-page.cached-downloads-\(appState.cachedDownloadsFolderSize.formatted(.byteCount(style: .file)))",
mainText: "start-page.cached-downloads.description"
)
Spacer()
Button
{
appState.isShowingFastCacheDeletionMaintenanceView = true
} label: {
Text("start-page.cached-downloads.action")
}
.padding(.trailing, 7)
}
}
}
}
}

View File

@ -1,85 +0,0 @@
//
// Updater Box.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct OutdatedPackageListBox: View
{
@EnvironmentObject var appState: AppState
@EnvironmentObject var outdatedPackageTracker: OutdatedPackageTracker
var body: some View
{
GroupBox
{
Grid
{
GridRow(alignment: .firstTextBaseline)
{
VStack(alignment: .leading)
{
GroupBoxHeadlineGroupWithArbitraryContent(image: outdatedPackageTracker.outdatedPackages.count == 1 ? "square.and.arrow.down" : "square.and.arrow.down.on.square")
{
VStack(alignment: .leading, spacing: 0) {
HStack(alignment: .firstTextBaseline) {
Text(String.localizedPluralString("start-page.updates.count", outdatedPackageTracker.outdatedPackages.count))
.font(.headline)
Spacer()
if outdatedPackageTracker.outdatedPackages.filter({ $0.isMarkedForUpdating }).count == outdatedPackageTracker.outdatedPackages.count
{
Button
{
appState.isShowingUpdateSheet = true
} label: {
Text("start-page.updates.action")
}
} else {
Button {
appState.isShowingIncrementalUpdateSheet = true
} label: {
Text("Update \(outdatedPackageTracker.outdatedPackages.filter({ $0.isMarkedForUpdating }).count) Packages")
}
.disabled(outdatedPackageTracker.outdatedPackages.filter({ $0.isMarkedForUpdating }).count == 0)
}
}
DisclosureGroup
{
List
{
ForEach(outdatedPackageTracker.outdatedPackages, id: \.self)
{ outdatedPackage in
Toggle(outdatedPackage.packageName, isOn: Binding<Bool>(
get: {
return outdatedPackage.isMarkedForUpdating
}, set: {
if let index = outdatedPackageTracker.outdatedPackages.firstIndex(where: { $0.id == outdatedPackage.id })
{
outdatedPackageTracker.outdatedPackages[index].isMarkedForUpdating = $0
}
}
))
}
}
.listStyle(.bordered(alternatesRowBackgrounds: true))
.frame(height: 100)
} label: {
Text("start-page.updates.list")
.font(.subheadline)
}
}
}
}
}
}
}
}
}

View File

@ -1,32 +0,0 @@
//
// Outdated Package Loader Box.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct OutdatedPackageLoaderBox: View
{
var body: some View
{
GroupBox
{
Grid
{
GridRow(alignment: .firstTextBaseline)
{
HStack(alignment: .center, spacing: 15)
{
ProgressView()
Text("start-page.updates.loading")
}
.padding(10)
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
}
}
}
}

View File

@ -1,48 +0,0 @@
//
// Package And Tap Status Box.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct PackageAndTapOverviewBox: View
{
@EnvironmentObject var brewData: BrewDataStorage
@EnvironmentObject var availableTaps: AvailableTaps
var body: some View
{
GroupBox
{
VStack(alignment: .leading)
{
GroupBoxHeadlineGroup(
image: "terminal",
title: LocalizedStringKey(String.localizedPluralString("start-page.installed-formulae.count", brewData.installedFormulae.count)),
mainText: "start-page.installed-formulae.description"
)
.animation(.none, value: brewData.installedFormulae.count)
Divider()
GroupBoxHeadlineGroup(
image: "macwindow",
title: LocalizedStringKey(String.localizedPluralString("start-page.installed-casks.count", brewData.installedCasks.count)),
mainText: "start-page.installed-casks.description"
)
.animation(.none, value: brewData.installedCasks.count)
Divider()
GroupBoxHeadlineGroup(
image: "spigot",
title: LocalizedStringKey(String.localizedPluralString("start-page.added-taps.count", availableTaps.addedTaps.count)),
mainText: "start-page.added-taps.description"
)
.animation(.none, value: availableTaps.addedTaps.count)
}
}
}
}

View File

@ -1,175 +0,0 @@
//
// Update Packages.swift
// Cork
//
// Created by David Bureš on 09.03.2023.
//
import SwiftUI
struct UpdatePackagesView: View
{
@Binding var isShowingSheet: Bool
@State var packageUpdatingStage: PackageUpdatingStage = .updating
@State var packageUpdatingStep: PackageUpdatingProcessSteps = .ready
@State var updateAvailability: PackageUpdateAvailability = .updatesAvailable
@EnvironmentObject var appState: AppState
@EnvironmentObject var updateProgressTracker: UpdateProgressTracker
@EnvironmentObject var outdatedPackageTracker: OutdatedPackageTracker
var body: some View
{
VStack(alignment: .leading, spacing: 10)
{
switch packageUpdatingStage
{
case .updating:
ProgressView(value: updateProgressTracker.updateProgress, total: 10)
{
switch packageUpdatingStep
{
case .ready:
Text("update-packages.updating.ready")
.onAppear
{
updateProgressTracker.updateProgress = 0
packageUpdatingStep = .checkingForUpdates
}
case .checkingForUpdates:
Text("update-packages.updating.checking")
.onAppear
{
Task(priority: .userInitiated)
{
updateAvailability = await updatePackages(updateProgressTracker, outdatedPackageTracker: outdatedPackageTracker)
print("Update availability result: \(updateAvailability)")
if updateAvailability == .noUpdatesAvailable
{
print("Outside update function: No updates available")
packageUpdatingStage = .noUpdatesAvailable
}
else
{
print("Outside update function: Updates available")
packageUpdatingStep = .updatingPackages
}
}
}
case .updatingPackages:
Text("update-packages.updating.updating")
.onAppear
{
Task(priority: .userInitiated)
{
await upgradePackages(updateProgressTracker, appState: appState, outdatedPackageTracker: outdatedPackageTracker)
packageUpdatingStep = .updatingOutdatedPackageTracker
}
}
case .updatingOutdatedPackageTracker:
Text("update-packages.updating.updating-outdated-package")
.onAppear
{
Task(priority: .userInitiated) {
outdatedPackageTracker.outdatedPackages = await getListOfUpgradeablePackages()
updateProgressTracker.updateProgress = 10
if updateProgressTracker.errors.isEmpty
{
packageUpdatingStage = .finished
}
else
{
packageUpdatingStage = .erroredOut
}
}
}
case .finished:
Text("update-packages.updating.finished")
.onAppear
{
packageUpdatingStep = .finished
}
}
}
.frame(width: 200)
.fixedSize()
case .noUpdatesAvailable:
DisappearableSheet(isShowingSheet: $isShowingSheet)
{
ComplexWithIcon(systemName: "checkmark.seal")
{
HeadlineWithSubheadline(
headline: "update-packages.no-updates",
subheadline: "update-packages.no-updates.description",
alignment: .leading
)
.fixedSize()
}
}
case .finished:
DisappearableSheet(isShowingSheet: $isShowingSheet)
{
ComplexWithIcon(systemName: "checkmark.seal")
{
HeadlineWithSubheadline(
headline: "update-packages.finished",
subheadline: "update-packages.finished.description",
alignment: .leading
)
.fixedSize()
}
}
case .erroredOut:
ComplexWithIcon(systemName: "checkmark.seal")
{
VStack(alignment: .leading, spacing: 5)
{
HeadlineWithSubheadline(
headline: "update-packages.error",
subheadline: "update-packages.error.description",
alignment: .leading
)
List
{
ForEach(updateProgressTracker.errors, id: \.self)
{ error in
HStack(alignment: .firstTextBaseline, spacing: 5)
{
Text("⚠️")
Text(error)
}
}
}
.listStyle(.bordered(alternatesRowBackgrounds: false))
.frame(height: 100, alignment: .leading)
HStack
{
Spacer()
DismissSheetButton(isShowingSheet: $appState.isShowingUpdateSheet, customButtonText: "Close")
}
}
.fixedSize()
.onAppear
{
print("Update errors: \(updateProgressTracker.errors)")
}
}
}
}
.padding()
}
}

View File

@ -1,26 +0,0 @@
//
// Update Some Packages View.swift
// Cork
//
// Created by David Bureš on 05.04.2023.
//
import SwiftUI
struct UpdateSomePackagesView: View {
@EnvironmentObject var outdatedPackageTracker: OutdatedPackageTracker
@Binding var isShowingSheet: Bool
var body: some View {
VStack(alignment: .leading, spacing: 10)
{
Text("Would update:")
ForEach(outdatedPackageTracker.outdatedPackages.filter({ $0.isMarkedForUpdating })) { outdatedPackage in
Text(outdatedPackage.packageName)
}
}
.padding()
}
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright ©. All rights reserved.</string>
</dict>
</plist>

View File

@ -0,0 +1,154 @@
// swiftlint:disable all
// swift-format-ignore-file
// swiftformat:disable all
// Generated using tuist https://github.com/tuist/tuist
#if os(macOS)
import AppKit
#elseif os(iOS)
import UIKit
#elseif os(tvOS) || os(watchOS)
import UIKit
#endif
#if canImport(SwiftUI)
import SwiftUI
#endif
// swiftlint:disable superfluous_disable_command file_length implicit_return
// MARK: - Asset Catalogs
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
public enum CorkAsset {
public enum Assets {
public static let accentColor = CorkColors(name: "AccentColor")
public static let customPinFillQuestionmark = CorkImages(name: "custom.pin.fill.questionmark")
public static let customSquareStackBadgePause = CorkImages(name: "custom.square.stack.badge.pause")
public static let customSquareStackBadgePlay = CorkImages(name: "custom.square.stack.badge.play")
public static let customSquareStackBadgeQuestionmark = CorkImages(name: "custom.square.stack.badge.questionmark")
public static let customSquareStackTrianglebadgeExclamationmark = CorkImages(name: "custom.square.stack.trianglebadge.exclamationmark")
}
public enum PreviewAssets {
}
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name
// MARK: - Implementation Details
public final class CorkColors {
public fileprivate(set) var name: String
#if os(macOS)
public typealias Color = NSColor
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
public typealias Color = UIColor
#endif
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, visionOS 1.0, *)
public private(set) lazy var color: Color = {
guard let color = Color(asset: self) else {
fatalError("Unable to load color asset named \(name).")
}
return color
}()
#if canImport(SwiftUI)
private var _swiftUIColor: Any? = nil
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *)
public private(set) var swiftUIColor: SwiftUI.Color {
get {
if self._swiftUIColor == nil {
self._swiftUIColor = SwiftUI.Color(asset: self)
}
return self._swiftUIColor as! SwiftUI.Color
}
set {
self._swiftUIColor = newValue
}
}
#endif
fileprivate init(name: String) {
self.name = name
}
}
public extension CorkColors.Color {
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, visionOS 1.0, *)
convenience init?(asset: CorkColors) {
let bundle = Bundle.module
#if os(iOS) || os(tvOS) || os(visionOS)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(macOS)
self.init(named: NSColor.Name(asset.name), bundle: bundle)
#elseif os(watchOS)
self.init(named: asset.name)
#endif
}
}
#if canImport(SwiftUI)
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *)
public extension SwiftUI.Color {
init(asset: CorkColors) {
let bundle = Bundle.module
self.init(asset.name, bundle: bundle)
}
}
#endif
public struct CorkImages {
public fileprivate(set) var name: String
#if os(macOS)
public typealias Image = NSImage
#elseif os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)
public typealias Image = UIImage
#endif
public var image: Image {
let bundle = Bundle.module
#if os(iOS) || os(tvOS) || os(visionOS)
let image = Image(named: name, in: bundle, compatibleWith: nil)
#elseif os(macOS)
let image = bundle.image(forResource: NSImage.Name(name))
#elseif os(watchOS)
let image = Image(named: name)
#endif
guard let result = image else {
fatalError("Unable to load image asset named \(name).")
}
return result
}
#if canImport(SwiftUI)
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *)
public var swiftUIImage: SwiftUI.Image {
SwiftUI.Image(asset: self)
}
#endif
}
#if canImport(SwiftUI)
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, visionOS 1.0, *)
public extension SwiftUI.Image {
init(asset: CorkImages) {
let bundle = Bundle.module
self.init(asset.name, bundle: bundle)
}
init(asset: CorkImages, label: Text) {
let bundle = Bundle.module
self.init(asset.name, bundle: bundle, label: label)
}
init(decorative asset: CorkImages) {
let bundle = Bundle.module
self.init(decorative: asset.name, bundle: bundle)
}
}
#endif
// swiftlint:enable all
// swiftformat:enable all

View File

@ -0,0 +1,16 @@
// swiftlint:disable all
// swift-format-ignore-file
// swiftformat:disable all
import Foundation// MARK: - Swift Bundle Accessor for Frameworks
private class BundleFinder {}
extension Foundation.Bundle {
/// Since Cork is a application, the bundle for classes within this module can be used directly.
static let module = Bundle(for: BundleFinder.self)
}// MARK: - Objective-C Bundle Accessor
@objc
public class CorkResources: NSObject {
@objc public class var bundle: Bundle {
return .module
}
}// swiftlint:enable all
// swiftformat:enable all

47
Project.swift Normal file
View File

@ -0,0 +1,47 @@
import ProjectDescription
let project = Project(
name: "Cork-Tuist",
settings: .settings(configurations: [
.debug(
name: "Debug",
xcconfig: .relativeToRoot("xcconfigs/Project.xcconfig")
),
.release(
name: "Release",
xcconfig: .relativeToRoot("xcconfigs/Project.xcconfig")
)
]), targets: [
.target(name: "Cork", destinations: [.mac], product: .app, bundleId: "com.davidbures.cork", infoPlist: .file(path: "Cork/Info.plist"), sources: [
"Cork/**/*.swift"
], resources: [
"Cork/**/*.xcassets",
"Cork/**/*.xcstrings",
"PrivacyInfo.xcprivacy",
"Cork/Logic/Helpers/Programs/Sudo Helper"
], dependencies: [
// .target(name: "CorkHelp"),
.external(name: "LaunchAtLogin"),
.external(name: "DavidFoundation")
], settings: .settings(configurations: [
.debug(
name: "Debug",
xcconfig: .relativeToRoot("xcconfigs/Cork.xcconfig")
),
.release(
name: "Release",
xcconfig: .relativeToRoot("xcconfigs/Cork.xcconfig")
)
])),
.target(name: "CorkHelp", destinations: [.mac], product: .bundle, bundleId: "com.davidbures.corkhelp", settings: .settings(configurations: [
.debug(
name: "Debug",
xcconfig: .relativeToRoot("xcconfigs/CorkHelp.xcconfig")
),
.release(
name: "Release",
xcconfig: .relativeToRoot("xcconfigs/CorkHelp.xcconfig")
)
])),
]
)

4
Tuist/Config.swift Normal file
View File

@ -0,0 +1,4 @@
import ProjectDescription
let config = Config(cloud: .cloud(projectId: "buresdv/cork"))

23
Tuist/Package.resolved Normal file
View File

@ -0,0 +1,23 @@
{
"pins" : [
{
"identity" : "davidfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/buresdv/DavidFoundation",
"state" : {
"branch" : "main",
"revision" : "e75dfc53ff6797b6daf5a5b8a96c0fd47df90194"
}
},
{
"identity" : "launchatlogin-modern",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sindresorhus/LaunchAtLogin-Modern",
"state" : {
"revision" : "a04ec1c363be3627734f6dad757d82f5d4fa8fcc",
"version" : "1.1.0"
}
}
],
"version" : 2
}

27
Tuist/Package.swift Normal file
View File

@ -0,0 +1,27 @@
// swift-tools-version: 5.9
import PackageDescription
#if TUIST
import ProjectDescription
let packageSettings = PackageSettings(
// Customize the product types for specific package product
// Default is .staticFramework
// productTypes: ["Alamofire": .framework,]
productTypes: [
"LaunchAtLogin": .staticFramework,
"DavidFoundation": .staticFramework
]
)
#endif
let package = Package(
name: "Cork",
dependencies: [
// Add your own dependencies here:
// .package(url: "https://github.com/Alamofire/Alamofire", from: "5.0.0"),
// You can read more about dependencies here: https://docs.tuist.io/documentation/tuist/dependencies
.package(url: "https://github.com/sindresorhus/LaunchAtLogin-Modern", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/buresdv/DavidFoundation", branch: "main")
]
)

BIN
graph.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

28
xcconfigs/Cork.xcconfig Normal file
View File

@ -0,0 +1,28 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=YES
ASSETCATALOG_COMPILER_APPICON_NAME=AppIcon
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME=AccentColor
CODE_SIGN_ENTITLEMENTS=Cork/Cork.entitlements
CODE_SIGN_IDENTITY=-
CODE_SIGN_IDENTITY[sdk=macosx*]=Apple Development
CODE_SIGN_STYLE=Automatic
COMBINE_HIDPI_IMAGES=YES
CURRENT_PROJECT_VERSION=72
DEAD_CODE_STRIPPING=YES
DEVELOPMENT_ASSET_PATHS="Cork/Preview Content"
DEVELOPMENT_TEAM=ZSVA6DVZHM
ENABLE_HARDENED_RUNTIME=YES
ENABLE_PREVIEWS=YES
GENERATE_INFOPLIST_FILE=YES
INFOPLIST_FILE=Cork/Info.plist
INFOPLIST_KEY_LSApplicationCategoryType=public.app-category.utilities
INFOPLIST_KEY_NSHumanReadableCopyright=
MARKETING_VERSION=1.4.4
PRODUCT_BUNDLE_IDENTIFIER=com.davidbures.Cork
PRODUCT_NAME=$(TARGET_NAME)
SWIFT_EMIT_LOC_STRINGS=YES
SWIFT_VERSION=5.0
LD_RUNPATH_SEARCH_PATHS[config=Debug]=$(inherited) @executable_path/../Frameworks
LD_RUNPATH_SEARCH_PATHS[config=Release]=$(inherited) @executable_path/../Frameworks
LD_RUNPATH_SEARCH_PATHS[config=Self-Compiled]=$(inherited) @executable_path/../Frameworks
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Self-Compiled]=SELF_COMPILED

View File

@ -0,0 +1,21 @@
CLANG_CXX_LANGUAGE_STANDARD=gnu++20
CODE_SIGN_IDENTITY=Apple Development
CODE_SIGN_IDENTITY[sdk=macosx*]=-
CODE_SIGN_STYLE=Automatic
COMBINE_HIDPI_IMAGES=YES
CURRENT_PROJECT_VERSION=1
DEVELOPMENT_TEAM=
ENABLE_USER_SCRIPT_SANDBOXING=NO
GENERATE_INFOPLIST_FILE=YES
INFOPLIST_FILE=CorkHelp/CorkHelp-Info.plist
INFOPLIST_KEY_NSHumanReadableCopyright=
INSTALL_PATH=$(LOCAL_LIBRARY_DIR)/Bundles
MACOSX_DEPLOYMENT_TARGET=13.0
MARKETING_VERSION=0.1
PRODUCT_BUNDLE_IDENTIFIER=com.davidbures.corkhelp
PRODUCT_NAME=$(TARGET_NAME)
PROVISIONING_PROFILE_SPECIFIER=
SKIP_INSTALL=YES
SWIFT_EMIT_LOC_STRINGS=YES
WRAPPER_EXTENSION=help

View File

@ -0,0 +1,69 @@
ALWAYS_SEARCH_USER_PATHS=NO
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS=YES
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED=YES
CLANG_ANALYZER_NONNULL=YES
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION=YES_AGGRESSIVE
CLANG_CXX_LANGUAGE_STANDARD=gnu++17
CLANG_ENABLE_MODULES=YES
CLANG_ENABLE_OBJC_ARC=YES
CLANG_ENABLE_OBJC_WEAK=YES
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING=YES
CLANG_WARN_BOOL_CONVERSION=YES
CLANG_WARN_COMMA=YES
CLANG_WARN_CONSTANT_CONVERSION=YES
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS=YES
CLANG_WARN_DIRECT_OBJC_ISA_USAGE=YES_ERROR
CLANG_WARN_DOCUMENTATION_COMMENTS=YES
CLANG_WARN_EMPTY_BODY=YES
CLANG_WARN_ENUM_CONVERSION=YES
CLANG_WARN_INFINITE_RECURSION=YES
CLANG_WARN_INT_CONVERSION=YES
CLANG_WARN_NON_LITERAL_NULL_CONVERSION=YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF=YES
CLANG_WARN_OBJC_LITERAL_CONVERSION=YES
CLANG_WARN_OBJC_ROOT_CLASS=YES_ERROR
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER=YES
CLANG_WARN_RANGE_LOOP_ANALYSIS=YES
CLANG_WARN_STRICT_PROTOTYPES=YES
CLANG_WARN_SUSPICIOUS_MOVE=YES
CLANG_WARN_UNGUARDED_AVAILABILITY=YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE=YES
CLANG_WARN__DUPLICATE_METHOD_MATCH=YES
COPY_PHASE_STRIP=NO
DEAD_CODE_STRIPPING=YES
ENABLE_STRICT_OBJC_MSGSEND=YES
ENABLE_USER_SCRIPT_SANDBOXING=YES
GCC_C_LANGUAGE_STANDARD=gnu11
GCC_NO_COMMON_BLOCKS=YES
GCC_WARN_64_TO_32_BIT_CONVERSION=YES
GCC_WARN_ABOUT_RETURN_TYPE=YES_ERROR
GCC_WARN_UNDECLARED_SELECTOR=YES
GCC_WARN_UNINITIALIZED_AUTOS=YES_AGGRESSIVE
GCC_WARN_UNUSED_FUNCTION=YES
GCC_WARN_UNUSED_VARIABLE=YES
LOCALIZATION_PREFERS_STRING_CATALOGS=YES
MACOSX_DEPLOYMENT_TARGET=13.0
MTL_FAST_MATH=YES
SDKROOT=macosx
SWIFT_STRICT_CONCURRENCY=targeted
DEBUG_INFORMATION_FORMAT[config=Debug]=dwarf
DEBUG_INFORMATION_FORMAT[config=Release]=dwarf-with-dsym
DEBUG_INFORMATION_FORMAT[config=Self-Compiled]=dwarf-with-dsym
ENABLE_NS_ASSERTIONS[config=Release]=NO
ENABLE_NS_ASSERTIONS[config=Self-Compiled]=NO
ENABLE_TESTABILITY[config=Debug]=YES
GCC_DYNAMIC_NO_PIC[config=Debug]=NO
GCC_OPTIMIZATION_LEVEL[config=Debug]=0
GCC_PREPROCESSOR_DEFINITIONS[config=Debug]=DEBUG=1 $(inherited)
MTL_ENABLE_DEBUG_INFO[config=Debug]=INCLUDE_SOURCE
MTL_ENABLE_DEBUG_INFO[config=Release]=NO
MTL_ENABLE_DEBUG_INFO[config=Self-Compiled]=NO
ONLY_ACTIVE_ARCH[config=Debug]=YES
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Debug]=DEBUG
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Self-Compiled]=SELF_COMPILED
SWIFT_COMPILATION_MODE[config=Release]=wholemodule
SWIFT_COMPILATION_MODE[config=Self-Compiled]=wholemodule
SWIFT_OPTIMIZATION_LEVEL[config=Debug]=-Onone
SWIFT_OPTIMIZATION_LEVEL[config=Release]=-O
SWIFT_OPTIMIZATION_LEVEL[config=Self-Compiled]=-O