Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): add MS App Center shared plugin #3618

Merged
merged 2 commits into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}