File tree 5 files changed +16
-12
lines changed
packages/installations/src
5 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import { Installations } from '../interfaces/public-types';
26
26
*/
27
27
export type IdChangeCallbackFn = ( installationId : string ) => void ;
28
28
/**
29
- * Unsubscribe a callback function previously added via {@link # IdChangeCallbackFn}.
29
+ * Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
30
30
*
31
31
* @public
32
32
*/
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ const publicFactory: InstanceFactory<'installations'> = (
36
36
const app = container . getProvider ( 'app' ) . getImmediate ( ) ;
37
37
// Throws if app isn't configured properly.
38
38
const appConfig = extractAppConfig ( app ) ;
39
- const platformLoggerProvider = _getProvider ( app , 'platform-logger ' ) ;
39
+ const heartbeatServiceProvider = _getProvider ( app , 'heartbeat ' ) ;
40
40
41
41
const installationsImpl : FirebaseInstallationsImpl = {
42
42
app,
43
43
appConfig,
44
- platformLoggerProvider ,
44
+ heartbeatServiceProvider ,
45
45
_delete : ( ) => Promise . resolve ( )
46
46
} ;
47
47
return installationsImpl ;
Original file line number Diff line number Diff line change @@ -34,19 +34,20 @@ import {
34
34
} from '../interfaces/installation-impl' ;
35
35
36
36
export async function generateAuthTokenRequest (
37
- { appConfig, platformLoggerProvider } : FirebaseInstallationsImpl ,
37
+ { appConfig, heartbeatServiceProvider } : FirebaseInstallationsImpl ,
38
38
installationEntry : RegisteredInstallationEntry
39
39
) : Promise < CompletedAuthToken > {
40
40
const endpoint = getGenerateAuthTokenEndpoint ( appConfig , installationEntry ) ;
41
41
42
42
const headers = getHeadersWithAuth ( appConfig , installationEntry ) ;
43
43
44
- // If platform logger exists, add the platform info string to the header.
45
- const platformLogger = platformLoggerProvider . getImmediate ( {
44
+ // If heartbeat service exists, add the heartbeat string to the header.
45
+ const heartbeatService = heartbeatServiceProvider . getImmediate ( {
46
46
optional : true
47
47
} ) ;
48
- if ( platformLogger ) {
49
- headers . append ( 'x-firebase-client' , platformLogger . getPlatformInfoString ( ) ) ;
48
+ if ( heartbeatService ) {
49
+ const heartbeatsHeader = await heartbeatService . getHeartbeatsHeader ( ) ;
50
+ headers . append ( 'x-firebase-client' , heartbeatsHeader ) ;
50
51
}
51
52
52
53
const body = {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export interface FirebaseInstallationsImpl
23
23
extends Installations ,
24
24
_FirebaseService {
25
25
readonly appConfig : AppConfig ;
26
- readonly platformLoggerProvider : Provider < 'platform-logger ' > ;
26
+ readonly heartbeatServiceProvider : Provider < 'heartbeat ' > ;
27
27
}
28
28
29
29
export interface AppConfig {
Original file line number Diff line number Diff line change @@ -53,16 +53,19 @@ export function getFakeInstallations(): FirebaseInstallationsImpl {
53
53
const container = new ComponentContainer ( 'test' ) ;
54
54
container . addComponent (
55
55
new Component (
56
- 'platform-logger' ,
57
- ( ) => ( { getPlatformInfoString : ( ) => 'a/1.2.3 b/2.3.4' } ) ,
56
+ 'heartbeat' ,
57
+ ( ) => ( {
58
+ getHeartbeatsHeader : ( ) => Promise . resolve ( 'a/1.2.3 b/2.3.4' ) ,
59
+ triggerHeartbeat : ( ) => Promise . resolve ( )
60
+ } ) ,
58
61
ComponentType . PRIVATE
59
62
)
60
63
) ;
61
64
62
65
return {
63
66
app : getFakeApp ( ) ,
64
67
appConfig : getFakeAppConfig ( ) ,
65
- platformLoggerProvider : container . getProvider ( 'platform-logger ' ) ,
68
+ heartbeatServiceProvider : container . getProvider ( 'heartbeat ' ) ,
66
69
_delete : ( ) => {
67
70
return Promise . resolve ( ) ;
68
71
}
You can’t perform that action at this time.
0 commit comments