-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(firebase): add firebase plugin (#914)
closes #608
- Loading branch information
Showing
2 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<any>} | ||
*/ | ||
@Cordova() | ||
static getToken(): Promise<any> { return; } | ||
|
||
/** | ||
* Get notified when a token is refreshed | ||
* @return {Observable<any>} | ||
*/ | ||
@Cordova({ | ||
observable: true | ||
}) | ||
static onTokenRefresh(): Observable<any> { return; } | ||
|
||
/** | ||
* Get notified when the user opens a notification | ||
* @return {Observable<any>} | ||
*/ | ||
@Cordova({ | ||
observable: true | ||
}) | ||
static onNotificationOpen(): Observable<any> { return; } | ||
|
||
/** | ||
* Grant permission to recieve push notifications | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['iOS'] | ||
}) | ||
static grantPermission(): Promise<any> { return; } | ||
|
||
/** | ||
* Set icon badge number. Set to 0 to clear the badge. | ||
* @param badgeNumber {number} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static setBadgeNumber(badgeNumber: number): Promise<any> { return; } | ||
|
||
/** | ||
* Get icon badge number | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static getBadgeNumber(): Promise<any> { return; } | ||
|
||
/** | ||
* Subscribe to a topic | ||
* @param topic {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static subscribe(topic: string): Promise<any> { return; } | ||
|
||
/** | ||
* Unsubscribe from a topic | ||
* @param topic {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static unsubscribe(topic: string): Promise<any> { return; } | ||
|
||
/** | ||
* Log an event using Analytics | ||
* @param type {string} | ||
* @param data {Object} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static logEvent(type: string, data: any): Promise<any> { return; } | ||
|
||
/** | ||
* Set a user id for use in Analytics | ||
* @param userId {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static setUserId(userId: string): Promise<any> { return; } | ||
|
||
/** | ||
* Set a user property for use in Analytics | ||
* @param name {string} | ||
* @param value {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
static setUserProperty(name: string, value: string): Promise<any> { return; } | ||
|
||
/** | ||
* Fetch Remote Config parameter values for your app | ||
* @param cacheExpirationSeconds | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'], | ||
successIndex: 1, | ||
errorIndex: 2 | ||
}) | ||
static fetch(cacheExpirationSeconds?: number): Promise<any> { return; } | ||
|
||
/** | ||
* Activate the Remote Config fetched config | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'] | ||
}) | ||
static activateFetched(): Promise<any> { return; } | ||
|
||
/** | ||
* Retrieve a Remote Config value | ||
* @param key {string} | ||
* @param namespace {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'], | ||
successIndex: 2, | ||
errorIndex: 3 | ||
}) | ||
static getValue(key: string, namespace?: string): Promise<any> { return; } | ||
|
||
/** | ||
* Retrieve a Remote Config byte array | ||
* @param key {string} | ||
* @param namespace {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'], | ||
successIndex: 2, | ||
errorIndex: 3 | ||
}) | ||
static getByteArray(key: string, namespace?: string): Promise<any> { return; } | ||
|
||
/** | ||
* Get the current state of the FirebaseRemoteConfig singleton object | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'] | ||
}) | ||
static getInfo(): Promise<any> { return; } | ||
|
||
/** | ||
* Change the settings for the FirebaseRemoteConfig object's operations | ||
* @param settings {Object} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'] | ||
}) | ||
static setConfigSettings(settings: any): Promise<any> { return; } | ||
|
||
/** | ||
* Set defaults in the Remote Config | ||
* @param defaults {Object} | ||
* @param namespace {string} | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova({ | ||
platforms: ['Android'], | ||
successIndex: 2, | ||
errorIndex: 3 | ||
}) | ||
static setDefaults(defaults: any, namespace: string): Promise<any> { return; } | ||
|
||
} |