Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Loop/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ struct SettingsView: View {
servicesSection
}

// Catch-all for menu items without a dedicated section (e.g. .custom).
// .configuration items render in the configuration section and
// .support items in the Support section, so exclude both to avoid
// showing them twice.
ForEach(pluginMenuItems.filter({ $0.section != .support && $0.section != .configuration })) { item in
// Render custom menu items here. Built-in sections render at their destinations.
ForEach(pluginMenuItems.filter {
$0.section != .support &&
$0.section != .configuration &&
$0.section != .therapySettingsSupport
}) { item in
item.view
}

Expand Down Expand Up @@ -442,7 +443,8 @@ extension SettingsView {
viewModel: TherapySettingsViewModel(
therapySettings: viewModel.therapySettings(),
delegate: viewModel.therapySettingsViewModelDelegate
)
),
supportMenuItems: pluginMenuItems.filter { $0.section == .therapySettingsSupport }.map(\.view)
)
.environmentObject(displayGlucosePreference)
.environment(\.dismissAction, self.dismiss)
Expand Down Expand Up @@ -487,7 +489,7 @@ extension SettingsView {
}
}

private var pluginMenuItems: [PluginMenuItem<some View>] {
private var pluginMenuItems: [PluginMenuItem<AnyView>] {
self.viewModel.availableSupports.flatMap { plugin in
plugin.configurationMenuItems().enumerated().map { index, item in
PluginMenuItem(section: item.section, view: item.view, pluginIdentifier: plugin.pluginIdentifier, offset: index)
Expand Down