File tree Expand file tree Collapse file tree 5 files changed +16
-12
lines changed
packages/installations/src Expand file tree Collapse file tree 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';
2626 */
2727export type IdChangeCallbackFn = ( installationId : string ) => void ;
2828/**
29- * Unsubscribe a callback function previously added via {@link # IdChangeCallbackFn}.
29+ * Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
3030 *
3131 * @public
3232 */
Original file line number Diff line number Diff line change @@ -36,12 +36,12 @@ const publicFactory: InstanceFactory<'installations'> = (
3636 const app = container . getProvider ( 'app' ) . getImmediate ( ) ;
3737 // Throws if app isn't configured properly.
3838 const appConfig = extractAppConfig ( app ) ;
39- const platformLoggerProvider = _getProvider ( app , 'platform-logger ' ) ;
39+ const heartbeatServiceProvider = _getProvider ( app , 'heartbeat ' ) ;
4040
4141 const installationsImpl : FirebaseInstallationsImpl = {
4242 app,
4343 appConfig,
44- platformLoggerProvider ,
44+ heartbeatServiceProvider ,
4545 _delete : ( ) => Promise . resolve ( )
4646 } ;
4747 return installationsImpl ;
Original file line number Diff line number Diff line change @@ -34,19 +34,20 @@ import {
3434} from '../interfaces/installation-impl' ;
3535
3636export async function generateAuthTokenRequest (
37- { appConfig, platformLoggerProvider } : FirebaseInstallationsImpl ,
37+ { appConfig, heartbeatServiceProvider } : FirebaseInstallationsImpl ,
3838 installationEntry : RegisteredInstallationEntry
3939) : Promise < CompletedAuthToken > {
4040 const endpoint = getGenerateAuthTokenEndpoint ( appConfig , installationEntry ) ;
4141
4242 const headers = getHeadersWithAuth ( appConfig , installationEntry ) ;
4343
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 ( {
4646 optional : true
4747 } ) ;
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 ) ;
5051 }
5152
5253 const body = {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export interface FirebaseInstallationsImpl
2323 extends Installations ,
2424 _FirebaseService {
2525 readonly appConfig : AppConfig ;
26- readonly platformLoggerProvider : Provider < 'platform-logger ' > ;
26+ readonly heartbeatServiceProvider : Provider < 'heartbeat ' > ;
2727}
2828
2929export interface AppConfig {
Original file line number Diff line number Diff line change @@ -53,16 +53,19 @@ export function getFakeInstallations(): FirebaseInstallationsImpl {
5353 const container = new ComponentContainer ( 'test' ) ;
5454 container . addComponent (
5555 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+ } ) ,
5861 ComponentType . PRIVATE
5962 )
6063 ) ;
6164
6265 return {
6366 app : getFakeApp ( ) ,
6467 appConfig : getFakeAppConfig ( ) ,
65- platformLoggerProvider : container . getProvider ( 'platform-logger ' ) ,
68+ heartbeatServiceProvider : container . getProvider ( 'heartbeat ' ) ,
6669 _delete : ( ) => {
6770 return Promise . resolve ( ) ;
6871 }
You can’t perform that action at this time.
0 commit comments