-
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(plugin): add MS App Center shared plugin (#3618)
* feat(plugin): add MS App Center shared plugin * docs(app-center-shared): add incompatible doc
- Loading branch information
1 parent
2cb5f5c
commit 3d7b777
Showing
1 changed file
with
62 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
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; | ||
} | ||
} |