switch ios onAuthStateChange handlers to new format

This commit is contained in:
Salakar 2017-03-14 10:57:57 +00:00
parent efb07c47c7
commit b18a7a0d6a
3 changed files with 6 additions and 7 deletions

View File

@ -113,7 +113,7 @@ RCT_EXPORT_METHOD(signOut:(RCTResponseSenderBlock)callback)
}
}
RCT_EXPORT_METHOD(listenForAuth)
RCT_EXPORT_METHOD(addAuthStateListener)
{
self->listening = true;
self->authListenerHandle =
@ -156,7 +156,7 @@ RCT_EXPORT_METHOD(listenForAuth)
}];
}
RCT_EXPORT_METHOD(unlistenForAuth:(RCTResponseSenderBlock)callback)
RCT_EXPORT_METHOD(removeAuthStateListener:(RCTResponseSenderBlock)callback)
{
if (self->authListenerHandle != nil) {
[[FIRAuth auth] removeAuthStateDidChangeListener:self->authListenerHandle];

View File

@ -13,7 +13,7 @@
static NSString *const kRNFirebaseInitialized = @"RNFirebaseInitializedEvent";
static NSString *const INITIALIZED_EVENT = @"RNFirebaseInitialized";
static NSString *const AUTH_CHANGED_EVENT = @"listenForAuth";
static NSString *const AUTH_CHANGED_EVENT = @"onAuthStateChanged";
static NSString *const AUTH_ERROR_EVENT = @"authError";
static NSString *const AUTH_ANONYMOUS_ERROR_EVENT = @"authAnonymousError";
static NSString *const DEBUG_EVENT = @"debug";

View File

@ -121,8 +121,7 @@ export default class Auth extends Base {
* @return {Promise} A promise that is resolved upon completion
*/
signInWithEmailAndPassword(email: string, password: string): Promise<Object> {
this.log.info('Signing in user with email and password', email);
return promisify('signInWithEmail', FirebaseAuth, 'auth/')(email, password);
return this._interceptUserValue(FirebaseAuth.signInWithEmailAndPassword(email, password));
}
/**
@ -131,7 +130,7 @@ export default class Auth extends Base {
* @return {Promise} A promise resolved upon completion
*/
signInWithCustomToken(customToken: string): Promise<Object> {
return promisify('signInWithCustomToken', FirebaseAuth)(customToken);
return this._interceptUserValue(FirebaseAuth.signInWithCustomToken(customToken));
}
/**
@ -139,7 +138,7 @@ export default class Auth extends Base {
* @return {Promise} A promise resolved upon completion
*/
signInWithCredential(credential: CredentialType): Promise<Object> {
return promisify('signInWithProvider', FirebaseAuth, 'auth/')(credential.provider, credential.token, credential.secret);
return this._interceptUserValue(FirebaseAuth.signInWithCredential(credential.provider, credential.token, credential.secret));
}
/**