Skip to content

Commit

Permalink
fix(firebase-messaging): fix the typings of the FCM message payload (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamduren authored and danielsogl committed Apr 19, 2019
1 parent c0ce17b commit e47774b
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/@ionic-native/plugins/firebase-messaging/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e47774b

Please sign in to comment.