Review upgrade icons (#1141)

- Add to "General" module on macOS
- Restore in profiles list/grid, removed in #1139
This commit is contained in:
Davide 2025-02-05 15:38:25 +01:00 committed by GitHub
parent 6ba8b32bef
commit 91823f1572
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View File

@ -121,6 +121,10 @@ private struct MarkerView: View {
ZStack {
ThemeImage(profileId == nextProfileId ? .pending : tunnel.statusImageName)
.opaque(requiredFeatures == nil && (profileId == nextProfileId || profileId == tunnel.currentProfile?.id))
if let requiredFeatures {
PurchaseRequiredView(features: requiredFeatures)
}
}
.frame(width: 24)
}

View File

@ -51,8 +51,13 @@ struct ModuleListView: View, Routable {
var body: some View {
List(selection: $selectedModuleId) {
Section {
NavigationLink(Strings.Global.Nouns.general, value: ProfileSplitView.Detail.general)
.tag(Self.generalModuleId)
NavigationLink(value: ProfileSplitView.Detail.general) {
HStack {
Text(Strings.Global.Nouns.general)
PurchaseRequiredView(features: requiredGeneralFeatures)
}
}
.tag(Self.generalModuleId)
}
Group {
ForEach(profileEditor.modules, id: \.id) { module in
@ -116,6 +121,17 @@ private extension ModuleListView {
}
private extension ModuleListView {
var requiredGeneralFeatures: Set<AppFeature> {
var features: Set<AppFeature> = []
if profileEditor.isShared {
features.insert(.sharing)
}
if profileEditor.isAvailableForTV {
features.insert(.appleTV)
}
return features
}
func moveModules(from offsets: IndexSet, to newOffset: Int) {
profileEditor.moveModules(from: offsets, to: newOffset)
// XXX: selection is lost after move, reset as a workaround