@@ -26,8 +26,6 @@ public struct AuthPickerView<Content: View> {
2626 @Environment ( AuthService . self) private var authService
2727 private let content : ( ) -> Content
2828
29- // View-layer state for handling auto-linking flow
30- @State private var pendingCredentialForLinking : AuthCredential ?
3129 // View-layer error state
3230 @State private var error : AlertError ?
3331}
@@ -91,54 +89,6 @@ extension AuthPickerView: View {
9189 }
9290 }
9391
94- /// View-layer logic: Handle account conflicts with type-specific behavior
95- private func handleAccountConflict( _ conflict: AccountConflictContext ? ) {
96- guard let conflict = conflict else { return }
97-
98- // Only auto-handle anonymous upgrade conflicts
99- if conflict. conflictType == . anonymousUpgradeConflict {
100- Task {
101- do {
102- // Sign out the anonymous user
103- try await authService. signOut ( )
104-
105- // Sign in with the new credential
106- _ = try await authService. signIn ( credentials: conflict. credential)
107-
108- // Successfully handled - conflict is cleared automatically by reset()
109- } catch let caughtError {
110- // Show error in alert
111- reportError ( caughtError)
112- }
113- }
114- } else {
115- // Other conflicts: store credential for potential linking after sign-in
116- pendingCredentialForLinking = conflict. credential
117- // Show error modal for user to see and handle
118- error = AlertError (
119- message: conflict. message,
120- underlyingError: conflict. underlyingError
121- )
122- }
123- }
124-
125- /// View-layer logic: Attempt to link pending credential after successful sign-in
126- private func attemptAutoLinkPendingCredential( ) {
127- guard let credential = pendingCredentialForLinking else { return }
128-
129- Task {
130- do {
131- try await authService. linkAccounts ( credentials: credential)
132- // Successfully linked, clear the pending credential
133- pendingCredentialForLinking = nil
134- } catch let caughtError {
135- // Show error - user is already signed in but linking failed
136- reportError ( caughtError)
137- pendingCredentialForLinking = nil
138- }
139- }
140- }
141-
14292 @ToolbarContentBuilder
14393 var toolbar : some ToolbarContent {
14494 ToolbarItem ( placement: . topBarTrailing) {
0 commit comments