Skip to content

Commit 6ac8bb8

Browse files
committed
Add support for uiShow Callback #133
1 parent 070af79 commit 6ac8bb8

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog
2+
## 5.0.1
3+
* Add support for uiShow Callback [#133](https://github.com/RaphaelJenni/FirebaseUI-Angular/issues/133)
4+
25
## 5.0.0
36
* Upgrade library to support @angular/fire@6.0.0 [#121](https://github.com/RaphaelJenni/FirebaseUI-Angular/issues/121)
47

README.MD

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To install this library, run:
1313
$ npm install firebaseui-angular --save
1414
```
1515

16-
To run this library you need to have [AngularFire2](https://github.com/angular/angularfire2), [Firebase](https://firebase.google.com/docs/web/setup),
16+
To run this library you need to have [AngularFire2](https://github.com/angular/angularfire2), [Firebase](https://firebase.google.com/docs/web/setup),
1717
[FirebaseUI-Web](https://github.com/firebase/firebaseui-web) installed.
1818
Fast install:
1919
```bash
@@ -203,7 +203,8 @@ Don't forget to unsubscribe at the end.
203203
```html
204204
<firebase-ui
205205
(signInSuccessWithAuthResult)="successCallback($event)"
206-
(signInFailure)="errorCallback($event)"></firebase-ui>
206+
(signInFailure)="errorCallback($event)"
207+
(uiShown)="uiShownCallback()"></firebase-ui>
207208
```
208209

209210
```typescript
@@ -213,7 +214,11 @@ successCallback(signInSuccessData: FirebaseUISignInSuccessWithAuthResult) {
213214

214215
errorCallback(errorData: FirebaseUISignInFailure) {
215216
...
216-
}
217+
}
218+
219+
uiShownCallback() {
220+
...
221+
}
217222
```
218223

219224
### Disable autosign
@@ -272,7 +277,7 @@ If you have added the css to the angular.json but nothing happened. Try to resta
272277
### ERROR in ./~/firebase/app/shared_promise.js
273278

274279
This is a know issue in the firebase project. To fix that (for now), do that:
275-
280+
276281
`npm install promise-polyfill --save-exact`
277282

278283
### `http://localhost:4200/images/buffer.svg?embed` 404 (Not Found)

projects/firebaseui-angular-library/src/lib/firebaseui-angular-library.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class FirebaseuiAngularLibraryComponent implements OnInit, OnDestroy {
2121

2222
@Output('signInSuccessWithAuthResult') signInSuccessWithAuthResultCallback: EventEmitter<FirebaseUISignInSuccessWithAuthResult> = new EventEmitter(); // tslint:disable-line
2323
@Output('signInFailure') signInFailureCallback: EventEmitter<FirebaseUISignInFailure> = new EventEmitter(); // tslint:disable-line
24+
@Output('uiShown') uiShownCallback: EventEmitter<void> = new EventEmitter(); // tslint:disable-line
2425

2526
private subscription: Subscription;
2627

@@ -84,8 +85,8 @@ export class FirebaseuiAngularLibraryComponent implements OnInit, OnDestroy {
8485
}
8586
}
8687

87-
private getCallbacks(): any {
88-
const signInSuccessWithAuthResult = (authResult: UserCredential, redirectUrl) => {
88+
private getCallbacks(): any { // firebaseui.Callbacks
89+
const signInSuccessWithAuthResultCallback = (authResult: UserCredential, redirectUrl) => {
8990
this.ngZone.run(() => {
9091
this.signInSuccessWithAuthResultCallback.emit({
9192
authResult,
@@ -105,9 +106,16 @@ export class FirebaseuiAngularLibraryComponent implements OnInit, OnDestroy {
105106
return Promise.reject();
106107
};
107108

109+
const uiShownCallback = () => {
110+
this.ngZone.run(() => {
111+
this.uiShownCallback.emit();
112+
});
113+
};
114+
108115
return {
109-
signInSuccessWithAuthResult: signInSuccessWithAuthResult,
116+
signInSuccessWithAuthResult: signInSuccessWithAuthResultCallback,
110117
signInFailure: signInFailureCallback,
118+
uiShown: uiShownCallback
111119
};
112120
}
113121
}

src/app/main/main.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<h1>FirebaseUI-Angular Sample</h1>
22
<firebase-ui (signInSuccessWithAuthResult)="successCallback($event)"
3-
(signInFailure)="errorCallback($event)"></firebase-ui>
3+
(signInFailure)="errorCallback($event)"
4+
(uiShown)="uiShownCallback()"></firebase-ui>
45
<button (click)="logout()">Logout</button>
56
<button [routerLink]="['/page']">To second page</button>

src/app/main/main.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ export class MainComponent implements OnInit {
3131
console.warn('errorCallback', data);
3232
}
3333

34+
uiShownCallback() {
35+
console.log('UI shown');
36+
}
3437
}

0 commit comments

Comments
 (0)