Skip to content

Commit

Permalink
feat(pin-dialog): add pin dialog plugin (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Jul 15, 2016
1 parent be1725d commit 2fe37c4
Show file tree
Hide file tree
Showing 2 changed files with 40 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 @@ -54,6 +54,7 @@ import {LocalNotifications} from './plugins/localnotifications';
import {MediaPlugin} from './plugins/media';
import {Network} from './plugins/network';
import {OneSignal} from './plugins/onesignal';
import {PinDialog} from './plugins/pin-dialog';
import {Printer} from './plugins/printer';
import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
Expand Down Expand Up @@ -128,6 +129,7 @@ export {
Keyboard,
Network,
OneSignal,
PinDialog,
Screenshot,
SocialSharing,
Splashscreen,
Expand Down Expand Up @@ -193,6 +195,7 @@ window['IonicNative'] = {
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SMS: SMS,
Expand Down
37 changes: 37 additions & 0 deletions src/plugins/pin-dialog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Pin Dialog
* @description
*
* @usage
* ```typescript
* import {PinDialog} from 'ionic-native';
*
* ...
*
* PinDialog.prompt('Enter your PIN', 'Verify PIN', ['OK', 'Cancel'])
* .then(
* (result: any) => {
* if(result.buttonIndex == 1) console.log('User clicked OK, value is: ', result.input1);
* else if(result.buttonIndex == 2) console.log('User cancelled');
* }
* );
* ```
*/
@Plugin({
plugin: 'cordova-plugin-pin-dialog',
pluginRef: 'plugins.pinDialog',
repo: 'https://github.com/Paldom/PinDialog'
})
export class PinDialog {
/**
* Show pin dialog
* @param {string} message Message to show the user
* @param {string} title Title of the dialog
* @param {string[]} buttons Buttons to show
*/
@Cordova({
successIndex: 1
})
static prompt(message: string, title: string, buttons: string[]): Promise<{buttonIndex: number, input1: string}> {return; }
}

0 comments on commit 2fe37c4

Please sign in to comment.