+ Version selection without the list item being deselected

This commit is contained in:
David Bureš 2025-04-29 16:58:11 +02:00
parent 56f82f8a52
commit cefc5a60bd
5 changed files with 145 additions and 15 deletions

View File

@ -105,6 +105,75 @@
}
}
},
"%@: %@" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@: %2$@"
}
}
}
},
"→" : {
"extractionState" : "stale",
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"pt-PT" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "→"
}
}
}
},
"⚠️" : {
"localizations" : {
"cs" : {

View File

@ -14,10 +14,18 @@ struct AddFormulaView: View
{
struct PackageSelectedToBeInstalled: Identifiable, Equatable, Hashable
{
var id: UUID = .init()
var id: UUID
var package: BrewPackage?
var version: String?
init(package: BrewPackage? = nil, version: String? = nil) {
self.package = package
self.version = version
self.id = package?.id ?? .init()
}
}
@Environment(\.dismiss) var dismiss: DismissAction
@ -113,6 +121,9 @@ struct AddFormulaView: View
{
SheetTemplate(isShowingTitle: shouldShowSheetTitle)
{
#if DEBUG
Text("\(foundPackageSelection?.package?.name ?? "nil"): \(foundPackageSelection?.version ?? "nil")")
#endif
Group
{
switch packageInstallationProcessStep

View File

@ -5,9 +5,9 @@
// Created by David Bureš on 29.09.2023.
//
import ButtonKit
import CorkShared
import SwiftUI
import ButtonKit
struct PresentingSearchResultsView: View
{
@ -104,16 +104,19 @@ struct PresentingSearchResultsView: View
{
if #available(macOS 14.0, *)
{
ContentUnavailableView {
ContentUnavailableView
{
Label("add-package.search.results.packages.none-found", image: "custom.shippingbox.badge.magnifyingglass")
} description: {
Text("add.package.search.results.packages.none-found.description")
} actions: {
EmptyView()
}
} else {
VStack(alignment: .center, spacing: 5) {
}
else
{
VStack(alignment: .center, spacing: 5)
{
Text("add-package.search.results.packages.none-found")
restartSearchButton
@ -126,7 +129,8 @@ struct PresentingSearchResultsView: View
{
PreviewPackageButtonWithCustomAction
{
guard let selectedPackage = foundPackageSelection?.package else
guard let selectedPackage = foundPackageSelection?.package
else
{
AppConstants.shared.logger.error("Failed to preview package")
@ -158,7 +162,8 @@ struct PresentingSearchResultsView: View
// This has to be an AsyncButton so it shakes
AsyncButton
{
guard let packageToInstall = foundPackageSelection?.package else
guard let packageToInstall = foundPackageSelection?.package
else
{
throw PackageInstallationInitializationError.couldNotStartInstallProcessWithPackage(package: nil)
}

View File

@ -0,0 +1,24 @@
//
// Excluded From Comparing.swift
// Cork
//
// Created by David Bureš - P on 29.04.2025.
//
import Foundation
@propertyWrapper
public struct ExcludedFromComparing<Value>: Equatable
{
public var wrappedValue: Value
public init(wrappedValue: Value)
{
self.wrappedValue = wrappedValue
}
public static func == (_: ExcludedFromComparing<Value>, _: ExcludedFromComparing<Value>) -> Bool
{
return true
}
}

View File

@ -0,0 +1,21 @@
//
// Excluded from Hashing.swift
// Cork
//
// Created by David Bureš - P on 29.04.2025.
//
import Foundation
@propertyWrapper
public struct ExcludedFromHashing<Value: Equatable>: Hashable
{
public var wrappedValue: Value
public init(wrappedValue value: Value)
{
self.wrappedValue = value
}
public func hash(into _: inout Hasher) {}
}