Merge branch 'master' of github.com:invertase/react-native-firebase

This commit is contained in:
Elliot Hesp
2017-07-06 10:22:23 +01:00
21 changed files with 700 additions and 487 deletions

View File

@@ -153,6 +153,40 @@ export default class Auth extends Base {
return FirebaseAuth.sendPasswordResetEmail(email);
}
/**
* Completes the password reset process, given a confirmation code and new password.
*
* @link https://firebase.google.com/docs/reference/js/firebase.auth.Auth#confirmPasswordReset
* @param code
* @param newPassword
* @return {Promise.<Null>}
*/
confirmPasswordReset(code: string, newPassword: string): Promise<Null> {
return FirebaseAuth.confirmPasswordReset(code, newPassword);
}
/**
* Applies a verification code sent to the user by email or other out-of-band mechanism.
*
* @link https://firebase.google.com/docs/reference/js/firebase.auth.Auth#applyActionCode
* @param code
* @return {Promise.<Null>}
*/
applyActionCode(code: string): Promise<Any> {
return FirebaseAuth.applyActionCode(code);
}
/**
* Checks a verification code sent to the user by email or other out-of-band mechanism.
*
* @link https://firebase.google.com/docs/reference/js/firebase.auth.Auth#checkActionCode
* @param code
* @return {Promise.<Any>|Promise<ActionCodeInfo>}
*/
checkActionCode(code: string): Promise<Any> {
return FirebaseAuth.checkActionCode(code);
}
/**
* Get the currently signed in user
* @return {Promise}

View File

@@ -262,13 +262,11 @@ export default class Reference extends ReferenceBase {
if (_failureCallback) {
_failureCallback = (error) => {
if (error.message.startsWith('FirebaseError: permission_denied')) {
error.message = `permission_denied at /${this.path}: Client doesn\'t have permission to access the desired data.`
error.message = `permission_denied at /${this.path}: Client doesn't have permission to access the desired data.`
}
failureCallbackOrContext(error);
}
};
}
let _successCallback;
@@ -375,11 +373,9 @@ export default class Reference extends ReferenceBase {
* @param onComplete
* @param applyLocally
*/
transaction(
transactionUpdate: Function,
onComplete: (error: ?Error, committed: boolean, snapshot: ?Snapshot) => *,
applyLocally: boolean = false
) {
transaction(transactionUpdate: Function,
onComplete: (error: ?Error, committed: boolean, snapshot: ?Snapshot) => *,
applyLocally: boolean = false) {
if (!isFunction(transactionUpdate)) {
return Promise.reject(
new Error('Missing transactionUpdate function argument.')
@@ -588,7 +584,7 @@ export default class Reference extends ReferenceBase {
*
* {@link https://firebase.google.com/docs/reference/js/firebase.database.Reference#parent}
*/
get parent(): Reference|null {
get parent(): Reference | null {
if (this.path === '/') return null;
return new Reference(this.database, this.path.substring(0, this.path.lastIndexOf('/')));
}

View File

@@ -17,9 +17,14 @@ export default class Snapshot {
_childKeys: Array<string>;
constructor(ref: Reference, snapshot: Object) {
this.ref = ref;
this.key = snapshot.key;
if (ref.key !== snapshot.key) {
this.ref = ref.child(snapshot.key);
} else {
this.ref = ref;
}
// internal use only
this._value = snapshot.value;
this._priority = snapshot.priority === undefined ? null : snapshot.priority;