+ Finished adoptable app exclusion

This commit is contained in:
David Bureš 2025-12-04 23:27:20 +01:00
parent 30f0f07d14
commit 2afda709de
No known key found for this signature in database
3 changed files with 72 additions and 26 deletions

View File

@ -6635,8 +6635,15 @@
}
}
},
"action.hide-adoptable-packages-section-if-only-excluded-apps-available.action" : {
"action.hide-adoptable-packages-section-if-only-excluded-apps-available.confirm" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Hide section"
}
}
}
},
"action.inspect-error" : {
"localizations" : {
@ -15626,7 +15633,8 @@
},
"adoptable-packages.excluded.label" : {
"comment" : "A label for the section that lists apps that are excluded from being adopted.",
"isCommentAutoGenerated" : true
"isCommentAutoGenerated" : true,
"shouldTranslate" : false
},
"adoptable-packages.label" : {
"comment" : "The label for the disclosure group that lists adoptable packages.",
@ -22646,7 +22654,8 @@
"value" : "error.data-downloading.couldnt-execute-request.%@"
}
}
}
},
"shouldTranslate" : false
},
"error.data-downloading.invalid-response.%lld" : {
"localizations" : {
@ -48838,6 +48847,28 @@
}
}
},
"settings.discoverability.mass-adoption.hide-adoptable-packages-section-if-there-are-only-excluded-apps-available.label" : {
"comment" : "A label describing a toggle that controls whether the \"Adoptable Packages\" section is hidden when there are only excluded apps available.",
"isCommentAutoGenerated" : true,
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Hide when all adoptable apps are excluded"
}
}
}
},
"settings.discoverability.mass-adoption.label" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "App adoption:"
}
}
}
},
"settings.discoverability.mass-adoption.toggle" : {
"comment" : "A toggle that allows or disallows mass adoption of packages.",
"isCommentAutoGenerated" : true,

View File

@ -17,6 +17,7 @@ struct DiscoverabilityPane: View
@Default(.discoverabilityDaySpan) var discoverabilityDaySpan: DiscoverabilityDaySpans
@Default(.sortTopPackagesBy) var sortTopPackagesBy: TopPackageSorting
@Default(.allowMassPackageAdoption) var allowMassPackageAdoption: Bool
@Default(.hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable) var hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable: Bool
@Environment(AppState.self) var appState: AppState
@ -40,16 +41,29 @@ struct DiscoverabilityPane: View
.toggleStyle(.switch)
.disabled(appState.isLoadingTopPackages)
Divider()
Form
{
LabeledContent
{
VStack(alignment: .leading, spacing: 6)
{
Defaults.Toggle(key: .allowMassPackageAdoption)
{
Text("settings.discoverability.mass-adoption.toggle")
}
.disabled(!enableDiscoverability)
Divider()
Form
Defaults.Toggle(key: .hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable)
{
Text("settings.discoverability.mass-adoption.hide-adoptable-packages-section-if-there-are-only-excluded-apps-available.label")
}
}
} label: {
Text("settings.discoverability.mass-adoption.label")
}
Picker("settings.discoverability.time-span", selection: $discoverabilityDaySpan)
{
ForEach(DiscoverabilityDaySpans.allCases)

View File

@ -85,11 +85,7 @@ struct AdoptablePackagesSection: View
{
if allowMassPackageAdoption
{
if !brewPackagesTracker.adoptableAppsNonExcluded.isEmpty
{
adoptablePackagesSectionContent
}
else if !hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable
if !(hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable && brewPackagesTracker.adoptableAppsNonExcluded.isEmpty)
{
adoptablePackagesSectionContent
}
@ -154,6 +150,8 @@ struct AdoptablePackagesSection: View
Spacer()
HStack
{
startAdoptionProcessButton
if adoptablePackagesHeadlineState == .showsExcludedPackagesOnly
@ -165,6 +163,8 @@ struct AdoptablePackagesSection: View
))
}
}
}
.animation(.smooth, value: adoptablePackagesHeadlineState)
if !brewPackagesTracker.adoptableAppsNonExcluded.isEmpty
{
@ -237,7 +237,7 @@ struct AdoptablePackagesSection: View
{
hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true
} label: {
Text("action.hide-adoptable-packages-section-if-only-excluded-apps-available")
Text("action.hide-adoptable-packages-section-if-only-excluded-apps-available.confirm")
}
.keyboardShortcut(.defaultAction)
}
@ -247,7 +247,7 @@ struct AdoptablePackagesSection: View
{
hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true
} label: {
Text("action.hide-adoptable-packages-section-if-only-excluded-apps-available")
Text("action.hide-adoptable-packages-section-if-only-excluded-apps-available.confirm")
}
.keyboardShortcut(.defaultAction)
}
@ -565,3 +565,4 @@ struct AdoptablePackageListItem: View
}
}
}