Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AccountSetup view ignoring all identity providers per section but one #81

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Changes from 4 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
22 changes: 11 additions & 11 deletions Sources/SpeziAccount/AccountSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// SPDX-License-Identifier: MIT
//

import OrderedCollections
import SpeziViews
import SwiftUI

Expand Down Expand Up @@ -139,20 +138,21 @@ public struct AccountSetup<Header: View, Continue: View>: View {
EmptyServicesWarning()
} else {
VStack {
let categorized = account.accountSetupComponents.reduce(into: OrderedDictionary()) { partialResult, component in
let components = account.accountSetupComponents.reduce(
into: [AccountSetupSection: [any AnyAccountSetupComponent]]()
) { dict, component in
guard component.configuration.isEnabled else {
return
}
partialResult[component.configuration.section] = component
dict[component.configuration.section, default: []].append(component)
}

ForEach(categorized.keys.sorted(), id: \.self) { placement in
if let component = categorized[placement] {
component.anyView

if categorized.keys.last != placement {
ServicesDivider()
}
.sorted { $0.key < $1.key }
.flatMap(\.value)

ForEach(0..<components.endIndex, id: \.self) { idx in
components[idx].anyView
if idx < components.endIndex - 1 {
ServicesDivider()
}
}
}
Expand Down
Loading