Last active
December 11, 2022 19:29
-
-
Save aymenjegham/f190314932af9ed23239aba318b6b4c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserDatasourceImpl @Inject constructor( | |
private val auth: FirebaseAuth, | |
) : UserDatasource { | |
override fun registerUserWithEmailAndPassword( | |
userName: String, | |
password: String, | |
): NetworkResult<Any> { | |
lateinit var networkResponse: NetworkResult<Any> | |
auth.createUserWithEmailAndPassword(userName, password).addOnCompleteListener { task -> | |
if (task.isSuccessful) { | |
networkResponse = NetworkResult.Success(task.result) | |
} | |
}.addOnFailureListener { exception -> | |
networkResponse = NetworkResult.Error(message = exception.message) | |
} | |
return networkResponse | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment