description |
---|
initiates the update email flow that allows a user to change to a new email |
Methods |
---|
updateEmail(configuration: UpdateEmailConfiguration) -> CompletableFuture<UpdateEmailResponse> |
UpdateEmailResponse: Response<Boolean>()
The Completable
resolves with a true boolean value if update email is successful and rejects with a specific error code if the request fails.
class MagicActivity: AppCompatActivity() {
lateinit var magic: Magic
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
magic = Magic(this, "YOUR_PUBLISHABLE_KEY")
}
// ⭐️Assuming user is logged in
fun updateEmail(v: View) {
val configuration = UpdateEmailConfiguration("[email protected]")
val completable = magic.user.updateEmail(configuration)
completable.whenComplete { response: UpdateEmailResponse?, error: Throwable? ->
if (response != null) {
Log.d("Magic", response.result.toString()) // "True"
} else {
// handle error
}
}
}
}
UpdateEmailConfiguration(showUI: Boolean? = true, email: String)
email
The user email to update with.showUI
Iftrue
, show an out-of-the-box pending UI while the request is in flight.