Skip to content

Commit

Permalink
feat(plugin): add MS App Center shared plugin (#3618)
Browse files Browse the repository at this point in the history
* feat(plugin): add MS App Center shared plugin

* docs(app-center-shared): add incompatible doc
  • Loading branch information
johnborges authored Apr 5, 2021
1 parent 2cb5f5c commit 3d7b777
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/@ionic-native/plugins/app-center-shared/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';

/**
* @name App Center Shared
* @capacitorincompatible true
* @description
* Exposes additional shared APIs for App Center.
*
* For more info, please see https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova
*
* @usage
* ```typescript
* import { AppCenter } from '@ionic-native/app-center-shared/ngx';
*
* ...
*
* constructor(private appCenterShared: AppCenter) { }
*
* async getInstallId() {
* const id = await this.appCenter.getInstallId();
* }
*
* async setUserId() {
* try{
* await this.appCenter.setUserId('i-am-john');
* } catch (e){
* console.log(e);
* }
* }
* ```
*/
@Plugin({
pluginName: 'AppCenter',
plugin: 'cordova-plugin-appcenter-shared',
pluginRef: 'AppCenter',
repo: 'https://github.com/Microsoft/appcenter-sdk-cordova/tree/master/cordova-plugin-appcenter-shared',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class AppCenter extends IonicNativePlugin {
/**
* Returns AppCenter UUID.
* For more info, please see: https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova#identify-installations
* @returns {Promise<string>} Install ID
*/
@Cordova()
getInstallId(): Promise<string> {
return;
}

/**
* Set a user ID that's used to augment crash reports.
* For more info, please see: https://docs.microsoft.com/en-us/appcenter/sdk/other-apis/cordova#identify-users
* @param {string} userId Ex. "your-user-id"
* @returns {Promise<void>}
*/
@Cordova()
setUserId(userId: string): Promise<void> {
return;
}
}

0 comments on commit 3d7b777

Please sign in to comment.