mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
[android][auth] implemented missing 'unlink' method
This commit is contained in:
@@ -643,6 +643,38 @@ public class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* unlink
|
||||
*
|
||||
* @url https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser.html#unlink(java.lang.String)
|
||||
* @param providerId
|
||||
* @param promise
|
||||
*/
|
||||
@ReactMethod
|
||||
public void unlink(final String providerId, final Promise promise) {
|
||||
FirebaseUser user = mAuth.getCurrentUser();
|
||||
Log.d(TAG, "unlink");
|
||||
|
||||
if (user != null) {
|
||||
user.unlink(providerId)
|
||||
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<AuthResult> task) {
|
||||
if (task.isSuccessful()) {
|
||||
Log.d(TAG, "unlink:onComplete:success");
|
||||
promiseWithUser(task.getResult().getUser(), promise);
|
||||
} else {
|
||||
Exception exception = task.getException();
|
||||
Log.e(TAG, "unlink:onComplete:failure", exception);
|
||||
promiseRejectAuthException(promise, exception);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
promiseNoUser(promise, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reauthenticate
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user