+ 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" : { "action.inspect-error" : {
"localizations" : { "localizations" : {
@ -15626,7 +15633,8 @@
}, },
"adoptable-packages.excluded.label" : { "adoptable-packages.excluded.label" : {
"comment" : "A label for the section that lists apps that are excluded from being adopted.", "comment" : "A label for the section that lists apps that are excluded from being adopted.",
"isCommentAutoGenerated" : true "isCommentAutoGenerated" : true,
"shouldTranslate" : false
}, },
"adoptable-packages.label" : { "adoptable-packages.label" : {
"comment" : "The label for the disclosure group that lists adoptable packages.", "comment" : "The label for the disclosure group that lists adoptable packages.",
@ -22646,7 +22654,8 @@
"value" : "error.data-downloading.couldnt-execute-request.%@" "value" : "error.data-downloading.couldnt-execute-request.%@"
} }
} }
} },
"shouldTranslate" : false
}, },
"error.data-downloading.invalid-response.%lld" : { "error.data-downloading.invalid-response.%lld" : {
"localizations" : { "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" : { "settings.discoverability.mass-adoption.toggle" : {
"comment" : "A toggle that allows or disallows mass adoption of packages.", "comment" : "A toggle that allows or disallows mass adoption of packages.",
"isCommentAutoGenerated" : true, "isCommentAutoGenerated" : true,

View File

@ -17,6 +17,7 @@ struct DiscoverabilityPane: View
@Default(.discoverabilityDaySpan) var discoverabilityDaySpan: DiscoverabilityDaySpans @Default(.discoverabilityDaySpan) var discoverabilityDaySpan: DiscoverabilityDaySpans
@Default(.sortTopPackagesBy) var sortTopPackagesBy: TopPackageSorting @Default(.sortTopPackagesBy) var sortTopPackagesBy: TopPackageSorting
@Default(.allowMassPackageAdoption) var allowMassPackageAdoption: Bool @Default(.allowMassPackageAdoption) var allowMassPackageAdoption: Bool
@Default(.hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable) var hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable: Bool
@Environment(AppState.self) var appState: AppState @Environment(AppState.self) var appState: AppState
@ -39,17 +40,30 @@ struct DiscoverabilityPane: View
} }
.toggleStyle(.switch) .toggleStyle(.switch)
.disabled(appState.isLoadingTopPackages) .disabled(appState.isLoadingTopPackages)
Defaults.Toggle(key: .allowMassPackageAdoption)
{
Text("settings.discoverability.mass-adoption.toggle")
}
.disabled(!enableDiscoverability)
Divider() Divider()
Form Form
{ {
LabeledContent
{
VStack(alignment: .leading, spacing: 6)
{
Defaults.Toggle(key: .allowMassPackageAdoption)
{
Text("settings.discoverability.mass-adoption.toggle")
}
.disabled(!enableDiscoverability)
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) Picker("settings.discoverability.time-span", selection: $discoverabilityDaySpan)
{ {
ForEach(DiscoverabilityDaySpans.allCases) ForEach(DiscoverabilityDaySpans.allCases)

View File

@ -85,11 +85,7 @@ struct AdoptablePackagesSection: View
{ {
if allowMassPackageAdoption if allowMassPackageAdoption
{ {
if !brewPackagesTracker.adoptableAppsNonExcluded.isEmpty if !(hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable && brewPackagesTracker.adoptableAppsNonExcluded.isEmpty)
{
adoptablePackagesSectionContent
}
else if !hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable
{ {
adoptablePackagesSectionContent adoptablePackagesSectionContent
} }
@ -154,18 +150,22 @@ struct AdoptablePackagesSection: View
Spacer() Spacer()
startAdoptionProcessButton HStack
if adoptablePackagesHeadlineState == .showsExcludedPackagesOnly
{ {
hideAdoptablePackagesSectionIfThereAreOnlyIgnoredAppsButton startAdoptionProcessButton
.transition(.asymmetric(
insertion: .push(from: .trailing), if adoptablePackagesHeadlineState == .showsExcludedPackagesOnly
removal: .push(from: .leading) {
)) hideAdoptablePackagesSectionIfThereAreOnlyIgnoredAppsButton
.transition(.asymmetric(
insertion: .push(from: .trailing),
removal: .push(from: .leading)
))
}
} }
} }
.animation(.smooth, value: adoptablePackagesHeadlineState)
if !brewPackagesTracker.adoptableAppsNonExcluded.isEmpty if !brewPackagesTracker.adoptableAppsNonExcluded.isEmpty
{ {
DisclosureGroup(isExpanded: $isAdoptablePackagesDisclosureGroupOpened.animation()) { DisclosureGroup(isExpanded: $isAdoptablePackagesDisclosureGroupOpened.animation()) {
@ -237,7 +237,7 @@ struct AdoptablePackagesSection: View
{ {
hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true
} label: { } 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) .keyboardShortcut(.defaultAction)
} }
@ -247,7 +247,7 @@ struct AdoptablePackagesSection: View
{ {
hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true hideAdoptablePackagesSectionIfThereAreOnlyExcludedAppsAvailable = true
} label: { } 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) .keyboardShortcut(.defaultAction)
} }
@ -565,3 +565,4 @@ struct AdoptablePackageListItem: View
} }
} }
} }