mirror of https://github.com/buresdv/Cork
+ More work on adoptable app exclusion
This commit is contained in:
parent
132b234e29
commit
a84e7f5d87
|
|
@ -58130,6 +58130,42 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"start-page.adoptable-packages.available.%lld-excluded.%lld" : {
|
||||
"comment" : "A headline that describes how many adoptable packages are available, including any that have been excluded. The first argument is the count of adoptable packages that are not excluded. The second argument is the count of adoptable packages that have been excluded.",
|
||||
"isCommentAutoGenerated" : true,
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "There are %1$lld installed apps -excluded.%2$lld"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"start-page.adoptable-packages.excluded.%lld" : {
|
||||
"comment" : "A subheading displaying the number of apps that will not be adopted. The argument is the count of apps that will not be adopted.",
|
||||
"isCommentAutoGenerated" : true,
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"variations" : {
|
||||
"plural" : {
|
||||
"one" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "There is %lld additional app that is ignored"
|
||||
}
|
||||
},
|
||||
"other" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "There are %lld additional apps that are ignored"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"start-page.analytics.disabled" : {
|
||||
"localizations" : {
|
||||
"cs" : {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import CorkModels
|
|||
struct AdoptablePackagesSection: View
|
||||
{
|
||||
@Default(.allowMassPackageAdoption) var allowMassPackageAdoption: Bool
|
||||
@Default(.enableExtraAnimations) var enableExtraAnimations: Bool
|
||||
|
||||
@Environment(AppState.self) var appState: AppState
|
||||
@Environment(BrewPackagesTracker.self) var brewPackagesTracker: BrewPackagesTracker
|
||||
|
|
@ -23,6 +24,7 @@ struct AdoptablePackagesSection: View
|
|||
|
||||
@Query private var excludedApps: [ExcludedAdoptableApp]
|
||||
|
||||
/// Includes only apps that are **not ignored**, but still includes apps that are **not marked for adoption**
|
||||
private var adoptableAppsExcludingThoseIgnored: [BrewPackagesTracker.AdoptableApp]
|
||||
{
|
||||
return brewPackagesTracker.adoptableApps.filter { adoptableApp in
|
||||
|
|
@ -31,6 +33,12 @@ struct AdoptablePackagesSection: View
|
|||
.sorted(by: { $0.caskName < $1.caskName })
|
||||
}
|
||||
|
||||
/// Includes only apps that are **not ignored**, and only includes those that are **marked for adoption**
|
||||
private var adoptableAppsThatWillBeAdopted: [BrewPackagesTracker.AdoptableApp]
|
||||
{
|
||||
return adoptableAppsExcludingThoseIgnored.filter(\.isMarkedForAdoption)
|
||||
}
|
||||
|
||||
private var ignoredAdoptableApps: [BrewPackagesTracker.AdoptableApp]
|
||||
{
|
||||
return brewPackagesTracker.adoptableApps.filter { adoptableApp in
|
||||
|
|
@ -53,20 +61,40 @@ struct AdoptablePackagesSection: View
|
|||
{
|
||||
HStack(alignment: .firstTextBaseline)
|
||||
{
|
||||
Text("start-page.adoptable-packages.available.\(brewPackagesTracker.adoptableApps.count)")
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("start-page.adoptable-packages.available.\(adoptableAppsExcludingThoseIgnored.count)")
|
||||
.font(.headline)
|
||||
|
||||
Text("start-page.adoptable-packages.excluded.\(excludedApps.count)")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.modify
|
||||
{ viewProxy in
|
||||
if enableExtraAnimations
|
||||
{
|
||||
viewProxy
|
||||
.animation(.bouncy, value: adoptableAppsExcludingThoseIgnored.count)
|
||||
.animation(.bouncy, value: excludedApps.count)
|
||||
.contentTransition(.numericText())
|
||||
}
|
||||
else
|
||||
{
|
||||
viewProxy
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button
|
||||
{
|
||||
isShowingAdoptionWarning = true
|
||||
|
||||
AppConstants.shared.logger.info("Will adopt \(brewPackagesTracker.adoptableAppsSelectedToBeAdopted.count, privacy: .public) apps")
|
||||
AppConstants.shared.logger.info("Will adopt \(adoptableAppsThatWillBeAdopted.count, privacy: .public) apps")
|
||||
} label: {
|
||||
if brewPackagesTracker.hasSelectedOnlySomeAppsToAdopt
|
||||
{
|
||||
Text("action.adopt-some-packages.\(brewPackagesTracker.adoptableAppsSelectedToBeAdopted.count)")
|
||||
Text("action.adopt-some-packages.\(adoptableAppsThatWillBeAdopted.count)")
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
import Foundation
|
||||
import ApplicationInspector
|
||||
import CorkShared
|
||||
import SwiftData
|
||||
|
||||
public extension BrewPackagesTracker
|
||||
{
|
||||
|
|
@ -27,8 +28,11 @@ public extension BrewPackagesTracker
|
|||
|
||||
public var app: Application?
|
||||
|
||||
public init(caskName: String, description: String?, appExecutable: String)
|
||||
{
|
||||
public init(
|
||||
caskName: String,
|
||||
description: String?,
|
||||
appExecutable: String
|
||||
) {
|
||||
self.caskName = caskName
|
||||
self.appExecutable = appExecutable
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue