[ios][auth] add sendSignInLinkToEmail native method

This commit is contained in:
Salakar 2018-05-12 23:14:06 +01:00
parent 15992f3ba9
commit de33d97be9
1 changed files with 29 additions and 0 deletions

View File

@ -695,6 +695,35 @@ RCT_EXPORT_METHOD(sendPasswordResetEmail:(NSString *) appDisplayName
}
}
/**
sendSignInLinkToEmail
@param NSString email
@param NSDictionary actionCodeSettings
@param RCTPromiseResolveBlock resolve
@param RCTPromiseRejectBlock reject
@return
*/
RCT_EXPORT_METHOD(sendSignInLinkToEmail:(NSString *) appDisplayName
email:(NSString *) email
actionCodeSettings:(NSDictionary *) actionCodeSettings
resolver:(RCTPromiseResolveBlock) resolve
rejecter:(RCTPromiseRejectBlock) reject) {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
id handler = ^(NSError *_Nullable error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
} else {
[self promiseNoUser:resolve rejecter:reject isError:NO];
}
};
FIRActionCodeSettings *settings = [self buildActionCodeSettings:actionCodeSettings];
[[FIRAuth authWithApp:firApp] sendSignInLinkToEmail:email actionCodeSettings:settings completion:handler];
}
/**
signInAndRetrieveDataWithCustomToken