14
14
15
15
package com.firebase.ui.auth.compose
16
16
17
+ import com.firebase.ui.auth.compose.configuration.auth_provider.AuthProvider
17
18
import com.google.firebase.auth.AuthCredential
18
19
import com.google.firebase.auth.AuthResult
19
20
import com.google.firebase.auth.FirebaseUser
@@ -205,6 +206,44 @@ abstract class AuthState private constructor() {
205
206
" AuthState.RequiresProfileCompletion(user=$user , missingFields=$missingFields )"
206
207
}
207
208
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
+
239
+ /* *
240
+ * Pending credential for an anonymous upgrade merge conflict.
241
+ *
242
+ * Emitted when an anonymous user attempts to convert to a permanent account but
243
+ * Firebase detects that the target email already belongs to another user. The UI can
244
+ * prompt the user to resolve the conflict by signing in with the existing account and
245
+ * later linking the stored [pendingCredential].
246
+ */
208
247
class MergeConflict (
209
248
val pendingCredential : AuthCredential
210
249
) : AuthState() {
@@ -239,4 +278,4 @@ abstract class AuthState private constructor() {
239
278
@JvmStatic
240
279
val Cancelled : Cancelled = Cancelled ()
241
280
}
242
- }
281
+ }
0 commit comments