diff --git a/src/index.ts b/src/index.ts index 634a23da83..86271de130 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,6 +46,7 @@ import { FileChooser } from './plugins/file-chooser'; import { FileOpener } from './plugins/file-opener'; import { FilePath } from './plugins/filepath'; import { Transfer } from './plugins/filetransfer'; +import { Firebase } from './plugins/firebase'; import { Flashlight } from './plugins/flashlight'; import { Geofence } from './plugins/geofence'; import { Geolocation } from './plugins/geolocation'; @@ -156,6 +157,7 @@ export * from './plugins/file'; export * from './plugins/file-chooser'; export * from './plugins/file-opener'; export * from './plugins/filetransfer'; +export * from './plugins/firebase'; export * from './plugins/filepath'; export * from './plugins/flashlight'; export * from './plugins/geofence'; @@ -270,6 +272,7 @@ window['IonicNative'] = { FileOpener, FilePath, Flashlight, + Firebase, Geofence, Geolocation, Globalization, diff --git a/src/plugins/firebase.ts b/src/plugins/firebase.ts new file mode 100644 index 0000000000..8372b33018 --- /dev/null +++ b/src/plugins/firebase.ts @@ -0,0 +1,193 @@ +import { Plugin, Cordova } from './plugin'; +import { Observable } from 'rxjs/Observable' + +/** + * @name Firebase + * @description + * + * @usage + * ``` + * import { Firebase } from 'ionic-native'; + * + * + * ``` + */ +@Plugin({ + pluginName: 'Firebase', + plugin: 'cordova-plugin-firebase', + pluginRef: 'FirebasePlugin', + repo: 'https://github.com/arnesson/cordova-plugin-firebase' +}) +export class Firebase { + + /** + * Get the device token + * @return {Promise} + */ + @Cordova() + static getToken(): Promise { return; } + + /** + * Get notified when a token is refreshed + * @return {Observable} + */ + @Cordova({ + observable: true + }) + static onTokenRefresh(): Observable { return; } + + /** + * Get notified when the user opens a notification + * @return {Observable} + */ + @Cordova({ + observable: true + }) + static onNotificationOpen(): Observable { return; } + + /** + * Grant permission to recieve push notifications + * @return {Promise} + */ + @Cordova({ + platforms: ['iOS'] + }) + static grantPermission(): Promise { return; } + + /** + * Set icon badge number. Set to 0 to clear the badge. + * @param badgeNumber {number} + * @return {Promise} + */ + @Cordova() + static setBadgeNumber(badgeNumber: number): Promise { return; } + + /** + * Get icon badge number + * @return {Promise} + */ + @Cordova() + static getBadgeNumber(): Promise { return; } + + /** + * Subscribe to a topic + * @param topic {string} + * @return {Promise} + */ + @Cordova() + static subscribe(topic: string): Promise { return; } + + /** + * Unsubscribe from a topic + * @param topic {string} + * @return {Promise} + */ + @Cordova() + static unsubscribe(topic: string): Promise { return; } + + /** + * Log an event using Analytics + * @param type {string} + * @param data {Object} + * @return {Promise} + */ + @Cordova() + static logEvent(type: string, data: any): Promise { return; } + + /** + * Set a user id for use in Analytics + * @param userId {string} + * @return {Promise} + */ + @Cordova() + static setUserId(userId: string): Promise { return; } + + /** + * Set a user property for use in Analytics + * @param name {string} + * @param value {string} + * @return {Promise} + */ + @Cordova() + static setUserProperty(name: string, value: string): Promise { return; } + + /** + * Fetch Remote Config parameter values for your app + * @param cacheExpirationSeconds + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'], + successIndex: 1, + errorIndex: 2 + }) + static fetch(cacheExpirationSeconds?: number): Promise { return; } + + /** + * Activate the Remote Config fetched config + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'] + }) + static activateFetched(): Promise { return; } + + /** + * Retrieve a Remote Config value + * @param key {string} + * @param namespace {string} + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'], + successIndex: 2, + errorIndex: 3 + }) + static getValue(key: string, namespace?: string): Promise { return; } + + /** + * Retrieve a Remote Config byte array + * @param key {string} + * @param namespace {string} + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'], + successIndex: 2, + errorIndex: 3 + }) + static getByteArray(key: string, namespace?: string): Promise { return; } + + /** + * Get the current state of the FirebaseRemoteConfig singleton object + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'] + }) + static getInfo(): Promise { return; } + + /** + * Change the settings for the FirebaseRemoteConfig object's operations + * @param settings {Object} + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'] + }) + static setConfigSettings(settings: any): Promise { return; } + + /** + * Set defaults in the Remote Config + * @param defaults {Object} + * @param namespace {string} + * @return {Promise} + */ + @Cordova({ + platforms: ['Android'], + successIndex: 2, + errorIndex: 3 + }) + static setDefaults(defaults: any, namespace: string): Promise { return; } + +}