2017-03-20 16:38:14 -04:00
|
|
|
import { Injectable } from '@angular/core';
|
2017-04-27 00:36:12 -04:00
|
|
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
2016-07-08 00:52:13 +02:00
|
|
|
|
2017-03-20 16:38:14 -04:00
|
|
|
/**
|
|
|
|
|
* @name Device Accounts
|
|
|
|
|
* @description
|
|
|
|
|
* Gets the Google accounts associated with the Android device
|
|
|
|
|
*
|
|
|
|
|
* @usage
|
|
|
|
|
* ```typescript
|
|
|
|
|
* import { DeviceAccounts } from '@ionic-native/device-accounts';
|
|
|
|
|
*
|
|
|
|
|
* constructor(private deviceAccounts: DeviceAccounts) { }
|
|
|
|
|
*
|
|
|
|
|
* ...
|
|
|
|
|
*
|
|
|
|
|
* this.deviceAccounts.get()
|
|
|
|
|
* .then(accounts => console.log(accounts))
|
|
|
|
|
* .catch(error => console.error(error));
|
|
|
|
|
*
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
2016-07-08 00:52:13 +02:00
|
|
|
@Plugin({
|
2016-10-27 12:48:50 -05:00
|
|
|
pluginName: 'DeviceAccounts',
|
2016-07-08 00:52:13 +02:00
|
|
|
plugin: 'https://github.com/loicknuchel/cordova-device-accounts.git',
|
|
|
|
|
pluginRef: 'plugins.DeviceAccounts',
|
|
|
|
|
repo: 'https://github.com/loicknuchel/cordova-device-accounts',
|
|
|
|
|
platforms: ['Android']
|
|
|
|
|
})
|
2017-03-20 16:38:14 -04:00
|
|
|
@Injectable()
|
2017-04-27 00:36:12 -04:00
|
|
|
export class DeviceAccounts extends IonicNativePlugin {
|
2016-07-08 00:52:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets all accounts registered on the Android Device
|
2016-11-29 16:40:50 -06:00
|
|
|
* @returns {Promise<any>}
|
2016-07-08 00:52:13 +02:00
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-03-20 16:38:14 -04:00
|
|
|
get(): Promise<any> { return; }
|
2016-07-08 00:52:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all accounts registered on Android device for requested type
|
2016-11-29 16:40:50 -06:00
|
|
|
* @returns {Promise<any>}
|
2016-07-08 00:52:13 +02:00
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-03-20 16:38:14 -04:00
|
|
|
getByType(type: string): Promise<any> { return; }
|
2016-07-08 00:52:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all emails registered on Android device (accounts with 'com.google' type)
|
2016-11-29 16:40:50 -06:00
|
|
|
* @returns {Promise<any>}
|
2016-07-08 00:52:13 +02:00
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-03-20 16:38:14 -04:00
|
|
|
getEmails(): Promise<any> { return; }
|
2016-07-08 00:52:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the first email registered on Android device
|
2016-11-29 16:40:50 -06:00
|
|
|
* @returns {Promise<any>}
|
2016-07-08 00:52:13 +02:00
|
|
|
*/
|
|
|
|
|
@Cordova()
|
2017-03-20 16:38:14 -04:00
|
|
|
getEmail(): Promise<any> { return; }
|
2016-07-20 17:17:09 +02:00
|
|
|
|
2016-07-08 00:52:13 +02:00
|
|
|
}
|