Skip to content

Commit

Permalink
feat(unique-device-add): add UniqueDeviceId plugin (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
bytenik authored and ihadeed committed Mar 2, 2017
1 parent 2a32624 commit 60db10c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ import { TouchID } from './plugins/touchid';
import { TextToSpeech } from './plugins/text-to-speech';
import { ThemeableBrowser } from './plugins/themeable-browser';
import { TwitterConnect } from './plugins/twitter-connect';
import { UniqueDeviceID } from './plugins/unique-device-id';
import { Vibration } from './plugins/vibration';
import { VideoEditor } from './plugins/video-editor';
import { VideoPlayer } from './plugins/video-player';
Expand Down Expand Up @@ -245,6 +246,7 @@ export * from './plugins/themeable-browser';
export * from './plugins/toast';
export * from './plugins/touchid';
export * from './plugins/twitter-connect';
export * from './plugins/unique-device-id';
export * from './plugins/vibration';
export * from './plugins/video-editor';
export * from './plugins/video-player';
Expand Down Expand Up @@ -372,6 +374,7 @@ window['IonicNative'] = {
TextToSpeech,
ThemeableBrowser,
TwitterConnect,
UniqueDeviceID,
VideoEditor,
VideoPlayer,
Vibration,
Expand Down
35 changes: 35 additions & 0 deletions src/plugins/unique-device-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Plugin, Cordova } from './plugin';

/**
* @name UniqueDeviceID
* @description
* This plugin produces a unique, cross-install, app-specific device id.
*
* @usage
* ```
* import { UniqueDeviceID } from 'ionic-native';
*
* UniqueDeviceID.get()
* .then((uuid: any) => doSomething(uuid))
* .catch((error: any) => console.log(error));
*
* ```
*/
@Plugin({
pluginName: 'UniqueDeviceID',
plugin: 'cordova-plugin-uniquedeviceid', // npm package name, example: cordova-plugin-camera
pluginRef: 'window.plugins.uniqueDeviceID', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/Paldom/UniqueDeviceID' // the github repository URL for the plugin
})
export class UniqueDeviceID {

/**
* Gets a unique, cross-install, app-specific device id.
* @return {Promise<string>} Returns a promise that resolves when something happens
*/
@Cordova()
static get(): Promise<string> {
return; // We add return; here to avoid any IDE / Compiler errors
}

}

0 comments on commit 60db10c

Please sign in to comment.