Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 45990d6

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 8ed90be + 76be7df commit 45990d6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/admob/admob.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ export function preloadInterstitial(arg: InterstitialOptions): Promise<any> {
9898
} else {
9999
resolve();
100100
}
101-
CFRelease(delegate);
102-
delegate = undefined;
103101
}, () => {
104102
arg.onAdClosed && arg.onAdClosed();
103+
CFRelease(delegate);
104+
delegate = undefined;
105105
});
106106

107107
CFRetain(delegate);

src/app/auth/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as firebase from "../../firebase";
2-
import { FirebaseEmailLinkActionCodeSettings, LoginType, User } from "../../firebase";
2+
import { FirebaseEmailLinkActionCodeSettings, LoginType, User, Unsubscribe } from "../../firebase";
33

44
export namespace auth {
55
export class Auth {
@@ -44,10 +44,15 @@ export namespace auth {
4444
}
4545

4646
// Completed will never be called, but it is here to closely follow the web api interface.
47-
public onAuthStateChanged(handler: (user: User) => void, error?: (err) => any, completed?: () => any): void {
47+
public onAuthStateChanged(handler: (user: User) => void, error?: (err) => any, completed?: Unsubscribe): Unsubscribe {
4848
this.authStateChangedHandler = handler;
4949
if (error) this.authStateOnErrorHandler = error;
5050
console.log(">> added onAuthStateChanged handler");
51+
52+
return () => {
53+
this.authStateChangedHandler = undefined;
54+
this.authStateOnErrorHandler = undefined;
55+
};
5156
}
5257

5358
public signOut(): Promise<any> {

src/firebase.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ export interface FirebaseQueryResult {
583583
value: any;
584584
}
585585

586+
export type Unsubscribe = () => void;
587+
586588
export function transaction(path: string, transactionUpdate: (a: any) => any,
587589
onComplete?: (error: Error | null, committed: boolean, dataSnapshot: DataSnapshot) => any): Promise<any>;
588590

0 commit comments

Comments
 (0)