File tree 4 files changed +16
-11
lines changed 4 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,7 @@ import {
24
24
CompleteFn
25
25
} from '@firebase/util' ;
26
26
27
- export class FirebaseMessaging {
28
- private constructor ( app : FirebaseApp ) ;
29
- readonly app : FirebaseApp ;
27
+ export interface FirebaseMessaging {
30
28
// TODO: remove the token parameter and just delete the token that matches
31
29
// this app if it exists.
32
30
deleteToken ( token : string ) : Promise < boolean > ;
Original file line number Diff line number Diff line change @@ -30,20 +30,17 @@ import { Unsubscribe } from '@firebase/util';
30
30
import { sleep } from '../helpers/sleep' ;
31
31
import { FirebaseApp } from '@firebase/app-types' ;
32
32
import { isConsoleMessage } from '../helpers/is-console-message' ;
33
+ import { FirebaseService } from '@firebase/app-types/private' ;
33
34
34
35
// Let TS know that this is a service worker
35
36
declare const self : ServiceWorkerGlobalScope ;
36
37
37
38
export type BgMessageHandler = ( payload : MessagePayload ) => unknown ;
38
39
39
- export class SwController implements FirebaseMessaging {
40
+ export class SwController implements FirebaseMessaging , FirebaseService {
40
41
private vapidKey : string | null = null ;
41
42
private bgMessageHandler : BgMessageHandler | null = null ;
42
43
43
- get app ( ) : FirebaseApp {
44
- return this . firebaseDependencies . app ;
45
- }
46
-
47
44
constructor (
48
45
private readonly firebaseDependencies : FirebaseInternalDependencies
49
46
) {
@@ -58,6 +55,10 @@ export class SwController implements FirebaseMessaging {
58
55
} ) ;
59
56
}
60
57
58
+ get app ( ) : FirebaseApp {
59
+ return this . firebaseDependencies . app ;
60
+ }
61
+
61
62
/**
62
63
* Calling setBackgroundMessageHandler will opt in to some specific
63
64
* behaviours.
Original file line number Diff line number Diff line change @@ -33,8 +33,9 @@ import {
33
33
import { FirebaseApp } from '@firebase/app-types' ;
34
34
import { ConsoleMessageData } from '../interfaces/message-payload' ;
35
35
import { isConsoleMessage } from '../helpers/is-console-message' ;
36
+ import { FirebaseService } from '@firebase/app-types/private' ;
36
37
37
- export class WindowController implements FirebaseMessaging {
38
+ export class WindowController implements FirebaseMessaging , FirebaseService {
38
39
private vapidKey : string | null = null ;
39
40
private swRegistration ?: ServiceWorkerRegistration ;
40
41
private onMessageCallback : NextFn < object > | null = null ;
Original file line number Diff line number Diff line change 17
17
18
18
import firebase from '@firebase/app' ;
19
19
import '@firebase/installations' ;
20
- import { _FirebaseNamespace } from '@firebase/app-types/private' ;
20
+ import {
21
+ _FirebaseNamespace ,
22
+ FirebaseService
23
+ } from '@firebase/app-types/private' ;
21
24
import { FirebaseMessaging } from '@firebase/messaging-types' ;
22
25
import {
23
26
Component ,
@@ -31,7 +34,9 @@ import { WindowController } from './controllers/window-controller';
31
34
import { SwController } from './controllers/sw-controller' ;
32
35
33
36
const MESSAGING_NAME = 'messaging' ;
34
- function factoryMethod ( container : ComponentContainer ) : FirebaseMessaging {
37
+ function factoryMethod (
38
+ container : ComponentContainer
39
+ ) : FirebaseService & FirebaseMessaging {
35
40
// Dependencies.
36
41
const app = container . getProvider ( 'app' ) . getImmediate ( ) ;
37
42
const appConfig = extractAppConfig ( app ) ;
You can’t perform that action at this time.
0 commit comments