feat(device-accounts): add android account interface

This commit is contained in:
Daniel Sogl 2018-03-16 15:11:08 +01:00 committed by GitHub
parent f11be24f74
commit d2261b6432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,16 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface AndroidAccount {
/** Account creator */
CREATOR: AndroidAccount;
/** Account name */
name: string;
/** Account type */
type: string;
}
/** /**
* @name Device Accounts * @name Device Accounts
@ -19,6 +30,8 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
* .catch(error => console.error(error)); * .catch(error => console.error(error));
* *
* ``` * ```
* @interfaces
* AndroidAccount
*/ */
@Plugin({ @Plugin({
pluginName: 'DeviceAccounts', pluginName: 'DeviceAccounts',
@ -29,33 +42,39 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
}) })
@Injectable() @Injectable()
export class DeviceAccounts extends IonicNativePlugin { export class DeviceAccounts extends IonicNativePlugin {
/** /**
* Gets all accounts registered on the Android Device * Gets all accounts registered on the Android Device
* @returns {Promise<any>} * @returns {Promise<AndroidAccount[]>}
*/ */
@Cordova() @Cordova()
get(): Promise<any> { return; } get(): Promise<AndroidAccount[]> {
return;
}
/** /**
* Get all accounts registered on Android device for requested type * Get all accounts registered on Android device for requested type
* @returns {Promise<any>} * @returns {Promise<AndroidAccount[]>}
*/ */
@Cordova() @Cordova()
getByType(type: string): Promise<any> { return; } getByType(type: string): Promise<AndroidAccount[]> {
return;
}
/** /**
* Get all emails registered on Android device (accounts with 'com.google' type) * Get all emails registered on Android device (accounts with 'com.google' type)
* @returns {Promise<any>} * @returns {Promise<string[]>}
*/ */
@Cordova() @Cordova()
getEmails(): Promise<any> { return; } getEmails(): Promise<string[]> {
return;
}
/** /**
* Get the first email registered on Android device * Get the first email registered on Android device
* @returns {Promise<any>} * @returns {Promise<string>}
*/ */
@Cordova() @Cordova()
getEmail(): Promise<any> { return; } getEmail(): Promise<string> {
return;
}
} }