From 164d055d7639104dea4327158316b8bef0ddbc89 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 14 Apr 2017 21:37:53 +0200 Subject: [PATCH] Add Notification type (#382) * More typings * Update index.d.ts * Update index.d.ts * Update index.d.ts --- index.d.ts | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index e6616e8..855de54 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,6 +24,35 @@ declare module "react-native-fcm" { const Local = "local_notification"; } + export interface Notification { + collapse_key: string; + opened_from_tray: boolean; + from: string; + notification: { + title?: string + body: string; + icon: string; + }; + _notificationType: string; + finish(type?: string): void; + } + + export interface LocalNotification { + title?: string; + body: string; + icon?: string; + vibrate?: number; + sound?: boolean; + big_text?: string; + large_icon?: string; + priority?: string + } + + export interface ScheduleLocalNotification extends LocalNotification{ + id: string; + fire_date: number + } + export interface Subscription { remove(): void; } @@ -32,14 +61,14 @@ declare module "react-native-fcm" { static requestPermissions(): void; static getFCMToken(): Promise; static on(event: "FCMTokenRefreshed", handler: (token: string) => void): Subscription; - static on(event: "FCMNotificationReceived", handler: (notification: any) => void): Subscription; + static on(event: "FCMNotificationReceived", handler: (notification: Notification) => void): Subscription; static subscribeToTopic(topic: string): void; static unsubscribeFromTopic(topic: string): void; - static getInitialNotification(): Promise; - static presentLocalNotification(notification: any): void; + static getInitialNotification(): Promise; + static presentLocalNotification(notification: LocalNotification): void; - static scheduleLocalNotification(schedule: any): void; - static getScheduledLocalNotifications(): Promise; + static scheduleLocalNotification(schedule: LocalNotification): void; + static getScheduledLocalNotifications(): Promise; static removeAllDeliveredNotifications(): void; static removeDeliveredNotification(id: string): void; -- 2.26.2