-
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(pin-dialog): add pin dialog plugin (#291)
- Loading branch information
Showing
2 changed files
with
40 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
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,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; } | ||
} |