fix(firebase-messaging): fix the typings of the FCM message payload (#2998)

This commit is contained in:
Adam Duren 2019-04-19 09:58:38 -07:00 committed by Daniel Sogl
parent c0ce17b170
commit e47774b771

View File

@ -2,11 +2,35 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs';
export interface IFirebaseMessage {
aps: any;
gcm: any;
export interface IFirebaseGCMMessage {
gcm: {
body: string;
title: string;
sound: string;
icon: string;
tag: string;
color: string;
clickAction: string;
};
'google.message_id': string;
'google.sent_time': number;
[key: string]: any;
}
export interface IFirebaseAPSMessage {
aps: {
alert: {
title: string;
body: string;
};
badge?: number;
};
'gcm.message_id': 'string';
[key: string]: any;
}
export type IFirebaseMessage = IFirebaseAPSMessage | IFirebaseGCMMessage;
/**
* @beta
* @name Firebase Messaging
@ -36,7 +60,7 @@ export interface IFirebaseMessage {
plugin: 'cordova-plugin-firebase-messaging',
pluginRef: 'cordova.plugins.firebase.messaging',
repo: 'https://github.com/chemerisuk/cordova-plugin-firebase-messaging',
platforms: ['Android', 'iOS']
platforms: ['Android', 'iOS'],
})
@Injectable()
export class FirebaseMessaging extends IonicNativePlugin {