Files
awesome-cordova-plugins/src/@ionic-native/plugins/badge/index.ts
T

108 lines
2.4 KiB
TypeScript
Raw Normal View History

import { Injectable } from '@angular/core';
2017-12-28 07:28:44 -05:00
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
2016-02-17 04:36:38 -05:00
/**
* @name Badge
* @description
2016-02-17 04:36:38 -05:00
* The essential purpose of badge numbers is to enable an application to inform its users that it has something for them — for example, unread messages — when the application isnt running in the foreground.
*
2016-03-04 15:42:21 -06:00
* Requires Cordova plugin: cordova-plugin-badge. For more info, please see the [Badge plugin docs](https://github.com/katzer/cordova-plugin-badge).
2016-02-17 04:36:38 -05:00
*
* @usage
2016-07-20 17:17:09 +02:00
* ```typescript
2018-10-10 16:13:45 -05:00
* import { Badge } from '@ionic-native/badge/ngx';
*
* constructor(private badge: Badge) { }
*
* ...
*
* this.badge.set(10);
* this.badge.increase(1);
* this.badge.clear();
2016-02-17 04:36:38 -05:00
* ```
*/
@Plugin({
pluginName: 'Badge',
2016-02-17 04:36:38 -05:00
plugin: 'cordova-plugin-badge',
2016-03-12 19:08:47 -05:00
pluginRef: 'cordova.plugins.notification.badge',
2016-03-14 13:38:35 -04:00
repo: 'https://github.com/katzer/cordova-plugin-badge',
2020-05-16 14:40:49 +02:00
platforms: ['Android', 'Browser', 'iOS', 'Windows'],
2016-02-17 04:36:38 -05:00
})
@Injectable()
export class Badge extends IonicNativePlugin {
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Clear the badge of the app icon.
* @returns {Promise<boolean>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
clear(): Promise<boolean> {
return;
}
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Set the badge of the app icon.
2016-04-29 23:56:49 -04:00
* @param {number} badgeNumber The new badge number.
* @returns {Promise<any>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
set(badgeNumber: number): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Get the badge of the app icon.
* @returns {Promise<any>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
get(): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Increase the badge number.
2016-04-29 23:56:49 -04:00
* @param {number} increaseBy Count to add to the current badge number
* @returns {Promise<any>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
increase(increaseBy: number): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Decrease the badge number.
2016-04-29 23:56:49 -04:00
* @param {number} decreaseBy Count to subtract from the current badge number
* @returns {Promise<any>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
decrease(decreaseBy: number): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
2018-03-15 18:02:35 +01:00
/**
* Check support to show badges.
* @returns {Promise<any>}
*/
@Cordova()
2018-03-15 18:06:25 +01:00
isSupported(): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
/**
2016-03-04 15:42:21 -06:00
* Determine if the app has permission to show badges.
* @returns {Promise<any>}
2016-02-17 04:36:38 -05:00
*/
@Cordova()
2017-12-28 07:28:44 -05:00
hasPermission(): Promise<any> {
return;
}
2016-02-17 04:36:38 -05:00
2016-03-04 15:42:21 -06:00
/**
* Register permission to set badge notifications
* @returns {Promise<any>}
2016-03-04 15:42:21 -06:00
*/
@Cordova()
requestPermission(): Promise<any> {
2017-12-28 07:28:44 -05:00
return;
}
2016-02-17 04:36:38 -05:00
}