forked from NativeScript/firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
129 lines (90 loc) · 3.63 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { FirebaseApp, Firebase } from '@nativescript/firebase-core';
export { AndroidPermissions, IOSPermissions } from '@nativescript/firebase-messaging-core';
import { Permissions, AuthorizationStatus } from '@nativescript/firebase-messaging-core';
export { Permissions, AuthorizationStatus };
export enum NotificationAndroidVisibility {
VISIBILITY_PRIVATE,
VISIBILITY_PUBLIC,
VISIBILITY_SECRET,
}
export enum NotificationAndroidPriority {
PRIORITY_DEFAULT,
PRIORITY_HIGH,
PRIORITY_LOW,
PRIORITY_MAX,
PRIORITY_MIN,
}
export interface NotificationIOSCriticalSound {
critical: undefined | false | true;
name: string;
volume: undefined | number;
}
export interface Notification {
android?: undefined | { channelId: undefined | string; clickAction: undefined | string; color: undefined | string; count: undefined | number; imageUrl: undefined | string; link: undefined | string; priority: NotificationAndroidPriority; smallIcon: undefined | string; sound: undefined | string; ticker: undefined | string; visibility: NotificationAndroidVisibility };
body?: undefined | string;
bodyLocArgs?: string[];
bodyLocKey?: undefined | string;
ios?: undefined | { badge: undefined | string; sound: string | NotificationIOSCriticalSound; subtitle: undefined | string; subtitleLocArgs?: string[]; subtitleLocKey: undefined | string };
title?: undefined | string;
titleLocArgs?: string[];
titleLocKey?: undefined | string;
}
export interface RemoteMessage {
category?: undefined | string;
collapseKey?: undefined | string;
contentAvailable?: undefined | false | true;
data?: undefined | { [key: string]: string };
from?: undefined | string;
messageId?: undefined | string;
messageType?: undefined | string;
mutableContent?: undefined | false | true;
notification?: Notification;
sentTime?: undefined | number;
threadId?: undefined | string;
to?: undefined | string;
ttl?: undefined | number;
}
export interface IMessaging {
app: FirebaseApp;
autoInitEnabled: boolean;
readonly isDeviceRegisteredForRemoteMessages: boolean;
showNotificationsWhenInForeground: boolean;
deleteToken(): Promise<void>;
getToken(): Promise<string | null>;
hasPermission(): Promise<AuthorizationStatus>;
onMessage(listener: (message: RemoteMessage) => any);
onNotificationTap(listener: (message: RemoteMessage) => any);
onToken(listener: (token: string) => any);
registerDeviceForRemoteMessages(): Promise<void>;
requestPermission(permissions?: Permissions): Promise<AuthorizationStatus>;
subscribeToTopic(topic: string): Promise<void>;
unregisterDeviceForRemoteMessages(): Promise<void>;
unsubscribeFromTopic(topic: string): Promise<void>;
}
export declare class Messaging implements IMessaging {
getToken(): Promise<string>;
getAPNSToken(): string | null;
hasPermission(): Promise<AuthorizationStatus>;
onMessage(listener: (message: RemoteMessage) => any);
onNotificationTap(listener: (message: RemoteMessage) => any);
onToken(listener: (token: string) => any);
registerDeviceForRemoteMessages(): Promise<void>;
requestPermission(permissions?: Permissions): Promise<AuthorizationStatus>;
subscribeToTopic(topic: string): Promise<void>;
unregisterDeviceForRemoteMessages(): Promise<void>;
unsubscribeFromTopic(topic: string): Promise<void>;
deleteToken(): Promise<void>;
isAutoInitEnabled: boolean;
showNotificationsWhenInForeground: boolean;
readonly isDeviceRegisteredForRemoteMessages: boolean;
readonly app: FirebaseApp;
readonly native;
readonly ios;
readonly android;
}
declare module '@nativescript/firebase-core' {
export interface Firebase extends FirebaseMessaging {}
}
export interface FirebaseMessaging {
static messaging(): Messaging;
}