[internals][types] Last part of internal refactor; Got rid of remaining flow errors

This commit is contained in:
Chris Bianca
2018-01-05 17:20:02 +00:00
parent 1b7c6dd8a4
commit 80cb54ee6d
35 changed files with 358 additions and 306 deletions

View File

@@ -1,8 +1,9 @@
/**
getNativeModule(this._auth)/**
* @flow
* User representation wrapper
*/
import INTERNALS from '../../utils/internals';
import { getNativeModule } from '../../utils/native';
import type Auth from './';
import type { ActionCodeSettings, AuthCredential } from '../../types';
@@ -92,7 +93,7 @@ export default class User {
*/
delete(): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.delete());
._interceptUndefinedUserValue(getNativeModule(this._auth).delete());
}
/**
@@ -100,7 +101,7 @@ export default class User {
* @return {Promise}
*/
getIdToken(forceRefresh: boolean = false): Promise<string> {
return this._auth._native.getToken(forceRefresh);
return getNativeModule(this._auth).getToken(forceRefresh);
}
/**
@@ -109,7 +110,7 @@ export default class User {
*/
linkWithCredential(credential: AuthCredential): Promise<User> {
return this._auth
._interceptUserValue(this._auth._native.link(credential.providerId, credential.token, credential.secret));
._interceptUserValue(getNativeModule(this._auth).link(credential.providerId, credential.token, credential.secret));
}
/**
@@ -118,7 +119,7 @@ export default class User {
*/
reauthenticateWithCredential(credential: AuthCredential): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.reauthenticate(credential.providerId, credential.token, credential.secret));
._interceptUndefinedUserValue(getNativeModule(this._auth).reauthenticate(credential.providerId, credential.token, credential.secret));
}
/**
@@ -127,7 +128,7 @@ export default class User {
*/
reload(): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.reload());
._interceptUndefinedUserValue(getNativeModule(this._auth).reload());
}
/**
@@ -135,7 +136,7 @@ export default class User {
*/
sendEmailVerification(actionCodeSettings?: ActionCodeSettings): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.sendEmailVerification(actionCodeSettings));
._interceptUndefinedUserValue(getNativeModule(this._auth).sendEmailVerification(actionCodeSettings));
}
toJSON(): Object {
@@ -148,7 +149,7 @@ export default class User {
* @return {Promise.<TResult>|*}
*/
unlink(providerId: string): Promise<User> {
return this._auth._interceptUserValue(this._auth._native.unlink(providerId));
return this._auth._interceptUserValue(getNativeModule(this._auth).unlink(providerId));
}
/**
@@ -159,7 +160,7 @@ export default class User {
*/
updateEmail(email: string): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.updateEmail(email));
._interceptUndefinedUserValue(getNativeModule(this._auth).updateEmail(email));
}
/**
@@ -169,7 +170,7 @@ export default class User {
*/
updatePassword(password: string): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.updatePassword(password));
._interceptUndefinedUserValue(getNativeModule(this._auth).updatePassword(password));
}
/**
@@ -179,7 +180,7 @@ export default class User {
*/
updateProfile(updates: Object = {}): Promise<void> {
return this._auth
._interceptUndefinedUserValue(this._auth._native.updateProfile(updates));
._interceptUndefinedUserValue(getNativeModule(this._auth).updateProfile(updates));
}
/**
@@ -189,7 +190,7 @@ export default class User {
*/
getToken(forceRefresh: boolean = false): Promise<Object> {
console.warn('Deprecated firebase.User.prototype.getToken in favor of firebase.User.prototype.getIdToken.');
return this._auth._native.getToken(forceRefresh);
return getNativeModule(this._auth).getToken(forceRefresh);
}
/**