Skip to content

Commit cdabebd

Browse files
committed
feat(plugin): add Microsoft App Center Push plugin
1 parent a38381d commit cdabebd

File tree

1 file changed

+68
-0
lines changed
  • src/@ionic-native/plugins/app-center-push

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Injectable } from '@angular/core';
2+
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
3+
import { Observable } from 'rxjs/Observable';
4+
5+
/**
6+
* @name App Center Push
7+
* @description
8+
*
9+
* For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/push/cordova
10+
*
11+
* @usage
12+
* ```typescript
13+
* import { AppCenterPush } from '@ionic-native/app-center-push';
14+
*
15+
*
16+
* constructor(private appCenterPush: AppCenterPush) { }
17+
*
18+
* ...
19+
*
20+
* this.appCenterPush.setEnabled(true).then(() => {
21+
* this.appCenterPush.addEventListener('My Event').subscribe(pushNotification => {
22+
* console.log('Recived push notification', pushNotification);
23+
* });
24+
* });
25+
*
26+
* ```
27+
*/
28+
@Plugin({
29+
pluginName: 'AppCenterPush',
30+
plugin: 'cordova-plugin-appcenter-push',
31+
pluginRef: 'AppCenter.Push',
32+
repo:
33+
'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-push',
34+
platforms: ['Android', 'iOS']
35+
})
36+
@Injectable()
37+
export class AppCenterPush extends IonicNativePlugin {
38+
/**
39+
* Subscribe to an event
40+
* @param {string} eventname Event name
41+
* @returns {Observable<any>}
42+
*/
43+
@Cordova({
44+
observable: true,
45+
clearFunction: 'removeEventListener'
46+
})
47+
addEventListener(eventname: string): Observable<any> {
48+
return;
49+
}
50+
/**
51+
* Check if App Center Push is enabled
52+
* @returns {Promise<boolean>}
53+
*/
54+
@Cordova()
55+
isEnabled(): Promise<boolean> {
56+
return;
57+
}
58+
59+
/**
60+
* Enable or disable App Center Push at runtime
61+
* @param {boolean} shouldEnable Set value
62+
* @returns {Promise<void>}
63+
*/
64+
@Cordova()
65+
setEnabled(shouldEnable: boolean): Promise<void> {
66+
return;
67+
}
68+
}

0 commit comments

Comments
 (0)