Skip to content

Commit e31ffec

Browse files
committed
chore: remove unused comments and code
1 parent 9c665ca commit e31ffec

File tree

2 files changed

+3
-83
lines changed

2 files changed

+3
-83
lines changed

auth/src/main/java/com/firebase/ui/auth/compose/AuthState.kt

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
package com.firebase.ui.auth.compose
1616

17-
import com.firebase.ui.auth.compose.configuration.auth_provider.AuthProvider
1817
import com.google.firebase.auth.AuthCredential
1918
import com.google.firebase.auth.AuthResult
2019
import com.google.firebase.auth.FirebaseUser
@@ -206,36 +205,6 @@ abstract class AuthState private constructor() {
206205
"AuthState.RequiresProfileCompletion(user=$user, missingFields=$missingFields)"
207206
}
208207

209-
/**
210-
* The user needs to sign in with a different provider.
211-
*
212-
* Emitted when a user tries to sign up with an email that already exists
213-
* and needs to use the existing provider to sign in instead.
214-
*
215-
* @property provider The [AuthProvider] the user should sign in with
216-
* @property email The email address of the existing account
217-
*/
218-
class RequiresSignIn(
219-
val provider: AuthProvider,
220-
val email: String
221-
) : AuthState() {
222-
override fun equals(other: Any?): Boolean {
223-
if (this === other) return true
224-
if (other !is RequiresSignIn) return false
225-
return provider == other.provider &&
226-
email == other.email
227-
}
228-
229-
override fun hashCode(): Int {
230-
var result = provider.hashCode()
231-
result = 31 * result + email.hashCode()
232-
return result
233-
}
234-
235-
override fun toString(): String =
236-
"AuthState.RequiresSignIn(provider=$provider, email=$email)"
237-
}
238-
239208
/**
240209
* Pending credential for an anonymous upgrade merge conflict.
241210
*

auth/src/main/java/com/firebase/ui/auth/compose/configuration/auth_provider/EmailAuthProvider+FirebaseAuthUI.kt

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ internal class CredentialForLinking(
109109
* // This means email already exists - show merge conflict UI
110110
* }
111111
* ```
112-
*
113-
* **Old library reference:**
114-
* - EmailProviderResponseHandler.java:42-84 (startSignIn implementation)
115-
* - AuthOperationManager.java:64-74 (createOrLinkUserWithEmailAndPassword)
116-
* - RegisterEmailFragment.java:270-287 (validation and triggering sign-up)
117-
* - ProfileMerger.java:34-56 (profile merging after sign-up)
118112
*/
119113
internal suspend fun FirebaseAuthUI.createOrLinkUserWithEmailAndPassword(
120114
context: Context,
@@ -172,11 +166,6 @@ internal suspend fun FirebaseAuthUI.createOrLinkUserWithEmailAndPassword(
172166
if (canUpgrade && pendingCredential != null) {
173167
// Anonymous upgrade collision: emit merge conflict state
174168
updateAuthState(AuthState.MergeConflict(pendingCredential))
175-
} else {
176-
// Non-upgrade collision: user exists with this email
177-
// TODO: Fetch top provider and emit AuthState.RequiresSignIn(provider, email)
178-
// For now, just emit the error
179-
updateAuthState(AuthState.Error(authException))
180169
}
181170
throw authException
182171
} catch (e: CancellationException) {
@@ -276,12 +265,6 @@ internal suspend fun FirebaseAuthUI.createOrLinkUserWithEmailAndPassword(
276265
* // UI shows merge conflict resolution screen
277266
* }
278267
* ```
279-
*
280-
* **Old library reference:**
281-
* - WelcomeBackPasswordHandler.java:45-118 (startSignIn implementation)
282-
* - AuthOperationManager.java:76-84 (signInAndLinkWithCredential)
283-
* - AuthOperationManager.java:97-108 (safeLink for social providers)
284-
* - AuthOperationManager.java:92-95 (validateCredential for email-only)
285268
*/
286269
internal suspend fun FirebaseAuthUI.signInWithEmailAndPassword(
287270
context: Context,
@@ -450,13 +433,6 @@ internal suspend fun FirebaseAuthUI.signInWithEmailAndPassword(
450433
* )
451434
* // User signed in with email link (passwordless)
452435
* ```
453-
*
454-
* **Old library reference:**
455-
* - AuthOperationManager.java:76-84 (signInAndLinkWithCredential implementation)
456-
* - ProfileMerger.java:34-56 (profile merging after sign-in)
457-
* - SocialProviderResponseHandler.java:69-74 (usage with profile merge)
458-
* - PhoneProviderResponseHandler.java:38-40 (usage for phone auth)
459-
* - EmailLinkSignInHandler.java:217 (usage for email link)
460436
*/
461437
internal suspend fun FirebaseAuthUI.signInAndLinkWithCredential(
462438
config: AuthUIConfiguration,
@@ -489,10 +465,6 @@ internal suspend fun FirebaseAuthUI.signInAndLinkWithCredential(
489465
} else {
490466
updateAuthState(AuthState.Error(authException))
491467
}
492-
} else {
493-
// Non-anonymous collision: could be same email different provider
494-
// TODO: Fetch providers and emit AuthState.RequiresSignIn
495-
updateAuthState(AuthState.Error(authException))
496468
}
497469
throw authException
498470
} catch (e: CancellationException) {
@@ -640,13 +612,6 @@ internal suspend fun FirebaseAuthUI.signInAndLinkWithCredential(
640612
* // Session includes anonymous user ID for validation
641613
* // When user clicks link, anonymous account is upgraded to permanent account
642614
* ```
643-
*
644-
* **Old library reference:**
645-
* - EmailLinkSendEmailHandler.java:26-55 (complete implementation)
646-
* - EmailLinkSendEmailHandler.java:38-39 (session ID generation)
647-
* - EmailLinkSendEmailHandler.java:47-48 (DataStore persistence)
648-
* - EmailActivity.java:92-93 (saving credential for linking before sending email)
649-
*
650615
* @see signInWithEmailLink
651616
* @see EmailLinkPersistenceManager.saveCredentialForLinking
652617
* @see com.google.firebase.auth.FirebaseAuth.sendSignInLinkToEmail
@@ -742,14 +707,6 @@ internal suspend fun FirebaseAuthUI.sendSignInLinkToEmail(
742707
* @throws AuthException.NetworkException if a network error occurs
743708
* @throws AuthException.UnknownException for other errors
744709
*
745-
* **Old library reference:**
746-
* - EmailLinkSignInHandler.java:43-100 (complete validation and sign-in flow)
747-
* - EmailLinkSignInHandler.java:53-56 (retrieve session from DataStore)
748-
* - EmailLinkSignInHandler.java:58-63 (parse link using EmailLinkParser)
749-
* - EmailLinkSignInHandler.java:65-85 (same-device validation)
750-
* - EmailLinkSignInHandler.java:87-96 (anonymous user ID validation)
751-
* - EmailLinkSignInHandler.java:217 (DataStore cleanup after success)
752-
*
753710
* @see sendSignInLinkToEmail for sending the initial email link
754711
*/
755712
internal suspend fun FirebaseAuthUI.signInWithEmailLink(
@@ -758,7 +715,7 @@ internal suspend fun FirebaseAuthUI.signInWithEmailLink(
758715
provider: AuthProvider.Email,
759716
email: String,
760717
emailLink: String,
761-
): AuthResult {
718+
): AuthResult? {
762719
try {
763720
updateAuthState(AuthState.Loading("Signing in with email link..."))
764721

@@ -859,7 +816,7 @@ internal suspend fun FirebaseAuthUI.signInWithEmailLink(
859816
}
860817

861818
// Return the link result (will be non-null if successful)
862-
linkResult!!
819+
linkResult
863820
} else {
864821
// Non-upgrade: Sign in with email link, then link social credential
865822
val emailLinkResult = auth.signInWithCredential(emailLinkCredential).await()
@@ -884,7 +841,7 @@ internal suspend fun FirebaseAuthUI.signInWithEmailLink(
884841
)
885842
}
886843

887-
linkResult!!
844+
linkResult
888845
}
889846
}
890847

@@ -971,13 +928,7 @@ internal suspend fun FirebaseAuthUI.signInWithEmailLink(
971928
* // User receives email with custom continue URL
972929
* ```
973930
*
974-
* **Old library reference:**
975-
* - RecoverPasswordHandler.java:21-33 (startReset method)
976-
* - RecoverPasswordActivity.java:131-133 (resetPassword caller)
977-
* - RecoverPasswordActivity.java:76-91 (error handling for invalid user/credentials)
978-
*
979931
* @see com.google.firebase.auth.ActionCodeSettings
980-
* @since 10.0.0
981932
*/
982933
internal suspend fun FirebaseAuthUI.sendPasswordResetEmail(
983934
email: String,

0 commit comments

Comments
 (0)