UNPKG

4.33 kBTypeScriptView Raw
1import { Observable } from 'rxjs/Observable';
2/**
3 * @name Firebase
4 * @description
5 * This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).
6 *
7 * @usage
8 * ```
9 * import { Firebase } from 'ionic-native';
10 *
11 * Firebase.getToken()
12 * .then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
13 * .catch(error => console.error('Error getting token', error));
14 *
15 * Firebase.onTokenRefresh()
16 * .subscribe((token: string) => console.log(`Got a new token ${token}`));
17 *
18 * ```
19 */
20export declare class Firebase {
21 /**
22 * Get the device token
23 * @return {Promise<any>}
24 */
25 static getToken(): Promise<any>;
26 /**
27 * Get notified when a token is refreshed
28 * @return {Observable<any>}
29 */
30 static onTokenRefresh(): Observable<any>;
31 /**
32 * Get notified when the user opens a notification
33 * @return {Observable<any>}
34 */
35 static onNotificationOpen(): Observable<any>;
36 /**
37 * Grant permission to recieve push notifications
38 * @return {Promise<any>}
39 */
40 static grantPermission(): Promise<any>;
41 /**
42 * Check permission to recieve push notifications
43 * @return {Promise<any>}
44 */
45 static hasPermission(): Promise<any>;
46 /**
47 * Set icon badge number. Set to 0 to clear the badge.
48 * @param badgeNumber {number}
49 * @return {Promise<any>}
50 */
51 static setBadgeNumber(badgeNumber: number): Promise<any>;
52 /**
53 * Get icon badge number
54 * @return {Promise<any>}
55 */
56 static getBadgeNumber(): Promise<any>;
57 /**
58 * Subscribe to a topic
59 * @param topic {string}
60 * @return {Promise<any>}
61 */
62 static subscribe(topic: string): Promise<any>;
63 /**
64 * Unsubscribe from a topic
65 * @param topic {string}
66 * @return {Promise<any>}
67 */
68 static unsubscribe(topic: string): Promise<any>;
69 /**
70 * Log an event using Analytics
71 * @param type {string}
72 * @param data {Object}
73 * @return {Promise<any>}
74 */
75 static logEvent(type: string, data: any): Promise<any>;
76 /**
77 * Set the name of the current screen in Analytics
78 * @param name {string} Screen name
79 * @return {Promise<any>}
80 */
81 static setScreenName(name: string): Promise<any>;
82 /**
83 * Set a user id for use in Analytics
84 * @param userId {string}
85 * @return {Promise<any>}
86 */
87 static setUserId(userId: string): Promise<any>;
88 /**
89 * Set a user property for use in Analytics
90 * @param name {string}
91 * @param value {string}
92 * @return {Promise<any>}
93 */
94 static setUserProperty(name: string, value: string): Promise<any>;
95 /**
96 * Fetch Remote Config parameter values for your app
97 * @param cacheExpirationSeconds
98 * @return {Promise<any>}
99 */
100 static fetch(cacheExpirationSeconds?: number): Promise<any>;
101 /**
102 * Activate the Remote Config fetched config
103 * @return {Promise<any>}
104 */
105 static activateFetched(): Promise<any>;
106 /**
107 * Retrieve a Remote Config value
108 * @param key {string}
109 * @param namespace {string}
110 * @return {Promise<any>}
111 */
112 static getValue(key: string, namespace?: string): Promise<any>;
113 /**
114 * Retrieve a Remote Config byte array
115 * @param key {string}
116 * @param namespace {string}
117 * @return {Promise<any>}
118 */
119 static getByteArray(key: string, namespace?: string): Promise<any>;
120 /**
121 * Get the current state of the FirebaseRemoteConfig singleton object
122 * @return {Promise<any>}
123 */
124 static getInfo(): Promise<any>;
125 /**
126 * Change the settings for the FirebaseRemoteConfig object's operations
127 * @param settings {Object}
128 * @return {Promise<any>}
129 */
130 static setConfigSettings(settings: any): Promise<any>;
131 /**
132 * Set defaults in the Remote Config
133 * @param defaults {Object}
134 * @param namespace {string}
135 * @return {Promise<any>}
136 */
137 static setDefaults(defaults: any, namespace: string): Promise<any>;
138}