[auth] added phone_auth_state_changed event fan out listener
This commit is contained in:
parent
c4472cf8e7
commit
c4e2414295
|
@ -37,6 +37,13 @@ export default class Auth extends ModuleBase {
|
|||
this._onAuthStateChanged.bind(this),
|
||||
);
|
||||
|
||||
this.addListener(
|
||||
// sub to internal native event - this fans out to
|
||||
// public events based on event.type
|
||||
this._getAppEventName('phone_auth_state_changed'),
|
||||
this._onPhoneAuthStateChanged.bind(this),
|
||||
);
|
||||
|
||||
this.addListener(
|
||||
// sub to internal native event - this fans out to
|
||||
// public event name: onIdTokenChanged
|
||||
|
@ -48,6 +55,16 @@ export default class Auth extends ModuleBase {
|
|||
this._native.addIdTokenListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* Route a phone state change event to the correct listeners
|
||||
* @param event
|
||||
* @private
|
||||
*/
|
||||
_onPhoneAuthStateChanged(event: Object) {
|
||||
const eventKey = `phone:auth:${event.requestKey}:${event.type}`;
|
||||
this.emit(eventKey, event.state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal auth changed listener
|
||||
* @param auth
|
||||
|
@ -102,7 +119,7 @@ export default class Auth extends ModuleBase {
|
|||
* Intercept all user actions and send their results to
|
||||
* auth state change before resolving
|
||||
* @param promise
|
||||
* @returns {Promise.<TResult>|*}
|
||||
* @returns {Promise.<*>}
|
||||
* @private
|
||||
*/
|
||||
_interceptUserValue(promise) {
|
||||
|
|
Loading…
Reference in New Issue